Reserve stack space for passing values between uops #126612
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-feature
A feature request or enhancement
Feature or enhancement
Proposal:
We occasionally want to pass values between the uops that are composed to form a specialized instruction. The natural (only?) way to do this is to pass them on the stack. This is possible if the stack effect of the generic instruction is greater than or equal to the number of values being passed, but may not be possible otherwise, because the stack size is calculated by using the stack effect of only the generic instructions.
I'm running into this as I try to make
LOAD_ATTR_MODULE
thread-safe in free-threaded builds. I would like to pass the module dict's keys object from_CHECK_ATTR_MODULE
to_LOAD_ATTR_MODULE
. Unfortunately,LOAD_ATTR
has a stack effect of 0 or 1 and the module needs to remain on the stack, so we are not guaranteed to have sufficient stack space to pass the keys object.Here are a few possible solutions:
I think (3) is probably the best option; it's simple and should work for most cases.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: