Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c52246f
refactor symbol handling in assembly to have more structure
charles-cooper May 2, 2025
0932273
wip
harkal May 5, 2025
a07684c
wip
harkal May 5, 2025
e1db421
charles
harkal May 5, 2025
00db4df
fix for postambles
charles-cooper May 5, 2025
5e83ccc
more fixes
charles-cooper May 5, 2025
1f68273
sanity help
charles-cooper May 5, 2025
82b87b1
small fixes
charles-cooper May 5, 2025
b85f758
introduce a performance regression
charles-cooper May 5, 2025
75838b7
fix PUSHLABEL for runtime_begin
charles-cooper May 5, 2025
beeeca7
fix bad instruction
charles-cooper May 5, 2025
f65a94e
wip
harkal May 5, 2025
304d5ae
update optimizations
charles-cooper May 5, 2025
1f95319
fix venom_to_assembly
charles-cooper May 5, 2025
e50003d
fix off-by-ones
charles-cooper May 5, 2025
136362e
fix type error
charles-cooper May 5, 2025
338ca39
update test
charles-cooper May 5, 2025
6a661ab
venom_to_assembly fixes
charles-cooper May 5, 2025
69f5be1
comment
charles-cooper May 6, 2025
c152600
comment update
harkal May 6, 2025
4dea535
add PUSH_OFST
charles-cooper May 7, 2025
2624aa2
comment
charles-cooper May 7, 2025
952ef29
fix push_ofst
charles-cooper May 7, 2025
52e65c4
push_ofst in venom_to_assembly
charles-cooper May 7, 2025
6a8183e
remove jumpdest instruction
charles-cooper May 7, 2025
f2e5460
Merge branch 'master' into refactor/asm/labels
charles-cooper May 7, 2025
d6864fe
update comment
charles-cooper May 7, 2025
a0c48c0
wip - refactor IRnode to assembly into a class
charles-cooper May 8, 2025
d330346
more progress
charles-cooper May 9, 2025
d0dda4c
make it compile, add asm_runtime output
charles-cooper May 9, 2025
b877bb3
wip, remove RuntimeHeader and data_to_evm
charles-cooper May 11, 2025
a984ee0
wip, fix unreachable code eliminator
charles-cooper May 11, 2025
013a41e
refactor: make runtime_begin a DataHeader
charles-cooper May 11, 2025
bf226aa
update asm formatting
charles-cooper May 11, 2025
8e0ee08
formatting
charles-cooper May 11, 2025
4f4c29f
refactor cbor metadata suffix
charles-cooper May 11, 2025
211a869
fix refactor
charles-cooper May 11, 2025
a84888b
refactor: split assembly_to_evm from symbol_map construction
charles-cooper May 12, 2025
2a1befa
begin fixing lint
charles-cooper May 12, 2025
05cfb9d
wip lint
charles-cooper May 12, 2025
05251b4
update docstring
charles-cooper May 12, 2025
292276e
add source_map to CompilerData
charles-cooper May 12, 2025
cb8a36e
rename generate_evm to generate_evm_assembly
charles-cooper May 12, 2025
51a98ab
fix lint in venom_main
charles-cooper May 12, 2025
69b7c10
rename make_symbols to resolve_symbols
charles-cooper May 12, 2025
4487bf8
lint
charles-cooper May 12, 2025
a96b856
add dummy entry label
charles-cooper May 13, 2025
04d96b3
add todo
charles-cooper May 13, 2025
355b7b4
add compile_push_instruction helper
charles-cooper May 14, 2025
73a1e69
remove find_nested_opcode helper
charles-cooper May 14, 2025
1e4c89d
Merge branch 'master' into refactor/asm/recursion
charles-cooper May 23, 2025
dc2b366
start working on venom asm
charles-cooper May 23, 2025
e3a57ac
add a comment
charles-cooper May 23, 2025
a0d0651
wip: remove special "exit" instruction
charles-cooper May 24, 2025
fa443a4
add constants to venom context
charles-cooper May 24, 2025
275ccdd
Merge branch 'master' into refactor/asm/recursion
charles-cooper May 24, 2025
318bcef
fix symbol map resolution
charles-cooper May 24, 2025
3d834ec
update tests
charles-cooper May 24, 2025
27b5cf6
update some tests, remove sha3_32
charles-cooper May 24, 2025
6c1a65b
refactor: move getpos to compiler/output.py
charles-cooper May 25, 2025
653a3eb
update source map tests
charles-cooper May 25, 2025
b078d66
update asm optimizer tests
charles-cooper May 25, 2025
b9f9f42
fix test - craft assembly directly
charles-cooper May 25, 2025
8421c67
fix off by one
charles-cooper May 25, 2025
9994490
update more tests
charles-cooper May 25, 2025
f058140
update another test
charles-cooper May 25, 2025
395189a
update more tests
charles-cooper May 25, 2025
8712219
fix signature
charles-cooper May 25, 2025
694f63d
Merge branch 'master' into refactor/asm/recursion
charles-cooper May 26, 2025
752a273
wip: refactor ir_node_to_venom
charles-cooper Jun 7, 2025
4d65c4d
clean up constants, variables
charles-cooper Jun 7, 2025
6fbf747
fixes
charles-cooper Jun 7, 2025
8889b22
clean up return ofst stuff
charles-cooper Jun 7, 2025
19248ff
lint
charles-cooper Jun 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tests/functional/builtins/codegen/test_create_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import vyper.ir.compile_ir as compile_ir
from tests.utils import ZERO_ADDRESS
from vyper.codegen.ir_node import IRnode
from vyper.compiler import compile_code
from vyper.compiler.settings import OptimizationLevel
from vyper.ir.compile_ir import DATA_ITEM, PUSH, PUSHLABEL, DataHeader, Label
from vyper.utils import EIP_170_LIMIT, ERC5202_PREFIX, checksum_encode, keccak256


