-
Notifications
You must be signed in to change notification settings - Fork 132
Dynamic Scratch Variables #195
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
Conversation
| from .config import MAX_GROUP_SIZE, NUM_SLOTS | ||
|
|
||
| __all__ = [ | ||
| "Expr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetize and add DynamicSlot
| from .for_ import For | ||
| from .break_ import Break | ||
| from .continue_ import Continue | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphabetize and add DynamicSlot
| ) | ||
|
|
||
|
|
||
| def wilt_the_stilt(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roaming scratch variable example
| from .compile_asserts import assert_new_v_old, compile_and_save | ||
|
|
||
|
|
||
| def dynamic_scratch(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I continued developing against this test I realized that there is flakiness here mostly due to reordering of subroutines. So I will probably rename the *_test() methods so that they don't get triggered on Cricle.
|
another abandoned PR. In favor of #198 |
Utilize
loadsandstoresto Allow Specifying a Slot's Index with anExprSummary of Changes
__init__*'sDynamicSlotand make mypy happyDynamicSlotclass a sibling toScratchSlotwith new abstract parentSlotpyteal/ast/scratchvar.py- ability forScratchVarto handle dynamic index by delegating toDynamicSlotwhen given aslotIdof typeExprpyteal/compiler/*andpyteal/ir/*- changes to makemypyhappy, with some type assertions to make sure that we haven't contaminated the compilation withDynamicSlot'stests/dynamic_scratch_tests.pytests/teal/*_expected.pyTODO
ScratchVarand*Slot'sMotivating Example
A "roaming" scratch variable:
with generated TEAL: