Skip to content

gh-106581: Support multiple uops pushing new values#108895

Merged
gvanrossum merged 3 commits intopython:mainfrom
gvanrossum:load-fast-push-null
Sep 5, 2023
Merged

gh-106581: Support multiple uops pushing new values#108895
gvanrossum merged 3 commits intopython:mainfrom
gvanrossum:load-fast-push-null

Conversation

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Sep 4, 2023

Brandt reported to me that he tried to create a macro instruction like this:

macro(LOAD_FAST_PUSH_NULL) = LOAD_FAST + PUSH_NULL;

and got an error from the cases generator. I've confirmed that this currently gives:

AssertionError: Push or pop above current stack level: stack_pointer[0]
...
AssertionError: Error writing macro LOAD_FAST_PUSH_NULL

This PR fixes that, by moving the "poke" code generation for all uops to the end, after the stack adjustment is done. I've added a test that confirms this works (the test elicits the same errors as above without the fixes).

None of the existing generated files are changed by this PR, since none of the current macro ops do this.

The fix looks a bit convoluted, in part due to the refactoring, in part because I added some extra assertions to ensure that _PUSH_FRAME, _POP_FRAME and SAVE_CURRENT_IP are only used in ways that don't violate the assumptions by the fix.

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.

4 participants