Skip to content

Commit 95eee89

Browse files
Fix handling of EXTENDED_ARG
1 parent 8e0fb21 commit 95eee89

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

Python/bytecodes.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5466,7 +5466,6 @@ dummy_func(
54665466
_Py_CODEUNIT *target = frame->instr_ptr;
54675467
_PyExitData *exit = (_PyExitData *)exit_p;
54685468
_Py_BackoffCounter temperature = exit->temperature;
5469-
tstate->jit_exit = exit;
54705469
#if defined(Py_DEBUG) && !defined(_Py_JIT)
54715470
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
54725471
if (frame->lltrace >= 2) {
@@ -5481,10 +5480,8 @@ dummy_func(
54815480
if (target->op.code == ENTER_EXECUTOR) {
54825481
PyCodeObject *code = _PyFrame_GetCode(frame);
54835482
_PyExecutorObject *executor = code->co_executors->executors[target->op.arg];
5484-
Py_INCREF(executor);
5485-
assert(tstate->jit_exit == exit);
5486-
exit->executor = executor;
5487-
TIER2_TO_TIER2(exit->executor);
5483+
tstate->jit_exit = NULL;
5484+
TIER2_TO_TIER2(executor);
54885485
}
54895486
else {
54905487
if (frame->owner >= FRAME_OWNED_BY_INTERPRETER) {
@@ -5497,7 +5494,7 @@ dummy_func(
54975494
exit->temperature = initial_temperature_backoff_counter();
54985495
_PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit);
54995496
assert(tstate->current_executor == (PyObject *)previous_executor);
5500-
_PyJIT_InitializeTracing(tstate, frame, target, STACK_LEVEL(), 0, exit);
5497+
_PyJIT_InitializeTracing(tstate, frame, target, STACK_LEVEL(), 0, NULL);
55015498
GOTO_TIER_ONE(target, 1);
55025499
}
55035500
}

Python/ceval_macros.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@
133133
#define TRACING_JUMP_TO_LABEL(label) \
134134
RECORD_JUMP_TAKEN() \
135135
RECORD_TRACE_NO_DISPATCH() \
136+
assert(!IS_JIT_TRACING()); \
137+
RELOAD_TRACING(); \
136138
JUMP_TO_LABEL(label);
137139

138140
#if _Py_TAIL_CALL_INTERP || USE_COMPUTED_GOTOS
@@ -161,7 +163,7 @@
161163
JUMP_TO_LABEL(error); \
162164
}
163165
# define RECORD_TRACE_NO_DISPATCH() do { \
164-
if (DISPATCH_TABLE_VAR == TRACING_DISPATCH_TABLE && add_to_code_trace(tstate, frame, old_code, old_func, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
166+
if (IS_JIT_TRACING() && add_to_code_trace(tstate, frame, old_code, old_func, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
165167
BAIL_TRACING_NO_DISPATCH(); \
166168
} \
167169
} while (0);

Python/executor_cases.c.h

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

Python/optimizer.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ is_for_iter_test[MAX_UOP_ID + 1] = {
468468
[_GUARD_NOT_EXHAUSTED_RANGE] = 1,
469469
[_GUARD_NOT_EXHAUSTED_LIST] = 1,
470470
[_GUARD_NOT_EXHAUSTED_TUPLE] = 1,
471-
[_FOR_ITER_TIER_TWO] = 1,
472471
};
473472

474473
static const uint16_t
@@ -586,18 +585,11 @@ _PyJIT_translate_single_bytecode_to_trace(
586585

587586
DPRINTF(2, "%d: %s(%d)\n", target, _PyOpcode_OpName[opcode], oparg);
588587

589-
// One for possible _DEOPT, one because _CHECK_VALIDITY itself might _DEOPT
590-
max_length -= 2;
591588
if ((uint16_t)oparg != (uint64_t)oparg) {
592-
// Back up over EXTENDED_ARGs
593-
_PyUOpInstruction *curr = &trace[trace_length-1];
594-
while (oparg > 0) {
595-
oparg >>= 8;
596-
trace_length--;
597-
}
598-
goto full;
589+
goto unsupported;
599590
}
600-
591+
// One for possible _DEOPT, one because _CHECK_VALIDITY itself might _DEOPT
592+
max_length -= 2;
601593

602594
if (opcode == EXTENDED_ARG) {
603595
return 1;

0 commit comments

Comments
 (0)