Expand Down Expand Up @@ -295,10 +294,19 @@ def test(code_ofst: uint256) -> address:
# deploy a blueprint contract whose contained initcode contains only
# zeroes (so no matter which offset, create_from_blueprint will
# return empty code)
ir = IRnode.from_list(["deploy", 0, ["seq"] + ["stop"] * initcode_len, 0])
bytecode, _ = compile_ir.assembly_to_evm(
compile_ir.compile_to_assembly(ir, optimize=OptimizationLevel.NONE)
)
asm = [
*PUSH(initcode_len),
PUSHLABEL(Label("end")),
*PUSH(0),
"CODECOPY",
*PUSH(initcode_len),
*PUSH(0),
"RETURN",
DataHeader(Label("end")),
DATA_ITEM(b"\x00" * initcode_len),
]
bytecode, _ = compile_ir.assembly_to_evm(asm)

# manually deploy the bytecode
c = env.deploy(abi=[], bytecode=bytecode)
blueprint_address = c.address
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/codegen/features/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def __init__(a: uint256):
assert c.val() == 123

# Make sure the init code does not access calldata
assembly = vyper.compile_code(code, output_formats=["asm"])["asm"].split(" ")
ir_return_idx_start = assembly.index("{")
ir_return_idx_end = assembly.index("}")
compiler_output = vyper.compile_code(code, output_formats=["asm", "asm_runtime"])
asm_deploytime = compiler_output["asm"]
asm_runtime = compiler_output["asm_runtime"]

assert "CALLDATALOAD" in assembly
assert "CALLDATACOPY" not in assembly[:ir_return_idx_start] + assembly[ir_return_idx_end:]
assert "CALLDATALOAD" not in assembly[:ir_return_idx_start] + assembly[ir_return_idx_end:]
assert "CALLDATALOAD" in asm_runtime
assert "CALLDATACOPY" not in asm_deploytime
assert "CALLDATALOAD" not in asm_deploytime


def test_init_calls_internal(get_contract, assert_compile_failed, tx_failed):
Expand Down
7 changes: 4 additions & 3 deletions tests/functional/codegen/test_selector_table_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ def test_dense_jumptable_stability():
code = "\n".join(f"@external\ndef {name}():\n pass" for name in function_names)

output = compile_code(
code, output_formats=["asm"], settings=Settings(optimize=OptimizationLevel.CODESIZE)
code, output_formats=["asm_runtime"], settings=Settings(optimize=OptimizationLevel.CODESIZE)
)

