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 6b0cbaf commit 902b7b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vyper/compile_lll.py
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 :] # noqa: E203
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 902b7b2

Please sign in to comment.