From 773e0167bf1abe07e2096892c8b28bd50c397f08 Mon Sep 17 00:00:00 2001 From: Dino Viehland Date: Fri, 29 Mar 2024 12:56:11 -0700 Subject: [PATCH] Move CHECK_EVAL_BREAKER in ENTER_EXECUTOR --- Python/bytecodes.c | 4 ++-- Python/executor_cases.c.h | 2 +- Python/generated_cases.c.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 30638ad018ac750..ba525cc8b161c69 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -171,7 +171,7 @@ dummy_func( _Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING; #endif uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker); - uintptr_t version = _PyFrame_GetCode(frame)->_co_instrumentation_version; + uintptr_t version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version); assert((version & _PY_EVAL_EVENTS_MASK) == 0); DEOPT_IF(eval_breaker != version); } @@ -2391,7 +2391,6 @@ dummy_func( }; tier1 inst(ENTER_EXECUTOR, (--)) { - CHECK_EVAL_BREAKER(); PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = code->co_executors->executors[oparg & 255]; assert(executor->vm_data.index == INSTR_OFFSET() - 1); @@ -2400,6 +2399,7 @@ dummy_func( assert(tstate->previous_executor == NULL); tstate->previous_executor = Py_None; Py_INCREF(executor); + CHECK_EVAL_BREAKER(); GOTO_TIER_TWO(executor); } diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index a55daa2c3449449..dcb373a2d7a72ba 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -18,7 +18,7 @@ _Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING; #endif uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker); - uintptr_t version = _PyFrame_GetCode(frame)->_co_instrumentation_version; + uintptr_t version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version); assert((version & _PY_EVAL_EVENTS_MASK) == 0); if (eval_breaker != version) goto deoptimize; break; diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 9a26773c5a70972..5dcb58f24044950 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2499,7 +2499,6 @@ frame->instr_ptr = next_instr; next_instr += 1; INSTRUCTION_STATS(ENTER_EXECUTOR); - CHECK_EVAL_BREAKER(); PyCodeObject *code = _PyFrame_GetCode(frame); _PyExecutorObject *executor = code->co_executors->executors[oparg & 255]; assert(executor->vm_data.index == INSTR_OFFSET() - 1); @@ -2508,6 +2507,7 @@ assert(tstate->previous_executor == NULL); tstate->previous_executor = Py_None; Py_INCREF(executor); + CHECK_EVAL_BREAKER(); GOTO_TIER_TWO(executor); DISPATCH(); } @@ -4967,7 +4967,7 @@ _Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING; #endif uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker); - uintptr_t version = _PyFrame_GetCode(frame)->_co_instrumentation_version; + uintptr_t version = FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version); assert((version & _PY_EVAL_EVENTS_MASK) == 0); DEOPT_IF(eval_breaker != version, RESUME); DISPATCH();