# test that the selector table data is stable across different runs
# (xdist should provide different PYTHONHASHSEEDs).
expected_asm = """{ DATA _sym_BUCKET_HEADERS b\'\\x0bB\' _sym_bucket_0 b\'\\n\' b\'+\\x8d\' _sym_bucket_1 b\'\\x0c\' b\'\\x00\\x85\' _sym_bucket_2 b\'\\x08\' } { DATA _sym_bucket_1 b\'\\xd8\\xee\\xa1\\xe8\' _sym_external 6 foo6()3639517672 b\'\\x05\' b\'\\xd2\\x9e\\xe0\\xf9\' _sym_external 0 foo0()3533627641 b\'\\x05\' b\'\\x05\\xf1\\xe0_\' _sym_external 2 foo2()99737695 b\'\\x05\' b\'\\x91\\t\\xb4{\' _sym_external 23 foo23()2433332347 b\'\\x05\' b\'np3\\x7f\' _sym_external 11 foo11()1852846975 b\'\\x05\' b\'&\\xf5\\x96\\xf9\' _sym_external 13 foo13()653629177 b\'\\x05\' b\'\\x04ga\\xeb\' _sym_external 14 foo14()73884139 b\'\\x05\' b\'\\x89\\x06\\xad\\xc6\' _sym_external 17 foo17()2298916294 b\'\\x05\' b\'\\xe4%\\xac\\xd1\' _sym_external 4 foo4()3827674321 b\'\\x05\' b\'yj\\x01\\xac\' _sym_external 7 foo7()2036990380 b\'\\x05\' b\'\\xf1\\xe6K\\xe5\' _sym_external 29 foo29()4058401765 b\'\\x05\' b\'\\xd2\\x89X\\xb8\' _sym_external 3 foo3()3532216504 b\'\\x05\' } { DATA _sym_bucket_2 b\'\\x06p\\xffj\' _sym_external 25 foo25()108068714 b\'\\x05\' b\'\\x964\\x99I\' _sym_external 24 foo24()2520029513 b\'\\x05\' b\'s\\x81\\xe7\\xc1\' _sym_external 10 foo10()1937893313 b\'\\x05\' b\'\\x85\\xad\\xc11\' _sym_external 28 foo28()2242756913 b\'\\x05\' b\'\\xfa"\\xb1\\xed\' _sym_external 5 foo5()4196577773 b\'\\x05\' b\'A\\xe7[\\x05\' _sym_external 22 foo22()1105681157 b\'\\x05\' b\'\\xd3\\x89U\\xe8\' _sym_external 1 foo1()3548993000 b\'\\x05\' b\'hL\\xf8\\xf3\' _sym_external 20 foo20()1749874931 b\'\\x05\' } { DATA _sym_bucket_0 b\'\\xee\\xd9\\x1d\\xe3\' _sym_external 9 foo9()4007206371 b\'\\x05\' b\'a\\xbc\\x1ch\' _sym_external 16 foo16()1639717992 b\'\\x05\' b\'\\xd3*\\xa7\\x0c\' _sym_external 21 foo21()3542787852 b\'\\x05\' b\'\\x18iG\\xd9\' _sym_external 19 foo19()409552857 b\'\\x05\' b\'\\n\\xf1\\xf9\\x7f\' _sym_external 18 foo18()183630207 b\'\\x05\' b\')\\xda\\xd7`\' _sym_external 27 foo27()702207840 b\'\\x05\' b\'2\\xf6\\xaa\\xda\' _sym_external 12 foo12()855026394 b\'\\x05\' b\'\\xbe\\xb5\\x05\\xf5\' _sym_external 15 foo15()3199534581 b\'\\x05\' b\'\\xfc\\xa7_\\xe6\' _sym_external 8 foo8()4238827494 b\'\\x05\' b\'\\x1b\\x12C8\' _sym_external 26 foo26()454181688 b\'\\x05\' } }""" # noqa: E501, FS003
assert expected_asm in output["asm"]
expected_asm = """DATA BUCKET_HEADERS:\n DATABYTES 0b42\n DATALABEL bucket_0\n DATABYTES 0a\n DATABYTES 2b8d\n DATALABEL bucket_1\n DATABYTES 0c\n DATABYTES 0085\n DATALABEL bucket_2\n DATABYTES 08\n\nDATA bucket_1:\n DATABYTES d8eea1e8\n DATALABEL external 6 foo6()3639517672\n DATABYTES 05\n DATABYTES d29ee0f9\n DATALABEL external 0 foo0()3533627641\n DATABYTES 05\n DATABYTES 05f1e05f\n DATALABEL external 2 foo2()99737695\n DATABYTES 05\n DATABYTES 9109b47b\n DATALABEL external 23 foo23()2433332347\n DATABYTES 05\n DATABYTES 6e70337f\n DATALABEL external 11 foo11()1852846975\n DATABYTES 05\n DATABYTES 26f596f9\n DATALABEL external 13 foo13()653629177\n DATABYTES 05\n DATABYTES 046761eb\n DATALABEL external 14 foo14()73884139\n DATABYTES 05\n DATABYTES 8906adc6\n DATALABEL external 17 foo17()2298916294\n DATABYTES 05\n DATABYTES e425acd1\n DATALABEL external 4 foo4()3827674321\n DATABYTES 05\n DATABYTES 796a01ac\n DATALABEL external 7 foo7()2036990380\n DATABYTES 05\n DATABYTES f1e64be5\n DATALABEL external 29 foo29()4058401765\n DATABYTES 05\n DATABYTES d28958b8\n DATALABEL external 3 foo3()3532216504\n DATABYTES 05\n\nDATA bucket_2:\n DATABYTES 0670ff6a\n DATALABEL external 25 foo25()108068714\n DATABYTES 05\n DATABYTES 96349949\n DATALABEL external 24 foo24()2520029513\n DATABYTES 05\n DATABYTES 7381e7c1\n DATALABEL external 10 foo10()1937893313\n DATABYTES 05\n DATABYTES 85adc131\n DATALABEL external 28 foo28()2242756913\n DATABYTES 05\n DATABYTES fa22b1ed\n DATALABEL external 5 foo5()4196577773\n DATABYTES 05\n DATABYTES 41e75b05\n DATALABEL external 22 foo22()1105681157\n DATABYTES 05\n DATABYTES d38955e8\n DATALABEL external 1 foo1()3548993000\n DATABYTES 05\n DATABYTES 684cf8f3\n DATALABEL external 20 foo20()1749874931\n DATABYTES 05\n\nDATA bucket_0:\n DATABYTES eed91de3\n DATALABEL external 9 foo9()4007206371\n DATABYTES 05\n DATABYTES 61bc1c68\n DATALABEL external 16 foo16()1639717992\n DATABYTES 05\n DATABYTES d32aa70c\n DATALABEL external 21 foo21()3542787852\n DATABYTES 05\n DATABYTES 186947d9\n DATALABEL external 19 foo19()409552857\n DATABYTES 05\n DATABYTES 0af1f97f\n DATALABEL external 18 foo18()183630207\n DATABYTES 05\n DATABYTES 29dad760\n DATALABEL external 27 foo27()702207840\n DATABYTES 05\n DATABYTES 32f6aada\n DATALABEL external 12 foo12()855026394\n DATABYTES 05\n DATABYTES beb505f5\n DATALABEL external 15 foo15()3199534581\n DATABYTES 05\n DATABYTES fca75fe6\n DATALABEL external 8 foo8()4238827494\n DATABYTES 05\n DATABYTES 1b124338\n DATALABEL external 26 foo26()454181688\n DATABYTES 05""" # noqa: E501

assert expected_asm in output["asm_runtime"]


def test_sparse_jumptable_stability():
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/venom/test_venom_label_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ def test_labels_as_variables():

run_passes_on(ctx, OptimizationLevel.default())
asm = generate_assembly_experimental(ctx)
generate_bytecode(asm, compiler_metadata=None)
generate_bytecode(asm)
4 changes: 2 additions & 2 deletions tests/functional/venom/test_venom_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _helper1(vyper_source, optimize):

# test we can generate assembly+bytecode
asm = generate_assembly_experimental(ctx)
generate_bytecode(asm, compiler_metadata=None)
generate_bytecode(asm)


def _helper2(vyper_source, optimize, compiler_settings):
Expand All @@ -126,7 +126,7 @@ def _helper2(vyper_source, optimize, compiler_settings):

# test we can generate assembly+bytecode
asm = generate_assembly_experimental(ctx, optimize=optimize)
bytecode = generate_bytecode(asm, compiler_metadata=None)
bytecode, _ = generate_bytecode(asm)

out = compile_code(vyper_source, settings=settings, output_formats=["bytecode_runtime"])
assert "0x" + bytecode.hex() == out["bytecode_runtime"]
4 changes: 2 additions & 2 deletions tests/hevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def _prep_hevm_venom_ctx(ctx, verbose=False):
LowerDloadPass(ac, fn).run_pass()
SingleUseExpansion(ac, fn).run_pass()

