Skip to content

GH-128914: Remove conditional stack effects from bytecodes.c and the code generators#128918

Merged
markshannon merged 21 commits intopython:mainfrom
faster-cpython:no-conditional-stack-effects
Jan 20, 2025
Merged

GH-128914: Remove conditional stack effects from bytecodes.c and the code generators#128918
markshannon merged 21 commits intopython:mainfrom
faster-cpython:no-conditional-stack-effects

Conversation

@markshannon
Copy link
Copy Markdown
Member

@markshannon markshannon commented Jan 16, 2025

This PR:

  • Removes support for conditional stack effects. Variable stack effects are still supported
  • Splits LOAD_ATTR into LOAD_ATTR and LOAD_METHOD. The specializations split neatly between the two, so no new specializations are needed.
  • Splits LOAD_SUPER_ATTR into LOAD_SUPER_ATTR and LOAD_SUPER_METHOD. This is a bit wasteful as LOAD_SUPER_ATTR is quite rare and it needs an additional instrumented instruction as well. It might be worth trying to merge them somehow in another PR later on but doing so now would complicate this PR unnecessarily.

Performance is 0.4% slower which is, I think, acceptable given the potential speedups from top of stack caching.

The slowdown appears to be mostly a result of the large number of extra PUSH_NULL instructions required. There are ways to mitigate this, but not in this PR.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants