Skip to content

Commit 20b283b

Browse files
Fix ENTER_EXECUTOR bug
1 parent 3066963 commit 20b283b

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

Python/bytecodes.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,8 +3045,13 @@ dummy_func(
30453045
assert(executor != tstate->interp->cold_executor);
30463046
tstate->jit_exit = NULL;
30473047
if (IS_JIT_TRACING()) {
3048-
RECORD_TRACE();
3049-
BAIL_TRACING_NO_DISPATCH();
3048+
int old_opcode = executor->vm_data.opcode;
3049+
int old_oparg = (oparg & ~255) | executor->vm_data.oparg;
3050+
RECORD_TRACE_NO_DISPATCH();
3051+
opcode = old_opcode;
3052+
oparg = old_oparg;
3053+
next_instr = this_instr;
3054+
DISPATCH_GOTO();
30503055
}
30513056
TIER1_TO_TIER2(executor, 1);
30523057
#else

Python/ceval_macros.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
# define BAIL_TRACING_NO_DISPATCH() \
138138
LEAVE_TRACING(); \
139139
int err = _PyOptimizer_Optimize(frame, tstate); \
140-
tstate->interp->jit_tracer_code_curr_size = 0; \
141140
if (err < 0) { \
142141
JUMP_TO_LABEL(error); \
143142
}
@@ -150,6 +149,12 @@
150149
BAIL_TRACING(); \
151150
} \
152151
} while (0);
152+
# define RECORD_TRACE_NO_DISPATCH() do { \
153+
frame->instr_ptr = next_instr; \
154+
if (add_to_code_trace(tstate, frame, old_code, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
155+
BAIL_TRACING_NO_DISPATCH(); \
156+
} \
157+
} while (0);
153158
#endif
154159

155160

Python/generated_cases.c.h

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)