Commit Graph

549 Commits

Author SHA1 Message Date
Alex Beregszaszi
1dedba8538 Only use SourceReferenceFormatterHuman 2020-12-01 16:09:46 +01:00
Alex Beregszaszi
04cf4867fe [ewasm] Clean up opcodes/builtins in the binary encoder
Also make sure that `i32.drop/i64.drop` won't silently drop its arguments, as they may have side-effects.
2020-12-01 12:50:54 +00:00
Alex Beregszaszi
a22077f736 Rename AsmData -> AST
Also attempt to only include ASTForward where appropriate.
2020-11-25 17:58:02 +00:00
chriseth
0a31a6bc36
Merge pull request #10258 from ethereum/develop
Merge develop into breaking.
2020-11-11 13:36:17 +01:00
Alex Beregszaszi
6f6bcdd526 [ewasm] Display custom sections as hex string in the text output 2020-11-10 23:48:24 +01:00
Alex Beregszaszi
e5396e42c3 Add wasm support to libyul/ObjectCompilerTest 2020-11-10 23:24:49 +01:00
chriseth
04195439b7 Merge remote-tracking branch 'origin/develop' into HEAD 2020-11-09 14:28:05 +01:00
Alex Beregszaszi
1536e49b3d Add more syntax tests for uncovered cases 2020-11-05 10:30:09 +00:00
Christian Parpart
1a9a3b115c Moving the surplus_input inline assembly test to yulSyntaxTests. 2020-11-04 12:03:33 +01:00
Christian Parpart
f55844e0f2 InlineAssembly: Extracting remaining tests. 2020-11-04 12:03:33 +01:00
Christian Parpart
3597c8343d InlineAssembly: Extracting tests for name clashes. 2020-11-04 12:03:33 +01:00
Christian Parpart
55f9eab51f InlineAssembly: Extracting tests for function definition and calls. 2020-11-04 12:03:33 +01:00
Christian Parpart
f2117b87f7 InlineAssembly: Extracting tests for for-statements. 2020-11-04 12:03:33 +01:00
Christian Parpart
671b1c950e InlineAssembly: Extracting function expression tests 2020-11-04 12:03:33 +01:00
Christian Parpart
616f03f577 InlineAssembly: Extracting tests for variable declaration 2020-11-04 12:03:33 +01:00
Christian Parpart
cc230ddda3 InlineAssembly: Extracting tests for switch statement 2020-11-04 12:03:33 +01:00
Christian Parpart
6f872dbebf InlineAssembly: Extracting tests for if statement 2020-11-04 12:03:33 +01:00
chriseth
e93a84ccd4 Merge remote-tracking branch 'origin/develop' into HEAD 2020-10-28 18:19:31 +01:00
Alex Beregszaszi
62028c90f0 [ewasm] Overhaul memory handling in EwasmInterpreter
Introduce writeMemory and read/writeBytes32/Address helpers.
Fix read/writeU128/U256 to be little-endian.
Update each instruction to follow the specification.
2020-10-28 11:57:18 +00:00
Daniel Kirchner
0dca223b45 Add another argument to setimmutable and the AssignImmutable opcode, allowing to modify code at any memory offset. 2020-10-15 18:14:41 +02:00
Christian Parpart
626b7cdb09 Extract yul syntax tests: invalid use of builtin identifiers 2020-10-14 12:18:33 +02:00
Christian Parpart
5d40494ed2 Extract yul syntax tests: function 2020-10-14 12:05:46 +02:00
Christian Parpart
5b799b01ab Extract yul syntax tests: multiple assignment expression 2020-10-14 11:50:25 +02:00
Christian Parpart
99d18336a0 Extract yul syntax tests: recursion depth 2020-10-14 11:45:54 +02:00
Christian Parpart
b1b2d3ef62 Extract yul syntax tests: switch statement 2020-10-14 11:39:10 +02:00
Christian Parpart
c63265ff03 Extract yul syntax tests: for statement 2020-10-14 11:23:10 +02:00
Christian Parpart
2accbbe251 Extract yul syntax tests: if statement 2020-10-14 10:54:18 +02:00
Harikrishnan Mulackal
2b9f040c48 Optimize exp when base is -1 2020-09-29 17:44:09 +02:00
Daniel Kirchner
7fa9a9d312
Merge pull request #9162 from ethereum/memoryEscalator
Memory Escalator
2020-09-21 20:03:38 +02:00
chriseth
306fef334b
Merge pull request #9546 from ethereum/expToShift
Optimization rule: Replace exp by shl.
2020-09-21 12:21:47 +02:00
Daniel Kirchner
48f620fb50 Reverse the order of the memory offsets assigned to variables. 2020-09-17 22:13:27 +02:00
Daniel Kirchner
f4b42d1c72 Add stack limit evader. 2020-09-17 22:13:27 +02:00
chriseth
684fff34a9 Replace exp by shl. 2020-09-17 16:06:52 +02:00
chriseth
6e4205e445 Do not run reasoning test if no SMT Solver is available. 2020-09-17 13:43:35 +02:00
chriseth
2d7e28769a Skip smt optimizer tests if smt is disabled. 2020-09-15 15:57:59 +02:00
chriseth
f73fb726af Reasoning based optimizer. 2020-09-15 15:57:58 +02:00
chriseth
768e0e96e4 Extract yul syntax tests. 2020-09-15 12:13:30 +02:00
chriseth
552a5f0913
Merge pull request #9314 from ethereum/inlineStartingFromLeaves
Handle "leaf functions" first in full inliner.
2020-09-14 20:22:48 +02:00
Harikrishnan Mulackal
b7944477a1 Update UnusedFunctionParameterPruner tests to avoid getting inlined 2020-09-14 17:59:50 +02:00
chriseth
8e39110a30 Remove flag. 2020-09-14 17:35:04 +02:00
chriseth
42c26e0bf5 Inline tiny functions first. 2020-09-10 17:01:20 +02:00
chriseth
f102feaf09 Handle "leaf functions" first in full inliner. 2020-09-10 17:01:19 +02:00
chriseth
6101bdf7e2 Name simplifier. 2020-09-10 16:23:29 +02:00
Harikrishnan Mulackal
974e35d09c Tests and changelog 2020-09-03 13:15:38 +02:00
Harikrishnan Mulackal
e2fd41f097 Implemented UnusedFunctionArgumentPruner 2020-09-03 13:15:38 +02:00
Alex Beregszaszi
7ef9591e64 Expose hex literal to the Yul parser
This allows nicer error messages.
2020-08-28 19:34:52 +01:00
Alex Beregszaszi
26a76c18d4 Add Yul syntax test for every Solidity keyword 2020-08-28 19:34:52 +01:00
Alex Beregszaszi
caa329066e Do not emit Solidity-only tokens in the Scanner for Yul
And simplfiy AsmParser greatly.
2020-08-28 19:34:52 +01:00
Alex Beregszaszi
4e5b403c37 Introduce RightArrow (->) token in the scanner 2020-08-27 12:28:27 +01:00
chriseth
e72afcba47 Fix inlining order to correspond to source order. 2020-08-26 10:20:18 +02:00
Harikrishnan Mulackal
bbf15c9af3 Tests and Changelog 2020-08-19 12:41:29 +02:00
Harikrishnan Mulackal
3cbe65e4f3 Refactor SideEffects struct 2020-08-18 14:53:59 +02:00
Harikrishnan Mulackal
58bfe0b0d2 Tests for refactor-SideEffects 2020-08-14 17:44:19 +02:00
Alex Beregszaszi
babb175d86 Add more syntax tests for Yul 2020-08-13 14:20:52 +01:00
Daniel Kirchner
5d670aaa18
Merge pull request #9614 from ethereum/yul-hex
Update tests/documentation to show that hex literals are not supported in Yul
2020-08-13 03:11:45 +02:00
Alex Beregszaszi
b752551ebd Add test case for string literals in switch statements in Yul 2020-08-13 00:27:41 +01:00
Alex Beregszaszi
acb1e8c280 Add tests showing hex literals are not allowed in Yul 2020-08-13 00:27:19 +01:00
Alex Beregszaszi
bb29307b02 Add/Update tests for Yul function definition 2020-08-12 23:53:08 +01:00
chriseth
0226d104b7 Fix literal arguments in interpreter. 2020-08-06 14:16:59 +02:00
chriseth
ebd512cef6
Merge pull request #9576 from ethereum/test-cleanup
Rename libsolidity/SolidityScanner to liblangutil/Scanner in tests
2020-08-06 00:49:33 +02:00
chriseth
488fd5a27a
Merge pull request #9575 from ethereum/yul-optim-check
Parse optimiser output in yulOptimiserTests
2020-08-06 00:40:45 +02:00
Alex Beregszaszi
2e8616e2e4 Run prequisite steps for VarNameCleaner in tests 2020-08-05 22:12:51 +01:00
Alex Beregszaszi
0a8bc861b2 Remove old boost tests from libyul/ObjectParser 2020-08-05 21:01:46 +01:00
Alex Beregszaszi
291c359ee9 Add more syntax tests for Yul objects
Also move some of them from boost tests.
2020-08-05 21:01:46 +01:00
Alex Beregszaszi
e7c99918ed Use yul::test::parse in libyul/SynaxtTests to support objects 2020-08-05 18:10:21 +01:00
Alex Beregszaszi
42a777e9e2 Use forward declaration in EwasmTranslationTest 2020-08-05 13:31:51 +01:00
Alex Beregszaszi
e77ae3f06e Parse optimiser output in yulOptimiserTests 2020-08-05 12:57:14 +01:00
Alex Beregszaszi
a21c8e18f1
Merge pull request #9572 from ethereum/yul-optimiser-tests
Return object format in expectation for yulOptimizerTests
2020-08-05 12:57:01 +01:00
Alex Beregszaszi
ad6f39376f Return object format in expectation for yulOptimizerTests 2020-08-05 11:55:13 +01:00
Alex Beregszaszi
6e381326fe Adjust and add more tests 2020-08-05 11:37:04 +01:00
chriseth
a3a9630d8b Optimize byte-after-shr for shift amounts that are not multiples of 8. 2020-08-04 12:16:23 +02:00
Bhargava Shastry
5100effeec yul: Set non movable flag to true in simplification rule for byte of right-shifted expression 2020-08-03 17:30:52 +02:00
chriseth
fc34c81f4c Test for long object names in optimizer. 2020-07-23 14:03:51 +02:00
chriseth
6bb6783d39 Merge remote-tracking branch 'origin/develop' into breaking 2020-07-22 15:26:44 +02:00
chriseth
cb1f7a8410
Merge pull request #9235 from ethereum/yulSubObjectAccessWithDot
Yul sub object access with dot
2020-07-22 09:50:41 +02:00
Djordje Mijovic
6f97e6153c [yul] Adding support for accessing subobjects via .
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2020-07-21 17:56:11 +02:00
Bhargava Shastry
18fbbfa5ca Fuzzer: Count step by number of interpreted statements
Co-authored-by: chriseth <chris@ethereum.org>
2020-07-21 15:38:02 +02:00
chriseth
9be5ed1220 Merge remote-tracking branch 'origin/develop' into breaking 2020-07-21 11:35:28 +02:00
chriseth
2c7359de1e
Merge pull request #9394 from ethereum/fix-9391
Yul interpreter: Return addresses of type u160 for create and create2…
2020-07-20 18:38:43 +02:00
chriseth
1c9179683e
Merge pull request #9433 from ethereum/reportAllStackErrors
Report all stack errors
2020-07-20 15:44:51 +02:00
Bhargava Shastry
deffb7ffc8 Yul interpreter: Return addresses of type u160 for create and create2 calls 2020-07-20 11:26:47 +02:00
Sachin Grover
b7adb2aa42 Add SPDX license identifier if not present already in source file
Fixes: #9220
2020-07-17 20:24:12 +05:30
Daniel Kirchner
579e4b5a69 Report all stack errors in the EVM code transform. 2020-07-16 17:38:04 +02:00
chriseth
f945163909
Merge pull request #9432 from ethereum/develop
Merge develop into breaking.
2020-07-16 17:14:45 +02:00
chriseth
289fc7a9d0
Merge pull request #9371 from ethereum/refactorInterpreter
Refactor yul interpreter.
2020-07-13 18:27:47 +02:00
Daniel Kirchner
def0ebbb3e Free variables directly after visiting RHS of Variable Declarations during EVMCodeTransform. 2020-07-13 17:36:15 +02:00
chriseth
8eee3ed3a2
Merge pull request #9388 from ethereum/develop
Merge develop into breaking.
2020-07-13 14:55:21 +02:00
Alex Beregszaszi
20dd66f398 Fix missing quote in error message for invalid Yul types 2020-07-10 21:06:09 +01:00
chriseth
9ef050af9a
Merge pull request #9373 from ethereum/develop
Merge develop into breaking.
2020-07-09 16:15:43 +02:00
chriseth
ec2393d3b6 Refactor interpreter. 2020-07-09 15:00:13 +02:00
chriseth
83337c850e Do not run tests that do not need options multiple times. 2020-07-08 18:47:14 +02:00
chriseth
64b6524bdb Merge remote-tracking branch 'origin/develop' into breaking 2020-07-08 09:37:14 +02:00
Alex Beregszaszi
0bd6fb027b Update tests 2020-07-07 13:13:58 +01:00
chriseth
ec8be81258
Merge pull request #9243 from ethereum/jumpTypesForYul
Jump types for yul functions.
2020-07-07 12:21:14 +02:00
Daniel Kirchner
70615a73a4 Disallow the same yul variable occurring multiple times on the LHS of an assignment. 2020-07-07 10:52:47 +02:00
chriseth
4d2b9cd38f Jump types for yul functions. 2020-07-06 18:12:54 +02:00
chriseth
ab68406006 Merge remote-tracking branch 'origin/develop' into breaking 2020-07-06 15:25:25 +02:00
Daniel Kirchner
b9b24daa8a
Merge pull request #9295 from ethereum/requireFLIR
Require for loop init rewriter for SSA.
2020-07-04 17:51:57 +02:00
chriseth
711ed588d7 Require for loop init rewriter for SSA.
Co-authored-by: Harikrishnan Mulackal <webmail.hari@gmail.com>
2020-07-03 19:24:31 +02:00
Alex Beregszaszi
8b53f85e28 Add Yul syntax tests for dots in identifiers 2020-07-03 15:41:09 +01:00
chriseth
e0b1d8b9bd Make DataFlowAnalyzer aware of storage / memory slot after sload / mload. 2020-07-01 13:45:25 +02:00
chriseth
3e3f9a472f Merge remote-tracking branch 'origin/develop' into breaking 2020-06-30 18:56:51 +02:00
Bhargava Shastry
d0ea1f97fd Yul interpreter: Return selfbalance constant for the expression
balance(address()) and balance constant otherwise.
2020-06-30 16:59:13 +02:00
Kamil Śliwak
a331d4449d Add linkersymbol() builtin to Yul EVM dialect 2020-06-24 15:06:52 +02:00
Kamil Śliwak
1b09b4f950 Allow Yul literals longer than 32-bytes when used as literal arguments for builtins 2020-06-24 15:05:38 +02:00
chriseth
d67734df6f Fix error IDs. 2020-06-22 18:56:32 +02:00
chriseth
1441b97131 Merge remote-tracking branch 'origin/develop' into breaking 2020-06-22 18:40:20 +02:00
a3d4
1d2ae7d82a Added error codes to SyntaxTest expectations (changed code) 2020-06-22 16:53:03 +02:00
a3d4
e04cedafc5 Added error codes to SyntaxTest expectations (updated tests) 2020-06-22 16:51:47 +02:00
chriseth
6b3171c38b Merge remote-tracking branch 'origin/develop' into breaking 2020-06-10 11:30:50 +02:00
Harikrishnan Mulackal
d8263d331e Ignore warnings for yulOptimizer tests 2020-06-09 13:03:57 +02:00
chriseth
1f49edd29d
Merge pull request #9039 from ethereum/yul-remove-pc-instr
[Yul] remove PC instruction
2020-06-03 14:10:35 +02:00
Christian Parpart
9820df58ab Remove Yul instruction PC and adapt tests accordingly. 2020-06-03 12:49:23 +02:00
ssi91
79407c87fb remove extra definition of printIndented
add CommonBaseTestCase class and inherit some of TestCase classes from it. Since that, remove print source extra definitions

