Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5127,6 +5127,16 @@ def f():
f" {executor} at offset {idx} rather"
f" than expected _EXIT_TRACE")

def test_jit_shutdown_after_cold_executor_creation(self):
script_helper.assert_python_ok("-c", textwrap.dedent(f"""
def f():
for x in range({TIER2_THRESHOLD + 3}):
for y in range({TIER2_THRESHOLD + 3}):
z = x + y
f()
"""), PYTHON_JIT="1")

def test_enter_executor_valid_op_arg(self):
script_helper.assert_python_ok("-c", textwrap.dedent("""
import sys
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a JIT assertion during interpreter shutdown by initializing ``vm_data``
fields for cold executors that bypass ``_Py_ExecutorInit()``.
4 changes: 4 additions & 0 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,10 @@ make_cold_executor(uint16_t opcode)
Py_FatalError("Cannot allocate core JIT code");
}
((_PyUOpInstruction *)cold->trace)->opcode = opcode;
// Cold executors bypass _Py_ExecutorInit().
cold->vm_data.valid = true;
cold->vm_data.pending_deletion = 0;
Comment thread
BHUVANSH855 marked this conversation as resolved.

// This is initialized to false so we can prevent the executor
// from being immediately detected as cold and invalidated.
cold->vm_data.cold = false;
Expand Down
Loading