-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Code generator: support variable stack effects in macros #106812
Comments
This is turning into a bit of a research project. I would like to refactor all the handling of stack effects in the generator. I'm thinking of having an algorithm that takes a sequence of operations such as But the right set of operations, transformations and conditions is still elusive. |
…fects (#107564) Introducing a new file, stacking.py, that takes over several responsibilities related to symbolic evaluation of push/pop operations, with more generality.
- Generalize the syntax for the type of a stack effect to allow a trailing `*`, so we can declare something as e.g. `PyCodeObject *`. - When generating assignments for stack effects, the type of the value on the stack should be the default (i.e., `PyObject *`) even when the variable copied to/from it has a different type, so that an appropriate cast is generated However, not when the variable is an array -- then the type is taken from the variable (as it is always `PyObject **`).
Currently you can't split e.g.
into two micro-ops
We need at least to handle micro-ops that have the same variable-length input effect as output effect, and a final (action) op that has a variable-length stack input effect and a fixed output effect. This should handle all the CALL specializations. (For UNPACK_SEQUENCE we also need to support a fixed input effect and a variable output effect, in he action op.)
Linked PRs
The text was updated successfully, but these errors were encountered: