GH-118093: Remove invalidated executors from side exits #121885
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we invalidate executors, they get removed from the bytecode, but not from side exits. This is unfortunate, since:
_START_EXECUTOR
instructions fail right now).This changes the invalidation machinery to walk over all side exits on valid traces and wipe out affected executors when they are invalidated. It should be impossible to enter an invalid executor now.
As a related cleanup:
_Py_Executors_InvalidateDependency
currently does some gymnastics to do the right thing in the face of memory pressure. I've replaced this with a fallback path that just wipes out all executors, since this is correct, simpler, and arguably the right thing to do anyways in this rare case.No perf impact, minor improvements to stats (1% fewer tier one instructions, 1% more uops executed, and slight increases in traces created and optimizations attempted with no change in number of traces executed).