create the base defifnition for printUpdatedExpectations and remove extra definitions of the method

make CommonBaseTestCase c-tor explicit

include AnsiColorized.h and sort includes

implement a common result checker

move the common implementations into TastCase
2020-06-02 21:15:00 +07:00
chriseth
a06ac0f39f
Merge pull request #8958 from ethereum/evm-version-dependent-rules
[yul] Add support for EVM version-dependent rules.
2020-05-27 12:52:51 +02:00
Christian Parpart
b7fa5d5040 Mark EVM instruction pc() as deprecated when used in inline assembly. 2020-05-27 12:07:23 +02:00
Alexander Arlt
a7b89065ca [yul] Add support for EVM version-dependent rules. 2020-05-27 11:57:08 +02:00
Kamil Śliwak
d199fc537b Add configurable weights to CodeSize metric 2020-05-20 16:47:23 +02:00
chriseth
6308ca4a22 Binary transform for br and br_if. 2020-05-14 11:30:19 +02:00
Kamil Śliwak
c41a832f65 Move the default optimisation steps from OptimiserSuite to OptimiserSettings
- Now it's a mandatory parameter in OptimiserSuite::run()
2020-04-24 17:30:56 +02:00
chriseth
d136e7dc95 Rules for optimizing idempotency for bitwise operations. 2020-04-23 14:21:00 +02:00
chriseth
35eae96a7f Move helper up and avoid trailing spaces. 2020-04-23 13:16:26 +02:00
chriseth
a7a1feb1b8
Merge pull request #8626 from ethereum/immutable-functioncallgraph
Prepare literalArguments for immutable builtin functions
2020-04-09 15:46:02 +02:00
Mathias Baumann
5203503583 Allow for per-parameter literalValues builtin functions 2020-04-08 16:41:38 +02:00
chriseth
823a119117
Merge pull request #8570 from aarlt/clang-tidy-apply-modernize-use-emplace
clang-tidy: Apply modernize-use-emplace.
2020-04-07 17:28:50 +02:00
Alexander Arlt
cae6e7769f Apply modernize-use-override. 2020-04-02 18:00:44 -05:00
Alexander Arlt
90bb1d8a7c Apply modernize-use-emplace. 2020-04-02 17:35:48 -05:00
a3d4
3b9e926559 Moved "step" from settings to expectations. 2020-03-19 13:59:05 +01:00
a3d4
a5ae51fa6e Unified dialect selection in libyul/SyntaxTest and YulOptimizerTest. 2020-03-16 23:22:57 +01:00
a3d4
66783c30ce Introduced TestCaseReader. 2020-03-16 23:14:33 +01:00
chriseth
8d2a9bf773
Merge pull request #8458 from a3d4/partfix-8244-introduced-testcase-shouldrun
Partial Fix #8244: Introduced TestCase::shouldRun().
2020-03-09 18:35:12 +01:00
Daniel Kirchner
809e3503ba Control flow analysis for inline assembly. 2020-03-09 16:23:10 +01:00
a3d4
29b770c434 Introduced TestCase::shouldRun(). 2020-03-09 15:52:20 +01:00
Djordje Mijovic
ec083c4878 Adding source location support to AssemblyStack and thus debugging Yul sources 2020-02-25 22:19:03 +01:00
Djordje Mijovic
c891597204 Adding ssa type check and test for that one 2020-02-24 15:05:19 +01:00
Djordje Mijovic
2efda4129b Adding test for multi return values including bool in evmTyped dialect. Calling zeroLiteralForType from inliner 2020-02-24 15:05:19 +01:00
chriseth
bddbcbe6a4 Use bool type in word size transform. 2020-02-24 15:05:19 +01:00
chriseth
a52305d3bd Use bool type in conditional simplifier and for loop condition into body. 2020-02-24 15:05:19 +01:00
Djordje Mijovic
a52c9af5b9 Adding vardecl optimization for boolean types 2020-02-24 15:05:19 +01:00
chriseth
b9b36cd89e Properly assign types in ExpressionSplitter. 2020-02-24 15:05:19 +01:00
chriseth
2ee748b7f5 Add tests 2020-02-24 15:05:19 +01:00
chriseth
9140bc52c4 Tests for invalid types. 2020-02-24 15:05:18 +01:00
chriseth
6eec968365 Test updates. 2020-02-24 15:05:18 +01:00
Gaith Hallak
24d6702986 [Yul] Prune functions that call each other but are otherwise unreferenced 2020-02-11 20:39:32 +03:00
chriseth
92c9b078b4 Use correct instance of EVMDialectTyped. 2020-02-06 19:46:37 +01:00
chriseth
4ae97f4563 Make dialect option lowercase. 2020-02-06 19:46:37 +01:00
chriseth
5de3379d82
Merge pull request #8238 from ethereum/yul-syntax-tests
Implement yul syntax tests
2020-02-05 15:15:41 +01:00
Mathias Baumann
fc10e701fc Implement yul syntax tests 2020-02-05 14:58:34 +01:00
Mathias Baumann
ef07fc3066 Fix formatting 2020-02-05 13:22:15 +01:00
chriseth
9f0cef97c2 Specify default type for word size transform externally. 2020-02-04 18:13:37 +01:00