compiler = VenomCompiler([ctx])
asm = compiler.generate_evm(no_optimize=False)
compiler = VenomCompiler(ctx)
asm = compiler.generate_evm_assembly(no_optimize=False)
return assembly_to_evm(asm)[0].hex()


Expand Down
20 changes: 10 additions & 10 deletions tests/unit/compiler/asm/test_asm_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from vyper.compiler import compile_code
from vyper.compiler.phases import CompilerData
from vyper.compiler.settings import OptimizationLevel, Settings
from vyper.ir.compile_ir import _merge_jumpdests
from vyper.ir.compile_ir import PUSHLABEL, Label, _merge_jumpdests

codes = [
"""
Expand Down Expand Up @@ -82,18 +82,18 @@ def test_dead_code_eliminator(code):
c = CompilerData(code, settings=Settings(optimize=OptimizationLevel.NONE))

# get the labels
initcode_asm = [i for i in c.assembly if isinstance(i, str)]
runtime_asm = [i for i in c.assembly_runtime if isinstance(i, str)]
initcode_labels = [i for i in c.assembly if isinstance(i, Label)]
runtime_labels = [i for i in c.assembly_runtime if isinstance(i, Label)]

ctor_only = "ctor_only()"
runtime_only = "runtime_only()"

# qux reachable from unoptimized initcode, foo not reachable.
assert any(ctor_only in instr for instr in initcode_asm)
assert all(runtime_only not in instr for instr in initcode_asm)
assert any(ctor_only in label.label for label in initcode_labels)
assert all(runtime_only not in label.label for label in initcode_labels)

assert any(runtime_only in instr for instr in runtime_asm)
assert all(ctor_only not in instr for instr in runtime_asm)
assert any(runtime_only in label.label for label in runtime_labels)
assert all(ctor_only not in label.label for label in runtime_labels)


def test_library_code_eliminator(make_input_bundle, experimental_codegen):
Expand All @@ -118,8 +118,8 @@ def foo():
library.some_function()
"""
input_bundle = make_input_bundle({"library.vy": library})
res = compile_code(code, input_bundle=input_bundle, output_formats=["asm"])
asm = res["asm"]
res = compile_code(code, input_bundle=input_bundle, output_formats=["asm_runtime"])
asm = res["asm_runtime"]

if not experimental_codegen:
assert "some_function()" in asm # Venom function inliner will remove this
Expand All @@ -129,6 +129,6 @@ def foo():


def test_merge_jumpdests():
asm = ["_sym_label_0", "JUMP", "PUSH0", "_sym_label_0", "JUMPDEST", "_sym_label_0", "JUMPDEST"]
asm = [PUSHLABEL(Label("label_0")), "JUMP", "PUSH0", Label("label_0"), Label("_label_0")]

assert _merge_jumpdests(asm) is False, "should not return True as no changes were made"
2 changes: 1 addition & 1 deletion tests/unit/compiler/ir/test_repeat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def test_repeat(get_contract_from_ir, assert_compile_failed):
good_ir = ["repeat", 0, 0, 1, 1, ["seq"]]
good_ir = ["repeat", "i", 0, 1, 1, ["seq"]]
bad_ir_1 = ["repeat", 0, 0, 0, 0, ["seq"]]
bad_ir_2 = ["repeat", 0, 0, -1, -1, ["seq"]]
get_contract_from_ir(good_ir)
Expand Down
12 changes: 0 additions & 12 deletions tests/unit/compiler/test_sha3_32.py

This file was deleted.

26 changes: 17 additions & 9 deletions tests/unit/compiler/test_source_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def foo(a: uint256) -> int128:


def test_jump_map(optimize, experimental_codegen):
source_map = compile_code(TEST_CODE, output_formats=["source_map"])["source_map"]
compiler_output = compile_code(TEST_CODE, output_formats=["source_map_runtime"])
source_map = compiler_output["source_map_runtime"]
pos_map = source_map["pc_pos_map"]
jump_map = source_map["pc_jump_map"]

Expand Down Expand Up @@ -75,7 +76,8 @@ def test_jump_map(optimize, experimental_codegen):


def test_pos_map_offsets():
source_map = compile_code(TEST_CODE, output_formats=["source_map"])["source_map"]
compiler_output = compile_code(TEST_CODE, output_formats=["source_map_runtime"])
source_map = compiler_output["source_map_runtime"]
expanded = expand_source_map(source_map["pc_pos_map_compressed"])

pc_iter = iter(source_map["pc_pos_map"][i] for i in sorted(source_map["pc_pos_map"]))
Expand Down Expand Up @@ -105,7 +107,9 @@ def test_error_map(experimental_codegen):
def update_foo():
self.foo += 1
"""
error_map = compile_code(code, output_formats=["source_map"])["source_map"]["error_map"]
compiler_output = compile_code(code, output_formats=["source_map_runtime"])
error_map = compiler_output["source_map_runtime"]["error_map"]

assert "safeadd" in error_map.values()

if experimental_codegen:
Expand All @@ -121,7 +125,8 @@ def test_error_map_with_user_error():
def foo():
raise "some error"
"""
error_map = compile_code(code, output_formats=["source_map"])["source_map"]["error_map"]
compiler_output = compile_code(code, output_formats=["source_map_runtime"])
error_map = compiler_output["source_map_runtime"]["error_map"]
assert "user revert with reason" in error_map.values()


Expand All @@ -132,7 +137,8 @@ def foo(i: uint256):
a: DynArray[uint256, 10] = [1]
a[i % 10] = 2
"""
error_map = compile_code(code, output_formats=["source_map"])["source_map"]["error_map"]
compiler_output = compile_code(code, output_formats=["source_map_runtime"])
error_map = compiler_output["source_map_runtime"]["error_map"]
assert "safemod" in error_map.values()


Expand All @@ -147,7 +153,8 @@ def bar(i: uint256) -> String[85]:
# ensure the mod doesn't get erased
return concat("foo foo", uint2str(i))
"""
error_map = compile_code(code, output_formats=["source_map"])["source_map"]["error_map"]
compiler_output = compile_code(code, output_formats=["source_map_runtime"])
error_map = compiler_output["source_map_runtime"]["error_map"]
assert "user revert with reason" in error_map.values()
assert "safemod" in error_map.values()

Expand Down Expand Up @@ -196,10 +203,11 @@ def _construct_node_id_map(ast_struct):

def test_node_id_map():
code = TEST_CODE
out = compile_code(code, output_formats=["annotated_ast_dict", "source_map", "ir"])
assert out["source_map"]["pc_ast_map_item_keys"] == ("source_id", "node_id")
out = compile_code(code, output_formats=["annotated_ast_dict", "source_map_runtime", "ir"])
source_map = out["source_map_runtime"]
assert source_map["pc_ast_map_item_keys"] == ("source_id", "node_id")

pc_ast_map = out["source_map"]["pc_ast_map"]
pc_ast_map = source_map["pc_ast_map"]

ast_node_map = _construct_node_id_map(out["annotated_ast_dict"])

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/compiler/venom/test_venom_to_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_dead_params():
"""
ctx = parse_venom(code)

asm = VenomCompiler([ctx]).generate_evm()
asm = VenomCompiler(ctx).generate_evm_assembly()
assert asm == ["SWAP1", "POP", "JUMP"]


Expand All @@ -32,5 +32,5 @@ def test_optimistic_swap_params():
"""
ctx = parse_venom(code)

asm = VenomCompiler([ctx]).generate_evm()
asm = VenomCompiler(ctx).generate_evm_assembly()
assert asm == ["SWAP2", "PUSH1", 117, "POP", "MSTORE", "MSTORE", "JUMP"]
2 changes: 1 addition & 1 deletion vyper/cli/venom_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _parse_args(argv: list[str]):

run_passes_on(ctx, OptimizationLevel.default())
asm = generate_assembly_experimental(ctx)
bytecode = generate_bytecode(asm, compiler_metadata=None)
bytecode, _ = generate_bytecode(asm)
print(f"0x{bytecode.hex()}")


Expand Down
2 changes: 1 addition & 1 deletion vyper/codegen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def FAIL(): # pragma: no cover
_label = 0


# TODO might want to coalesce with Context.fresh_varname and compile_ir.mksymbol
# TODO might want to coalesce with Context.fresh_varname
def _freshname(name):
global _label
_label += 1
Expand Down
1 change: 1 addition & 0 deletions vyper/compiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# requires assembly
"abi": output.build_abi_output,
"asm": output.build_asm_output,
"asm_runtime": output.build_asm_runtime_output,
"source_map": output.build_source_map_output,
"source_map_runtime": output.build_source_map_runtime_output,
# requires bytecode
Expand Down
Loading
Loading