GH-106581: Fix instrumentation in tier 2 (GH-108493)

This commit is contained in:
Brandt Bucher 2023-08-25 12:12:59 -07:00 committed by GitHub
parent 5f41376e93
commit 4eae1e5342
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 12 deletions

View file

@ -0,0 +1,2 @@
Fix possible assertion failures and missing instrumentation events when
:envvar:`PYTHONUOPS` or :option:`-X uops <-X>` is enabled.

View file

@ -133,17 +133,19 @@ dummy_func(
}
inst(RESUME, (--)) {
#if TIER_ONE
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);
ERROR_IF(err, error);
#if TIER_ONE
next_instr--;
}
else
#endif
if (oparg < 2) {
#if TIER_TWO
goto deoptimize;
#endif
}
else if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
}

View file

@ -8,17 +8,19 @@
}
case RESUME: {
#if TIER_ONE
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--;
}
else
#endif
if (oparg < 2) {
#if TIER_TWO
goto deoptimize;
#endif
}
else if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
break;

View file

@ -8,17 +8,19 @@
}
TARGET(RESUME) {
#if TIER_ONE
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--;
}
else
#endif
if (oparg < 2) {
#if TIER_TWO
goto deoptimize;
#endif
}
else if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
DISPATCH();