Skip to content

Commit ab6eda0

Browse files
authored
GH-118095: Allow a variant of RESUME_CHECK in tier 2 (GH-118286)
1 parent aa8f6d2 commit ab6eda0

File tree

6 files changed

+189
-103
lines changed

6 files changed

+189
-103
lines changed

Include/internal/pycore_uop_ids.h

+104-102
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

+23
Original file line numberDiff line numberDiff line change
@@ -4258,6 +4258,29 @@ dummy_func(
42584258
}
42594259

42604260

4261+
/* Special version of RESUME_CHECK that (when paired with _EVAL_BREAKER_EXIT)
4262+
* is safe for tier 2. Progress is guaranteed because _EVAL_BREAKER_EXIT calls
4263+
* _Py_HandlePending which clears the eval_breaker so that _TIER2_RESUME_CHECK
4264+
* will not exit if it is immediately executed again. */
4265+
tier2 op(_TIER2_RESUME_CHECK, (--)) {
4266+
#if defined(__EMSCRIPTEN__)
4267+
EXIT_IF(_Py_emscripten_signal_clock == 0);
4268+
_Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
4269+
#endif
4270+
uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
4271+
EXIT_IF(eval_breaker & _PY_EVAL_EVENTS_MASK);
4272+
assert(eval_breaker == FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version));
4273+
}
4274+
4275+
tier2 op(_EVAL_BREAKER_EXIT, (--)) {
4276+
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY();
4277+
QSBR_QUIESCENT_STATE(tstate);
4278+
if (_Py_HandlePending(tstate) != 0) {
4279+
GOTO_UNWIND();
4280+
}
4281+
EXIT_TO_TRACE();
4282+
}
4283+
42614284
// END BYTECODES //
42624285

42634286
}

Python/executor_cases.c.h

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)