Skip to content

Commit

Permalink
Added some TODOS
Browse files Browse the repository at this point in the history
TODOS regarding the CFG<->deploy<->dynamic jump interactions
  • Loading branch information
harkal committed Dec 1, 2023
1 parent 37ed3bf commit f596312
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions vyper/venom/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def calculate_cfg(ctx: IRFunction) -> None:
bb.cfg_out = OrderedSet()
bb.out_vars = OrderedSet()

# TODO: This is a hack to support the old IR format
# where deploy is an instruction. Going directly to the new IR we should have just
# one entry for the contructor and one for the runtime core. These will be propertly
# linked in the CFG, and the deploy instruction will be removed completely.
deploy_bb = None
after_deploy_bb = None
for i, bb in enumerate(ctx.basic_blocks):
Expand All @@ -37,9 +41,13 @@ def calculate_cfg(ctx: IRFunction) -> None:
else:
entry_block = ctx.basic_blocks[0]

# Special case for the jump table of selector buckets
# and fallback. It will be generalized when the
# dispacher code is directly generated in Venom
# TODO: Special case for the jump table of selector buckets and fallback.
# It will be generalized when the dispacher code is directly generated in Venom.
# The when directly generating the dispatcher code from the AST we should be emitting
# a dynamic jmp instruction with all the posible targets (this in EOF this will be also
# a jump via jump table). This will remove the need for this special case, and will result
# in cleaner code for normalization just according to CFG, without the need to examine
# the block termination instructions.
for bb in ctx.basic_blocks:
if "selector_bucket_" in bb.label.value or bb.label.value == "fallback":
bb.add_cfg_in(entry_block)
Expand Down
2 changes: 1 addition & 1 deletion vyper/venom/venom_to_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
)


# REVIEW: "assembly" gets into the recursion due to how the original
# TODO: "assembly" gets into the recursion due to how the original
# IR was structured recursively in regards with the deploy instruction.
# There, recursing into the deploy instruction was by design, and
# made it easier to make the assembly generated "recursive" (i.e.
Expand Down

0 comments on commit f596312

Please sign in to comment.