-
Notifications
You must be signed in to change notification settings - Fork 493
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
Make assembler work better with code that issues *cblock
opcodes.
#4034
Comments
I now understand the problem and have a limited solution. The (All of this is equally true of int constants and byte constants) |
This PR fixes algorand#4034, by forcing the use of "push*" when mixing manual constant blocks with the int/byte/addr/method pseudo-ops. (And a related disassembly bug). However, to avoid this "deoptimization" when manual blocks are used to add program metadata, deadcode constant blocks are ignored for this check.
This PR fixes #4034, by forcing the use of "push*" when mixing manual constant blocks with the int/byte/addr/method pseudo-ops. (And a related disassembly bug). However, to avoid this "deoptimization" when manual blocks are used to add program metadata, deadcode constant blocks are ignored for this check.
If a program has an explicit
intcblock
orbytecblock
, the pseudopsint
andbyte
respectively have strange behavior.The following program
is assembled as:
Which will fail at runtime because the constant reference is beyond the constant block.
We could assemble pseudo-ops to the
push
form is they use a constant that is not in the user suppled constant block.A slightly different problem. This program:
somehow gets assembled to:
it's hard for me to guess what's going on. But the the 5 is again not going to work, as no intcblock is long enough for an index of 2.
We should probably use
push*
exclusively for the pseudo ops when two constant blocks appear. Presumably this would only be done by a clever compiler to TEAL, and it would use the intc,bytec ops explicitly to take advantage of its clever constant block usage.A final problem, related to fixing the last problem. There are reasonable proposals to place a constant block at the end of programs as a place to put program metadata. It would be nice if doing so did not prevent the usual pseudo op assembly. That is, even though such programs have an explicit constant block, the normal assembly operation is fine.
The text was updated successfully, but these errors were encountered: