-
-
Notifications
You must be signed in to change notification settings - Fork 905
refactor[codegen]: split codegen packages #4925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 8 commits
79e46a6
fdff543
e58877c
0457ae7
0498268
adb6101
87fa38b
80c919d
e898b67
6d15801
7ae40b3
546dfe6
af60879
2992644
a653b93
3d07b79
2e0a2f4
9c42320
6c9cc55
930a886
5769087
c7c7c61
363cd88
e565d87
4644877
e7e32d6
e1d3b49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| from vyper.codegen.jumptable_utils import generate_sparse_jumptable_buckets | ||
| from vyper.codegen_legacy.jumptable_utils import generate_sparse_jumptable_buckets | ||
| from vyper.compiler import compile_code | ||
| from vyper.compiler.settings import OptimizationLevel, Settings | ||
|
|
||
|
|
@@ -9,7 +9,9 @@ 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_runtime"], settings=Settings(optimize=OptimizationLevel.CODESIZE) | ||
| code, | ||
| output_formats=["asm_runtime"], | ||
| settings=Settings(optimize=OptimizationLevel.CODESIZE, legacy_codegen=True), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this test only work on the legacy codegen, and if so, why ? |
||
| ) | ||
|
|
||
| # test that the selector table data is stable across different runs | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,7 @@ def test_round_trip_examples(path: Path, debug, optimize, compiler_settings, req | |||||
| """ | ||||||
| Check all examples round trip | ||||||
| """ | ||||||
| if not compiler_settings.experimental_codegen: | ||||||
| if not compiler_settings.legacy_codegen: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
At least to correspond to the text |
||||||
| pytest.skip("tests n/a when venom is not enabled") | ||||||
|
|
||||||
| if debug and optimize == OptimizationLevel.CODESIZE: | ||||||
|
|
@@ -76,7 +76,7 @@ def test_round_trip_sources(vyper_source, debug, optimize, compiler_settings, re | |||||
| """ | ||||||
| Test vyper_sources round trip | ||||||
| """ | ||||||
| if not compiler_settings.experimental_codegen: | ||||||
| if not compiler_settings.legacy_codegen: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same as above |
||||||
| pytest.skip("tests n/a when venom is not enabled") | ||||||
|
|
||||||
| vyper_source = textwrap.dedent(vyper_source) | ||||||
|
|
@@ -105,7 +105,7 @@ def _helper1(vyper_source, optimize, input_bundle=None): | |||||
| """ | ||||||
| from vyper.compiler.settings import Settings | ||||||
|
|
||||||
| settings = Settings(experimental_codegen=True) | ||||||
| settings = Settings(legacy_codegen=False) | ||||||
| # note: compiling any later stage than ir_runtime like `asm` or | ||||||
| # `bytecode` modifies the ir_runtime data structure in place and results | ||||||
| # in normalization of the venom cfg (which breaks again make_ssa) | ||||||
|
|
@@ -138,7 +138,7 @@ def _helper2(vyper_source, optimize, compiler_settings, input_bundle=None): | |||||
| """ | ||||||
| settings = copy.copy(compiler_settings) | ||||||
| # bytecode equivalence only makes sense if we use venom pipeline | ||||||
| settings.experimental_codegen = True | ||||||
| settings.legacy_codegen = False | ||||||
|
|
||||||
| out = compile_code( | ||||||
| vyper_source, input_bundle=input_bundle, settings=settings, output_formats=["ir_runtime"] | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ def __init__(): | |
| # need to test this using asm anymore. | ||
| @pytest.mark.parametrize("code", codes) | ||
| def test_dead_code_eliminator(code): | ||
| c = CompilerData(code, settings=Settings(optimize=OptimizationLevel.NONE)) | ||
| c = CompilerData(code, settings=Settings(optimize=OptimizationLevel.NONE, legacy_codegen=True)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why only legacy ? |
||
|
|
||
| # get the labels | ||
| initcode_labels = [i for i in c.assembly if isinstance(i, Label)] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be removed/deprecated, no ?