Skip to content

Commit 656ada0

Browse files
committed
Add some asserts
1 parent 989a882 commit 656ada0

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Python/bytecodes.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5353,10 +5353,11 @@ dummy_func(
53535353
#ifndef _Py_JIT
53545354
current_executor = (_PyExecutorObject*)executor;
53555355
#endif
5356+
assert(tstate->jit_exit == NULL || tstate->jit_exit->executor == current_executor);
53565357
tstate->current_executor = (PyObject *)executor;
53575358
if (!current_executor->vm_data.valid) {
53585359
assert(tstate->jit_exit->executor == current_executor);
5359-
assert(tstate->current_executor == current_executor);
5360+
assert(tstate->current_executor == executor);
53605361
_PyExecutor_ClearExit(tstate->jit_exit);
53615362
DEOPT_IF(true);
53625363
}
@@ -5407,15 +5408,15 @@ dummy_func(
54075408
exit->temperature = advance_backoff_counter(temperature);
54085409
GOTO_TIER_ONE(target);
54095410
}
5410-
_PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit);
5411-
assert(tstate->current_executor == (PyObject *)previous_executor);
54125411
_PyExecutorObject *executor;
54135412
if (target->op.code == ENTER_EXECUTOR) {
54145413
PyCodeObject *code = _PyFrame_GetCode(frame);
54155414
executor = code->co_executors->executors[target->op.arg];
54165415
Py_INCREF(executor);
54175416
}
54185417
else {
5418+
_PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit);
5419+
assert(tstate->current_executor == (PyObject *)previous_executor);
54195420
int chain_depth = previous_executor->vm_data.chain_depth + 1;
54205421
int optimized = _PyOptimizer_Optimize(frame, target, &executor, chain_depth);
54215422
if (optimized <= 0) {

Python/executor_cases.c.h

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

Python/pystate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,8 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
818818
struct _PyExecutorObject *cold = interp->cold_executor;
819819
if (cold != NULL) {
820820
interp->cold_executor = NULL;
821+
assert(cold->vm_data.valid);
822+
assert(cold->vm_data.warm);
821823
_PyExecutor_Free(cold);
822824
}
823825
/* We don't clear sysdict and builtins until the end of this function.

0 commit comments

Comments
 (0)