Skip to content

fix[venom]: fix handling of params in venom_to_assembly#4587

Merged
charles-cooper merged 8 commits intovyperlang:masterfrom
charles-cooper:fix/venom/params
Apr 27, 2025
Merged

fix[venom]: fix handling of params in venom_to_assembly#4587
charles-cooper merged 8 commits intovyperlang:masterfrom
charles-cooper:fix/venom/params

Conversation

@charles-cooper
Copy link
Copy Markdown
Member

@charles-cooper charles-cooper commented Apr 20, 2025

What I did

How I did it

How to verify it

Commit message

previously, params were handled one at a time. however, steps 4 and 6
could `POP` or `SWAP` the params while traversing the param list, which
is invalid since the stack is in an invalid state. for example,

```llvm
function foo {
    %1 = param  ; dead variable
    ; --> POP inserted here! <--
    %2 = param
    %3 = param  ; %3 is scheduled before %2
    ; --> SWAP inserted here! <--
    %4 = param
    mstore %4, %3
    ret %2
}
```

this was previously not visible because of how `ir_node_to_venom`
generates params; they are very well-behaved (always live, and always
with the same scheduling).

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

previously, params were handled one at a time. however, steps 4 and 6
could POP or SWAP the params while traversing the param list, which is
invalid since the stack is in an invalid state. for example,

```
function foo {
    %1 = param  ; dead variable
    ; --> POP inserted here! <--
    %2 = param
    %3 = param  ; %3 is scheduled before %2
    ; --> SWAP inserted here! <--
    %4 = param
    mstore %4, %3
    ret %2
}
```

this was previously not visible because of how ir_node_to_venom
generates params; they are very well-behaved (and always live).
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 20, 2025

Codecov Report

❌ Patch coverage is 82.60870% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.43%. Comparing base (f8bd65f) to head (158c2bb).
⚠️ Report is 67 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/venom_to_assembly.py 82.60% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4587      +/-   ##
==========================================
- Coverage   92.44%   92.43%   -0.01%     
==========================================
  Files         127      127              
  Lines       18304    18327      +23     
  Branches     3173     3179       +6     
==========================================
+ Hits        16921    16941      +20     
- Misses        946      947       +1     
- Partials      437      439       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@charles-cooper charles-cooper requested a review from harkal April 21, 2025 07:51
@charles-cooper charles-cooper changed the title fix[venom]: fix handling of params in venom_to_assembly fix[venom]: fix handling of params in venom_to_assembly Apr 27, 2025
@charles-cooper charles-cooper enabled auto-merge (squash) April 27, 2025 10:25
@charles-cooper charles-cooper merged commit bd832df into vyperlang:master Apr 27, 2025
159 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants