Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 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
2c0755b
remove dead comment
charles-cooper May 7, 2025
e5be3c5
lint
charles-cooper May 7, 2025
42a4436
update asm tests
charles-cooper May 7, 2025
b281dff
Merge branch 'master' into refactor/asm/labels
charles-cooper Jun 26, 2025
82f2d2b
rename mksymbol to mklabel
charles-cooper Aug 11, 2025
2cddcc6
is_symbol -> is_label
charles-cooper Aug 11, 2025
181b5e4
Revert "is_symbol -> is_label"
charles-cooper Aug 11, 2025
96d1371
fix: import rename
charles-cooper Aug 11, 2025
84808b0
Reapply "is_symbol -> is_label"
charles-cooper Aug 11, 2025
6d48a38
Merge branch 'master' into refactor/asm/labels
charles-cooper Aug 11, 2025
1d39539
update a comment, fix branch
charles-cooper Aug 11, 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
2 changes: 1 addition & 1 deletion tests/functional/codegen/test_selector_table_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_dense_jumptable_stability():

# 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
expected_asm = """{ DATA BUCKET_HEADERS b\'\\x0bB\' LABEL bucket_0 b\'\\n\' b\'+\\x8d\' LABEL bucket_1 b\'\\x0c\' b\'\\x00\\x85\' LABEL bucket_2 b\'\\x08\' } { DATA bucket_1 b\'\\xd8\\xee\\xa1\\xe8\' LABEL external 6 foo6()3639517672 b\'\\x05\' b\'\\xd2\\x9e\\xe0\\xf9\' LABEL external 0 foo0()3533627641 b\'\\x05\' b\'\\x05\\xf1\\xe0_\' LABEL external 2 foo2()99737695 b\'\\x05\' b\'\\x91\\t\\xb4{\' LABEL external 23 foo23()2433332347 b\'\\x05\' b\'np3\\x7f\' LABEL external 11 foo11()1852846975 b\'\\x05\' b\'&\\xf5\\x96\\xf9\' LABEL external 13 foo13()653629177 b\'\\x05\' b\'\\x04ga\\xeb\' LABEL external 14 foo14()73884139 b\'\\x05\' b\'\\x89\\x06\\xad\\xc6\' LABEL external 17 foo17()2298916294 b\'\\x05\' b\'\\xe4%\\xac\\xd1\' LABEL external 4 foo4()3827674321 b\'\\x05\' b\'yj\\x01\\xac\' LABEL external 7 foo7()2036990380 b\'\\x05\' b\'\\xf1\\xe6K\\xe5\' LABEL external 29 foo29()4058401765 b\'\\x05\' b\'\\xd2\\x89X\\xb8\' LABEL external 3 foo3()3532216504 b\'\\x05\' } { DATA bucket_2 b\'\\x06p\\xffj\' LABEL external 25 foo25()108068714 b\'\\x05\' b\'\\x964\\x99I\' LABEL external 24 foo24()2520029513 b\'\\x05\' b\'s\\x81\\xe7\\xc1\' LABEL external 10 foo10()1937893313 b\'\\x05\' b\'\\x85\\xad\\xc11\' LABEL external 28 foo28()2242756913 b\'\\x05\' b\'\\xfa"\\xb1\\xed\' LABEL external 5 foo5()4196577773 b\'\\x05\' b\'A\\xe7[\\x05\' LABEL external 22 foo22()1105681157 b\'\\x05\' b\'\\xd3\\x89U\\xe8\' LABEL external 1 foo1()3548993000 b\'\\x05\' b\'hL\\xf8\\xf3\' LABEL external 20 foo20()1749874931 b\'\\x05\' } { DATA bucket_0 b\'\\xee\\xd9\\x1d\\xe3\' LABEL external 9 foo9()4007206371 b\'\\x05\' b\'a\\xbc\\x1ch\' LABEL external 16 foo16()1639717992 b\'\\x05\' b\'\\xd3*\\xa7\\x0c\' LABEL external 21 foo21()3542787852 b\'\\x05\' b\'\\x18iG\\xd9\' LABEL external 19 foo19()409552857 b\'\\x05\' b\'\\n\\xf1\\xf9\\x7f\' LABEL external 18 foo18()183630207 b\'\\x05\' b\')\\xda\\xd7`\' LABEL external 27 foo27()702207840 b\'\\x05\' b\'2\\xf6\\xaa\\xda\' LABEL external 12 foo12()855026394 b\'\\x05\' b\'\\xbe\\xb5\\x05\\xf5\' LABEL external 15 foo15()3199534581 b\'\\x05\' b\'\\xfc\\xa7_\\xe6\' LABEL external 8 foo8()4238827494 b\'\\x05\' b\'\\x1b\\x12C8\' LABEL external 26 foo26()454181688 b\'\\x05\' } }""" # noqa: E501, FS003
assert expected_asm in output["asm"]


Expand Down
14 changes: 7 additions & 7 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 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_asm = [s for s in c.assembly if isinstance(s, Label)]
runtime_asm = [s for s in c.assembly_runtime if isinstance(s, 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 item.label for item in initcode_asm)
assert all(runtime_only not in item.label for item in initcode_asm)

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 item.label for item in runtime_asm)
assert all(ctor_only not in item.label for item in runtime_asm)


def test_library_code_eliminator(make_input_bundle, experimental_codegen):
Expand Down
Loading
Loading