mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
GH-108614: Add RESUME_CHECK
instruction (GH-108630)
This commit is contained in:
parent
d485551c9d
commit
0858328ca2
16 changed files with 519 additions and 482 deletions
28
Python/generated_cases.c.h
generated
28
Python/generated_cases.c.h
generated
|
@ -8,24 +8,36 @@
|
|||
}
|
||||
|
||||
TARGET(RESUME) {
|
||||
PREDICTED(RESUME);
|
||||
static_assert(0 == 0, "incorrect cache size");
|
||||
TIER_ONE_ONLY
|
||||
assert(frame == tstate->current_frame);
|
||||
/* Possibly combine this with eval breaker */
|
||||
if (_PyFrame_GetCode(frame)->_co_instrumentation_version != tstate->interp->monitoring_version) {
|
||||
int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
|
||||
if (err) goto error;
|
||||
#if TIER_ONE
|
||||
next_instr--;
|
||||
#endif
|
||||
#if TIER_TWO
|
||||
goto deoptimize;
|
||||
#endif
|
||||
}
|
||||
else if (oparg < 2) {
|
||||
CHECK_EVAL_BREAKER();
|
||||
else {
|
||||
if (oparg < 2) {
|
||||
CHECK_EVAL_BREAKER();
|
||||
}
|
||||
next_instr[-1].op.code = RESUME_CHECK;
|
||||
}
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(RESUME_CHECK) {
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
DEOPT_IF(emscripten_signal_clock == 0, RESUME);
|
||||
emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
|
||||
#endif
|
||||
/* Possibly combine these two checks */
|
||||
DEOPT_IF(_PyFrame_GetCode(frame)->_co_instrumentation_version
|
||||
!= tstate->interp->monitoring_version, RESUME);
|
||||
DEOPT_IF(_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker), RESUME);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_RESUME) {
|
||||
/* Possible performance enhancement:
|
||||
* We need to check the eval breaker anyway, can we
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue