Commit Graph

768 Commits

Author SHA1 Message Date
Harikrishnan Mulackal
f162c484ca
Merge pull request #11026 from ethereum/resolve-keccak
Evaluate ``keccak256(a, const)``, when the value at memory location ``a`` is known at compile time and ``const <= 32``
2021-04-22 19:18:19 +02:00
hrkrshnn
b599235b8d Skip resolving Keccak if AST contains msize.
Also a refactoring changing `m_optimizeMLoad` to `m_containsMSize`.
2021-04-22 18:19:47 +02:00
hrkrshnn
3bc4f5708a Evaluate keccak(a, const) if value at memory location a is known
Here the value of constant can be at most 32.
2021-04-22 18:19:47 +02:00
hrkrshnn
011f8d3ff7 Changed the type of gas calculation to bigint instead of size_t
Since the gas calculation can involve multiplication by ``--optimize-runs``, it is possible that
`size_t` is not enough to represent the total gas.
2021-04-22 18:19:47 +02:00
hrkrshnn
94f9410abe Added hashFunction to Dialect. For EVMDialect, it is keccak256
In a later PR, the functions `storageLoadFunction`, `storageStoreFunctions`, etc will be refactored
to return a YulString instead of a pointer to a BuiltinFunction.
2021-04-22 17:27:57 +02:00
hrkrshnn
dd6300a53e GasMeter can now account for gas of Keccak-256 2021-04-22 17:27:57 +02:00
hrkrshnn
1f5b874eaf Optimizer context has parameter expectedExecutionsPerDeployment 2021-04-22 17:27:57 +02:00
chriseth
a6a3af58a0 Add test. 2021-04-22 17:23:56 +02:00
chriseth
00fb2d390b Do not replace zeros by return variable. 2021-04-22 16:54:02 +02:00
chriseth
35b651103d Adjust cost of literal zero. 2021-04-22 11:42:42 +02:00
Daniel Kirchner
f9b23ca845
Merge pull request #11247 from ethereum/setValueForCurrentScopeHelper
Add SetValueForCurrentScope helper.
2021-04-16 12:42:25 +02:00
Daniel Kirchner
afae46dcb5 Add ScopedSaveAndRestore helper. 2021-04-16 10:56:56 +02:00
Daniel Kirchner
5bebbca273 Extract VariableReferenceCounter and StackTooDeep error from EVMCodeTransform. 2021-04-13 10:41:16 +02:00
chriseth
2856f56525
Merge pull request #10942 from ethereum/returnSlotAllocation
Delayed return slot allocation.
2021-04-08 16:42:07 +02:00
chriseth
f04adde664 Allow hex string literals in Yul. 2021-04-08 15:03:33 +02:00
anurag4u80
b2ca7916aa Replaced boost::adaptors::transformed 2021-04-08 17:38:14 +05:30
Daniel Kirchner
35c2eeab68 Restrict to only popping, but not reusing argument slots, as well as only freeing up until the return slots are allocated. 2021-04-06 13:38:06 +02:00
Daniel Kirchner
4b0f8383a6 Reuse function argument slots and defer allocation of return variable slots in EVMCodeTransform. 2021-04-06 13:38:05 +02:00
anurag4u80
bbcdddeed9 Replaced keys, values and reverse with ranges 2021-03-31 23:33:04 +05:30
hrkrshnn
0100f48e05 FunctionSpecializer: skip specializing recursive functions
This avoids potential pathological behaviour, like in Ackermann function.
2021-03-29 11:02:31 +02:00
hrkrshnn
45a3747701 Added FunctionSpecializer to the optimization suite 2021-03-29 11:02:18 +02:00
hrkrshnn
22ebdc7438 Implemented FunctionSpecializer
Optimiser step that specializes the function with its literal arguments.
2021-03-29 11:02:18 +02:00
hrkrshnn
8564d08228 Added a helper class FunctionCopier in ASTCopier
Helper class that creates a copy of the function definition, replacing the names of the variable
declaration with a new name.
2021-03-29 11:02:18 +02:00
hrkrshnn
b42fc2015c NameCollecter can now only collect VariableDeclarations
This is done to help with the optimizer step FunctionSpecializer
2021-03-25 11:49:16 +01:00
hrkrshnn
6d9e9e1b1e Fix small bug in GasMeter calculation in creation context
Old calculation did not ignore `optimize-runs` parameter, when creation code gas computations were
done. This would lead to expanding values such as `shl(180, 1)` inside constructor code, even for
the default value for `--optimize-runs`, i.e., 200.
2021-03-17 12:33:10 +01:00
Daniel Kirchner
a75424eec4 Drop support for evm15 and eip-615. 2021-03-09 15:56:03 +01:00
chriseth
7d0ecd9406
Merge pull request #10535 from ethereum/removeNumbers
Improve generated names.
2021-02-23 13:29:18 +01:00
chriseth
9c7b1e9c3f Detect assignment to function in inline assembly. 2021-02-23 11:47:12 +01:00
chriseth
fc0e571a07 Refined cleanup. 2021-02-16 14:20:27 +01:00
Alex Beregszaszi
ded5d721d2 Turn unreachable error into assertion 2021-02-16 10:59:22 +00:00
Christian Parpart
32ba5f5ae7 libsolidity: Extend the AST for named AST nodes in order to get precise locations for names.
The actual SourceLocation on an ASTNode is representing the whole
ASTNode whereas in an LSP (for example) you are also interested in the
SourceLocation of a name of a construct (e.g. variable decarlation, function definition, ...).

This also properly encodes non-existend sources as `-1` in the JSON output (eliminating the use of `numeric_limits<size_t>::max()`).
2021-02-10 18:13:09 +01:00
chriseth
9b20c9840a
Merge pull request #10885 from ethereum/heuristic-revamp
Yul Backend: Get rid of heuristics for finding the matching runtime
2021-02-10 00:49:56 +01:00
hrkrshnn
5a21e33743 Improve error reporting for Yul parser errors
This makes debugging Sol2Yul codegen bugs slightly easier.
2021-02-09 15:40:25 +01:00
Mathias Baumann
e4f1257c83 Yul Backend: Get rid of heuristics for finding the matching runtime 2021-02-09 14:50:25 +01:00
Alexander Arlt
87e3fbee6c [ewasm] Polyfill: balance & address. 2021-01-19 13:03:40 -05:00
Alexander Arlt
321e971eb3 [ewasm] Add support for hera debugging module. 2021-01-18 20:06:12 -05:00
Daniel Kirchner
f34d7120a2 Add and use mapTuple helper. 2021-01-13 17:23:27 +01:00
Daniel Kirchner
91cdb606a5 Some style review suggestions. 2021-01-13 12:43:38 +01:00
Daniel Kirchner
4505889481 Replace ranges::all_of wrapper by range-v3. 2021-01-12 21:44:42 +01:00
Daniel Kirchner
75bed10be5 Check for scopes in LoadResolver. 2021-01-12 21:41:51 +01:00
Daniel Kirchner
eb035147d2 Rephrase erasure condition in DataFlowAnalyzer. 2021-01-12 21:40:52 +01:00
Daniel Kirchner
3ed55613ba Add and use cxx20::ranges::all_of. 2021-01-12 21:40:52 +01:00
Daniel Kirchner
970e8064bb Clear variables, but not backreferences in popScope. 2021-01-12 21:40:52 +01:00
Daniel Kirchner
7fe03cbab0 Implement cxx20 polyfill and replace InvertibleMap entirely. 2021-01-12 21:40:40 +01:00
Daniel Kirchner
625d402dbb Various optimizations for the DataFlowAnalyzer. 2021-01-12 21:39:20 +01:00
Leonardo Alt
ced79497f5 Fix BFS 2021-01-06 10:17:17 +01:00
Alex Beregszaszi
0425936c8a Rename AsmScope* to Scope* 2020-12-18 11:55:17 +00:00
Alex Beregszaszi
9230faf9a3 Simplify StackTooDeepError in Yul 2020-12-16 20:35:11 +00:00
chriseth
8f833f4e8f
Merge pull request #10618 from ethereum/develop
Merge develop into breaking.
2020-12-16 12:34:41 +01:00
chriseth
5c40fb060c Report illegal tokens in the Yul parser. 2020-12-16 12:20:07 +01:00