Skip to content

Commit f938d68

Browse files
committed
Address review comments
1 parent 2f42cb0 commit f938d68

File tree

6 files changed

+11
-15
lines changed

6 files changed

+11
-15
lines changed

Python/bytecodes.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,7 +2924,6 @@ dummy_func(
29242924
else {
29252925
this_instr[1].counter = initial_jump_backoff_counter();
29262926
assert(tstate->current_executor == NULL);
2927-
tstate->current_executor = (PyObject *)executor;
29282927
GOTO_TIER_TWO(executor);
29292928
}
29302929
}
@@ -2989,7 +2988,6 @@ dummy_func(
29892988
}
29902989
DISPATCH_GOTO();
29912990
}
2992-
tstate->current_executor = (PyObject *)executor;
29932991
GOTO_TIER_TWO(executor);
29942992
#else
29952993
Py_FatalError("ENTER_EXECUTOR is not supported in this build");
@@ -5264,7 +5262,6 @@ dummy_func(
52645262
exit->temperature = initial_temperature_backoff_counter();
52655263
Py_CLEAR(exit->executor);
52665264
}
5267-
tstate->current_executor = NULL;
52685265
if (exit->executor == NULL) {
52695266
_Py_BackoffCounter temperature = exit->temperature;
52705267
if (!backoff_counter_triggers(temperature)) {
@@ -5287,7 +5284,6 @@ dummy_func(
52875284
}
52885285
exit->executor = executor;
52895286
}
5290-
tstate->current_executor = (PyObject *)exit->executor;
52915287
GOTO_TIER_TWO(exit->executor);
52925288
}
52935289

@@ -5346,12 +5342,10 @@ dummy_func(
53465342
}
53475343

53485344
tier2 op(_DEOPT, (--)) {
5349-
tstate->current_executor = NULL;
53505345
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
53515346
}
53525347

53535348
tier2 op(_ERROR_POP_N, (target/2 --)) {
5354-
tstate->current_executor = NULL;
53555349
assert(oparg == 0);
53565350
frame->instr_ptr = _PyFrame_GetBytecode(frame) + target;
53575351
SYNC_SP();

Python/ceval_macros.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ _PyFrame_SetStackPointer(frame, stack_pointer)
359359
do { \
360360
OPT_STAT_INC(traces_executed); \
361361
_PyExecutorObject *_executor = (EXECUTOR); \
362-
assert(tstate->current_executor == _executor); \
362+
tstate->current_executor = (PyObject *)_executor; \
363363
jit_func jitted = _executor->jit_code; \
364364
/* Keep the shim frame alive via the executor: */ \
365365
Py_INCREF(_executor); \
@@ -378,7 +378,9 @@ do { \
378378
#define GOTO_TIER_TWO(EXECUTOR) \
379379
do { \
380380
OPT_STAT_INC(traces_executed); \
381-
next_uop = (EXECUTOR)->trace; \
381+
_PyExecutorObject *_executor = (EXECUTOR); \
382+
tstate->current_executor = (PyObject *)_executor; \
383+
next_uop = _executor->trace; \
382384
assert(next_uop->opcode == _START_EXECUTOR); \
383385
goto enter_tier_two; \
384386
} while (0)
@@ -387,6 +389,7 @@ do { \
387389
#define GOTO_TIER_ONE(TARGET) \
388390
do \
389391
{ \
392+
tstate->current_executor = NULL; \
390393
next_instr = (TARGET); \
391394
assert(tstate->current_executor == NULL); \
392395
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); \

Python/executor_cases.c.h

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

Python/generated_cases.c.h

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

Python/optimizer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ _Py_ClearExecutorDeletionList(PyInterpreterState *interp)
224224
while (ts) {
225225
_PyExecutorObject *current = (_PyExecutorObject *)ts->current_executor;
226226
if (current != NULL) {
227+
/* Anything in this list will be unlinked, so we can reuse the
228+
* linked field as a reachability marker. */
227229
current->vm_data.linked = 1;
228230
}
229231
HEAD_LOCK(runtime);

Tools/jit/template.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@
5050
#define GOTO_TIER_TWO(EXECUTOR) \
5151
do { \
5252
OPT_STAT_INC(traces_executed); \
53-
jit_func_preserve_none jitted = (EXECUTOR)->jit_side_entry; \
53+
_PyExecutorObject *_executor = (EXECUTOR); \
54+
tstate->current_executor = (PyObject *)_executor; \
55+
jit_func_preserve_none jitted = _executor->jit_side_entry; \
5456
__attribute__((musttail)) return jitted(frame, stack_pointer, tstate); \
5557
} while (0)
5658

5759
#undef GOTO_TIER_ONE
5860
#define GOTO_TIER_ONE(TARGET) \
5961
do { \
62+
tstate->current_executor = NULL; \
6063
_PyFrame_SetStackPointer(frame, stack_pointer); \
6164
return TARGET; \
6265
} while (0)

0 commit comments

Comments
 (0)