• Michael Forney's avatar
    core/asm: assembly parser label fixes (#20210) · b0b27752
    Michael Forney authored
    * core/asm: Fix encoding of pushed labels
    
    EVM uses big-endian byte-order, so to pad a label value to 4 bytes,
    zeros must be added to the front, not the end.
    
    * core/asm: Fix PC calculations when a label is pushed
    
    Incrementing PC by 5 is only correct if the label appears after a jump,
    in which case there is an implicit push. When it appears after an explicit
    push, PC should only be incremented by 4.
    
    * core/asm: Allow JUMP with no argument
    
    This way, a label can be pushed explicitly, or loaded from memory to
    implement a jump table.
    b0b27752
compiler.go 6.68 KB