etk icon indicating copy to clipboard operation
etk copied to clipboard

Syntax for specifying exact bytecode offset

Open SamWilsn opened this issue 3 years ago • 0 comments

The output from disease is not immediately importable into eas, which is pretty annoying. I also have a weird function selector jump table implementation that requires precisely positioning instructions. I propose the following syntax to exactly specify an instruction's offset:

        invalid

<a>     jumpdest
        pc

# Leading zeros are ignored.
<0d>    gas

# Leading and trailing whitespace inside the brackets is ignored.
< f >   caller

Gaps between instructions are filled with zeros, and instructions must still be written in increasing order. Labels refer to the next written instruction, and not the fill bytes. A label after a gap refers to the location after the last fill byte. A label before a gap without a subsequent instruction is an error.

The example above would assemble to:

fe0000000000000000005b58005a000033

SamWilsn avatar Aug 03 '22 16:08 SamWilsn