feat[venom]: only stack_reorder before join points#4247
Merged
charles-cooper merged 9 commits intovyperlang:masterfrom Sep 20, 2024
Merged
feat[venom]: only stack_reorder before join points#4247charles-cooper merged 9 commits intovyperlang:masterfrom
charles-cooper merged 9 commits intovyperlang:masterfrom
Conversation
fubuloubu
approved these changes
Sep 19, 2024
harkal
approved these changes
Sep 19, 2024
harkal
reviewed
Sep 20, 2024
charles-cooper
added a commit
to charles-cooper/vyper
that referenced
this pull request
Oct 5, 2024
fix a venom performance bug, where the stack would be reordered before all jump instructions. for "joining" jump instructions (where the target basic block can have multiple cfg inputs), the stack reorder is needed, since we need the invariant that the stack layout needs to be the same no matter which basic block we jump to the target basic block from. however, before jumping into a block with only a single `cfg_in` (which, after cfg normalization, is equivalent to "splitting" jump instructions `jnz` and `djmp`), the stack reorder is unneeded, since stack reordering happens anyways in the target basic block, and no invariant on the incoming stack layout is required. this commit changes the behavior so that stack reordering only occurs before these "joining" jump instructions. on branch-heavy code, this can improve codesize by as much as 25%, with corresponding gas improvement, especially in the presence of loops.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
reduces
branch_storm.vyfrom 1007 bytes to 754 bytes(!)a "million dollar pen" (https://en.wikipedia.org/wiki/Space_Pen).
How I did it
only do stack reorder before join points.
How to verify it
Commit message
Description for the changelog
Cute Animal Picture