Skip to content

Commit 911520a

Browse files
committed
Check validity at start of trace
1 parent ec7f0e2 commit 911520a

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

Python/bytecodes.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5352,7 +5352,6 @@ dummy_func(
53525352
current_executor = (_PyExecutorObject*)executor;
53535353
#endif
53545354
tstate->current_executor = (PyObject *)executor;
5355-
assert(((_PyExecutorObject *)executor)->vm_data.valid);
53565355
}
53575356

53585357
tier2 op(_MAKE_WARM, (--)) {

Python/executor_cases.c.h

Lines changed: 0 additions & 1 deletion
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ translate_bytecode_to_trace(
584584
code->co_firstlineno,
585585
2 * INSTR_IP(initial_instr, code));
586586
ADD_TO_TRACE(_START_EXECUTOR, 0, (uintptr_t)instr, INSTR_IP(instr, code));
587+
ADD_TO_TRACE(_CHECK_VALIDITY, 0, 0, 0);
587588
ADD_TO_TRACE(_MAKE_WARM, 0, 0, 0);
588589
uint32_t target = 0;
589590

@@ -1472,8 +1473,7 @@ _PyExecutor_GetColdExecutor(void)
14721473
return interp->cold_executor;
14731474
}
14741475
_PyExecutorObject *cold = allocate_executor(0, 1);
1475-
assert((void *)cold->trace == (void *)cold->exits);
1476-
((_PyUOpInstruction *)cold->exits)->opcode = _COLD_EXIT;
1476+
((_PyUOpInstruction *)cold->trace)->opcode = _COLD_EXIT;
14771477
if (cold == NULL) {
14781478
Py_FatalError("Cannot allocate core JIT code");
14791479
}
@@ -1526,16 +1526,11 @@ executor_clear(PyObject *op)
15261526
unlink_executor(executor);
15271527
executor->vm_data.valid = 0;
15281528

1529-
_PyExecutorObject *cold = _PyExecutor_GetColdExecutor();
1530-
((_PyUOpInstruction *)executor->trace)->opcode = _COLD_EXIT;
1531-
#ifdef _Py_JIT
1532-
executor->jit_code = cold->jit_code;
1533-
#endif
1534-
15351529
/* It is possible for an executor to form a reference
15361530
* cycle with itself, so decref'ing a side exit could
15371531
* free the executor unless we hold a strong reference to it
15381532
*/
1533+
_PyExecutorObject *cold = _PyExecutor_GetColdExecutor();
15391534
Py_INCREF(executor);
15401535
for (uint32_t i = 0; i < executor->exit_count; i++) {
15411536
executor->exits[i].temperature = initial_unreachable_backoff_counter();

0 commit comments

Comments
 (0)