-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Top-of-stack caching in the interpreter #131498
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
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
performance
Performance or resource usage
type-feature
A feature request or enhancement
Comments
markshannon
added a commit
that referenced
this issue
Mar 31, 2025
* Rename 'defined' attribute to 'in_local' to more accurately reflect how it is used * Make death of variables explicit even for array variables. * Convert in_memory from boolean to stack offset * Don't apply liveness analyis to optimizer generated code * Add 'out' parameter to stack.pop
markshannon
added a commit
that referenced
this issue
Apr 2, 2025
* Parse down to statement level in the cases generator * Add handling for #if macros, treating them much like normal ifs.
markshannon
added a commit
that referenced
this issue
Apr 4, 2025
picnixz
pushed a commit
to picnixz/cpython
that referenced
this issue
Apr 5, 2025
markshannon
added a commit
that referenced
this issue
Apr 14, 2025
seehwan
pushed a commit
to seehwan/cpython
that referenced
this issue
Apr 16, 2025
* Adds some missing #includes
seehwan
pushed a commit
to seehwan/cpython
that referenced
this issue
Apr 16, 2025
…131827) * Rename 'defined' attribute to 'in_local' to more accurately reflect how it is used * Make death of variables explicit even for array variables. * Convert in_memory from boolean to stack offset * Don't apply liveness analyis to optimizer generated code * Add 'out' parameter to stack.pop
seehwan
pushed a commit
to seehwan/cpython
that referenced
this issue
Apr 16, 2025
…ythonGH-131948) * Parse down to statement level in the cases generator * Add handling for #if macros, treating them much like normal ifs.
seehwan
pushed a commit
to seehwan/cpython
that referenced
this issue
Apr 16, 2025
brandtbucher
added a commit
that referenced
this issue
Apr 18, 2025
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)
performance
Performance or resource usage
type-feature
A feature request or enhancement
Top-of-stack caching is technique where one or more values on the top of the stack are kept in local variables, with the assumption that the C compiler will put them in registers.
We should implement this for the interpreter (tier 1).
We cannot afford to increase the number of instructions by much, so we'll have to use a fixed size cache of 1.
This will likely only produce a modest speedup, as the total memory traffic is unlikely to decrease. There should be some ILP improvements.
The main benefit of TOS caching is likely to be in the JIT where we can use a variable sized cache.
We want to do it in the interpreter first though, as it will be simpler and requires a subset of the changes needed for the JIT.
Linked PRs
bytecodes.c
#132615The text was updated successfully, but these errors were encountered: