Skip to content
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

[Compiler] Improve VM stack operations #3745

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Jan 29, 2025

Work towards #3742

Description

The VM has some helper functions for the operand stack, e.g. pop2 and pop3, which pop 2 and 3 values from the stack respectively. These functions currently return the values in reverse order, which is a bit confusing and error prone. For example, the implementation of the SetIndex instruction in vm.opSetIndex gets the values in reverse order.

Change the order of the return valuesto reflect the order on the stack.

Also, add tests and add a peekN helper, as well as tests.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@turbolent turbolent requested a review from jsproz January 29, 2025 22:27
@turbolent turbolent self-assigned this Jan 29, 2025
@turbolent turbolent requested a review from SupunS as a code owner January 29, 2025 22:27
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:feature/compiler commit 6ce5b49
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Collapsed results for better readability

@turbolent turbolent enabled auto-merge January 29, 2025 23:04
@turbolent turbolent merged commit fbdcfff into feature/compiler Jan 29, 2025
9 checks passed
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.

2 participants