Skip to content

Commit

Permalink
feat: merge sequential jumpdests
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Feb 15, 2021
1 parent ad8f65c commit a6b4fab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vyper/compile_lll.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,19 @@ def assembly_to_evm(assembly, start_pos=0):
else:
i += 1

# When a nested subroutine finishes and is the final action within it's
# parent subroutine, we end up with multiple simultaneous JUMPDEST
# instructions that can be merged to reduce the bytecode size.
i = 0
while i < len(assembly) - 3:
if is_symbol(assembly[i]) and assembly[i + 1] == "JUMPDEST":
if is_symbol(assembly[i + 2]) and assembly[i + 3] == "JUMPDEST":
to_replace = assembly[i + 2]
assembly = assembly[: i + 2] + assembly[i + 4 :]
assembly = [x if x != to_replace else assembly[i] for x in assembly]
continue
i += 1

line_number_map = {
"breakpoints": set(),
"pc_breakpoints": set(),
Expand Down

0 comments on commit a6b4fab

Please sign in to comment.