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

New opcode: cycle #2963

Closed
jasonpaulos opened this issue Sep 27, 2021 · 2 comments
Closed

New opcode: cycle #2963

jasonpaulos opened this issue Sep 27, 2021 · 2 comments

Comments

@jasonpaulos
Copy link
Contributor

Summary

Introduce a new opcode for stack manipulation:

  • cycle n m: rotates the top n elements of the stack m places (i.e., so top of the stack now contains the element that was m elements down, and the element that was at the top of the stack has n-m elements above it). Fails if there are fewer than n elements on the stack or if m > n. cycle n 0 and cycle n n are both no-ops unless there are fewer than n elements on the stack.

In general, this would make stack manipulate easier and more efficient, since it essentially is a general form cover and uncover that can move multiple elements at a time.

Specifically, this opcode would make it easier for PyTeal to spill multiple local slots to the stack, then "cover" them, before invoking a recursive subroutine call.

Urgency

Nice to have for AVM 1.1.

@algoanne
Copy link
Contributor

revisit this after the frame pointer work is complete (#4304 ) because this may become obsolete.

@algoanne
Copy link
Contributor

no longer useful given the frame pointer work.

@algoanne algoanne closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants