-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
GH-128914: Remove all but one conditional stack effects #129226
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-128914: Remove all but one conditional stack effects #129226
Conversation
Note: Prior to this change, monitored calls would see With this PR, monitored calls will see |
Performance for free-threading is about 1% slower, mostly attributable to the Richards benchmarks. Which suggests to me that the change to |
I needed to effectively revert the change to |
Performance is neutral on the default build. Free-threading shows a 1% slowdown which makes no sense given the stats and code changes. |
|
Conditional stack effects fall into three categories:
NULL
ifoparg & 1
_PyObject_GetMethod
ifoparg & 1
This PR:
_PUSH_NULL_CONDIITONAL
that pushesNULL
ifoparg & 1
and uses it in all instructions that pushed NULL conditionally, so that those ops no longer have conditional stack effects.LOAD_ATTR
to useself_of_null[oparg & 1] instead of
self_or_null if (oparg & 1)`. This has no meaningful change on the generated code, so no impact on the interpreter. It will force the JIT to spill any registers, but we expect all jitted code to be specialized anyway.BUILD_SLICE
to use an array of args. GiveCALL_FUNCTION_EX
has a fixed stack effect by and pushingNULL
in the compiler when**kwargs
is not defined.A future PR will remove support for conditional stack effects and the
split
annotation.