-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-120024: Remove CHECK_EVAL_BREAKER
macro.
#122968
GH-120024: Remove CHECK_EVAL_BREAKER
macro.
#122968
Conversation
… for escape analysis
if (_Py_HandlePending(tstate) != 0) { | ||
GOTO_ERROR(error); \ | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be implemented as a macro that reuses _CHECK_PERIODIC
? Like "if condition is false, exit, then do _CHECK_PERIODIC"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the macro is the point of this PR. Macros are opaque to the code generator, so we need to special case them (which is OK for something very common like Py_DECREF
). Avoiding the special case simplifies the code generator considerably.
It is the call to _Py_HandlePending
that escapes, not the whole of _CHECK_PERIODIC
and we want the code generator to know that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant a macro instruction of the DSL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see.
No it can't, as macros can only be composed in a linear sequence. We need branching here, not deoptimization.
EXIT_IF
and DEOPT_IF
only make sense in specialized instructions.
* Factor some instructions into micro-ops to isolate CHECK_EVAL_BREAKER for escape analysis * Eliminate CHECK_EVAL_BREAKER macro
Removing the
CHECK_EVAL_BREAKER
by moving into its own pair of micro-ops allows us to remove a lot of special case code that impairs getting escaping calls.The
CHECK_EVAL_BREAKER
macro is a conditional expression containing an escaping call and error handling. By removing the macro, the code generator can see the parts and analyze them correctly.This PR is probably best reviewed commit by commit.