Skip to content

Commit 4eae1e5

Browse files
authored
GH-106581: Fix instrumentation in tier 2 (GH-108493)
1 parent 5f41376 commit 4eae1e5

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix possible assertion failures and missing instrumentation events when
2+
:envvar:`PYTHONUOPS` or :option:`-X uops <-X>` is enabled.

Python/bytecodes.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,19 @@ dummy_func(
133133
}
134134

135135
inst(RESUME, (--)) {
136-
#if TIER_ONE
137136
assert(frame == tstate->current_frame);
138137
/* Possibly combine this with eval breaker */
139138
if (_PyFrame_GetCode(frame)->_co_instrumentation_version != tstate->interp->monitoring_version) {
140139
int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
141140
ERROR_IF(err, error);
141+
#if TIER_ONE
142142
next_instr--;
143+
#endif
144+
#if TIER_TWO
145+
goto deoptimize;
146+
#endif
143147
}
144-
else
145-
#endif
146-
if (oparg < 2) {
148+
else if (oparg < 2) {
147149
CHECK_EVAL_BREAKER();
148150
}
149151
}

Python/executor_cases.c.h

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

Python/generated_cases.c.h

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

0 commit comments

Comments
 (0)