8000 gh-111520: Integrate the Tier 2 interpreter in the Tier 1 interpreter by gvanrossum · Pull Request #111428 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-111520: Integrate the Tier 2 interpreter in the Tier 1 interpreter #111428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
97984d3
Make all labels in _PyUopExecute end in _tier_two
gvanrossum Oct 27, 2023
157a450
Control lltrace via PYTHON_LLTRACE=N
gvanrossum Oct 27, 2023
d1b9c1b
Rename PYTHONUOPS to PYTHON_UOPS for consistency
gvanrossum Oct 27, 2023
d805312
Integrate Tier 2 into _PyEval_EvalFrameDefault
gvanrossum Oct 27, 2023
e0e60ce
DO NOT MERGE: Always use -Xuops
gvanrossum Aug 9, 2023
a720f1a
Merge branch 'main' into mix-tiers
gvanrossum Oct 30, 2023
b808f6d
Merge branch 'main' into mix-tiers
gvanrossum Oct 31, 2023
a0aed59
Get rid of separate executor.c file
gvanrossum Oct 31, 2023
75605c7
Most suggestions from Mark's code review
gvanrossum Oct 31, 2023
5e84476
Fix test_generated_cases.py by stripping preprocessor prefix/suffix
gvanrossum Oct 31, 2023
917b7a2
Eradicate executors.c from Windows build files
gvanrossum Nov 1, 2023
9067eb0
Rename deoptimize_tier_two back to deoptimize (for Justin)
gvanrossum Nov 1, 2023
6a4e495
Fix whitespace
gvanrossum Nov 1, 2023
81f1883
Revert "DO NOT MERGE: Always use -Xuops"
gvanrossum Nov 1, 2023
ee27e73 8000
Add blurb
gvanrossum Nov 1, 2023
7ebc228
Add more color to the news blurb
gvanrossum Nov 1, 2023
a1d0108
Merge remote-tracking branch 'origin/main' into mix-tiers
gvanrossum Nov 1, 2023
a96ac7f
Eliminate 'operand' local variable
gvanrossum Nov 1, 2023
e02409d
Rename self -> current_executor (TODO: eliminate it?)
gvanrossum Nov 1, 2023
fdf1a2f
Move `_EXIT_TRACE` logic to a separate label
gvanrossum Nov 1, 2023
2a6450c
Limit infinite recursion in test_typing
gvanrossum Nov 1, 2023
4783de3
Limit infinite recursion in test_fileio
gvanrossum Nov 1, 2023
b9516a1
Limit infinite recursion in test_xml_etree
gvanrossum Nov 1, 2023
33c3fae
Limit infinite recursion in test_call
gvanrossum Nov 1, 2023
998e054
Fix test_call better: adjust Py_C_RECURSION_LIMIT in pystate.h
gvanrossum Nov 1, 2023
19d9d40
Revert unnecessary fixes to recursive tests
gvanrossum Nov 1, 2023
03de1bf
Even better fix -- increase stack space on Windows in debug mode
gvanrossum Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Control lltrace via PYTHON_LLTRACE=N
This replaces PYTHONUOPSDEBUG=N. The meaning of N is the same (for now):

  0: no tracing
  1: print when tier 2 trace created
  2: print contents of tier 2 trace
  3: print every uop executed
  4: print optimization attempts and details
  5: print tier 1 instructions and stack
  • Loading branch information
gvanrossum committed Oct 27, 2023
commit 157a4504673a2beff3de266acbc4a5f9beaf29b7
14 changes: 7 additions & 7 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ maybe_lltrace_resume_frame(_PyInterpreterFrame *frame, _PyInterpreterFrame *skip
if (r < 0) {
return -1;
}
int lltrace = r;
int lltrace = r * 5; // Levels 1-4 only trace uops
if (!lltrace) {
// When tracing executed uops, also trace bytecode
char *uop_debug = Py_GETENV("PYTHONUOPSDEBUG");
if (uop_debug != NULL && *uop_debug >= '0') {
lltrace = (*uop_debug - '0') >= 5; // TODO: Parse an int and all that
// Can also be controlled by environment variable
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
if (python_lltrace != NULL && *python_lltrace >= '0') {
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
}
}
if (lltrace) {
if (lltrace >= 5) {
lltrace_resume_frame(frame);
}
return lltrace;
Expand Down Expand Up @@ -913,7 +913,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
}
/* Resume normal execution */
#ifdef LLTRACE
if (lltrace) {
if (lltrace >= 5) {
lltrace_resume_frame(frame);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

/* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */
#ifdef LLTRACE
#define PRE_DISPATCH_GOTO() if (lltrace) { \
#define PRE_DISPATCH_GOTO() if (lltrace >= 5) { \
lltrace_instruction(frame, stack_pointer, next_instr); }
#else
#define PRE_DISPATCH_GOTO() ((void)0)
Expand Down
6 changes: 3 additions & 3 deletions Python/executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ _PyInterpreterFrame *
_PyUopExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject **stack_pointer)
{
#ifdef Py_DEBUG
char *uop_debug = Py_GETENV("PYTHONUOPSDEBUG");
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
int lltrace = 0;
if (uop_debug != NULL && *uop_debug >= '0') {
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
if (python_lltrace != NULL && *python_lltrace >= '0') {
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
}
#define DPRINTF(level, ...) \
if (lltrace >= (level)) { printf(__VA_ARGS__); }
Expand Down
12 changes: 6 additions & 6 deletions Python/optimizer.c
9951
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ translate_bytecode_to_trace(
int trace_stack_depth = 0;

#ifdef Py_DEBUG
char *uop_debug = Py_GETENV("PYTHONUOPSDEBUG");
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
int lltrace = 0;
if (uop_debug != NULL && *uop_debug >= '0') {
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
if (python_lltrace != NULL && *python_lltrace >= '0') {
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
}
#endif

Expand Down Expand Up @@ -883,10 +883,10 @@ remove_unneeded_uops(_PyUOpInstruction *trace, int trace_length)
if (dest < last_instr) {
int new_trace_length = move_stubs(trace, dest, last_instr, trace_length);
#ifdef Py_DEBUG
char *uop_debug = Py_GETENV("PYTHONUOPSDEBUG");
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
int lltrace = 0;
if (uop_debug != NULL && *uop_debug >= '0') {
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
if (python_lltrace != NULL && *python_lltrace >= '0') {
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
}
if (lltrace >= 2) {
printf("Optimized trace (length %d+%d = %d, saved %d):\n",
Expand Down
0