Skip to content

Commit d3f49be

Browse files
authored
Optimize constant assembly (#2215)
With this PR, constants introduced by pseudo-ops (int, byte, addr) are now placed into constant blocks or loaded with pushint/pushbytes in the optimal way to save program space, starting with TEAL v4. This optimization effectively reorders the intcblock and bytecblock that the assembler creates for pseudo-op constants such that the most frequently referenced constants are first (and can thereby take advantage of the space-saving intc_X/bytec_X opcodes). Additionally, any constants referenced only once are taken out of the constant block and instead loaded with pushint or pushbytes to further save space. Other changes: Renamed OpStream's noIntcBlock and noBytecBlock to hasIntcBlock and hasBytecBlock to clarify this flag is true only if the input code defines a constant block. pushbytes now disassembles with a comment containing a parsed representation of its contents, like bytec.
1 parent 4825902 commit d3f49be

File tree

5 files changed

+782
-74
lines changed

5 files changed

+782
-74
lines changed

0 commit comments

Comments
 (0)