Skip to content

Conversation

brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Aug 25, 2023

RESUME is currently written in a way that ignores changes in tracing events when running in our tier two executor. This can manifest itself as assertion errors on debug builds and missing/extra events on release builds when changing events just before an inlined call:

python: Python/instrumentation.c:1117: _Py_call_instrumentation_line: Assertion `is_version_up_to_date(code, tstate->interp)' failed.

This PR modifies RESUME to detect this condition and deoptimize back to tier one in these cases.

@brandtbucher brandtbucher added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Aug 25, 2023
@brandtbucher brandtbucher self-assigned this Aug 25, 2023
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd indent the #if etc. to align with the code it guards (we're using a different style here than elsewhere).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants