Christian Parpart
3755210b7b
[libyul] ObjectParser: Enables the use of custom source mapping via @use-src.
2021-07-27 16:46:47 +02:00
Daniel Kirchner
f3707f2ab0
Control flow graph for Yul.
2021-07-15 15:24:12 +02:00
Kamil Śliwak
6753c8f624
Rename escapeAndQuoteYulString() back to escapeAndQuoteString()
2021-07-14 21:29:01 +02:00
chriseth
01dc77e5a2
Properly assign source names for AST import.
2021-07-14 15:12:10 +02:00
chriseth
f75b55071e
Remove CharStream from SourceLocation.
2021-07-14 15:12:07 +02:00
chriseth
e5ab68ed71
Use unknown file for invalid source index.
2021-07-12 17:35:49 +02:00
Christian Parpart
f129a3498c
Use shared DebugData for when using source locations from comments.
2021-07-09 11:50:50 +02:00
Christian Parpart
5e4868d5d6
Adapted tests due to more precise Yul source locations.
...
Also added support for -1 source index, referencing original scanner's source location.
2021-07-09 11:50:48 +02:00
Christian Parpart
132fa46faa
Yul: Adds parsing @src comment in AsmParser to customize the AST's sourcer locations.
2021-07-09 11:48:00 +02:00
Christian Parpart
43cde4e175
Adds missing include header (for DebugData).
2021-07-09 11:46:59 +02:00
Christian Parpart
f9f32c910d
Fix source location for `if
` statements.
2021-07-07 17:37:01 +02:00
chriseth
8d5e82b406
Fix source location of builtin function calls.
2021-07-06 16:54:29 +02:00
Alex Beregszaszi
847e30e6ff
Optimise libevmasm in yul
2021-07-05 13:46:53 +02:00
Daniel Kirchner
c341445f8e
Maintain disambiguation when generating new functions in StackToMemoryMover.
2021-06-28 18:11:57 +02:00
Daniel Kirchner
bc288aacf5
Have the stack optimization in the code transform only reuse slots that are reachable and fix argument slot reuse on functions without return variables.
2021-06-28 18:11:57 +02:00
Daniel Kirchner
dfce7b667d
Move function arguments and return values.
2021-06-28 18:11:57 +02:00
Daniel Kirchner
cc0169ad68
Function definition collector.
2021-06-28 18:11:57 +02:00
Kamil Śliwak
19fada966f
Do not use \b, \v and \f escapes in string literals in generated Yul code
2021-06-28 14:13:47 +02:00
chriseth
0df8a38e55
Support metadata via IR.
2021-06-21 18:20:31 +02:00
Alex Beregszaszi
6ae09ee0cc
Add AssemblyStack.assembleEVM which returns both deploy and runtime assemblies
2021-06-17 15:35:59 +02:00
Alex Beregszaszi
05e3e723f5
Remove non-existing AssemblyStack.assembleAndGuessRuntime from header
2021-06-17 15:28:22 +02:00
chriseth
fe35512feb
Remove EVMAssembly.
2021-06-08 18:41:22 +02:00
TerranCivilian
c15501eea9
Remove unneeded include files
2021-06-07 12:53:18 -04:00
chriseth
d305c219d8
Fix namespace styles.
2021-05-27 17:41:04 +02:00
hrkrshnn
39b23420ec
Extracted the class SMT Solver from ReasoningBasedSimplifier
2021-05-06 11:26:26 +02:00
chriseth
9d156b52c4
Merge pull request #8868 from ethereum/functionEntryPoints
...
Note function entry points.
2021-05-05 11:08:44 +02:00
chriseth
e7708b6006
Properly treat utf8-non-encodable yul literals.
2021-05-05 10:28:23 +02:00
franzihei
13eec106f4
DOCS: update optimizer docs, harmonize spelling and add Yul-based optimizer module
2021-05-04 17:37:02 +02:00
chriseth
f9c94d7c42
Note function entry points.
2021-05-04 17:15:13 +02:00
Djordje Mijovic
e404b6e7a6
Refactoring yul source locations.
2021-05-04 16:05:23 +02:00
Alex Beregszaszi
176ce4edf7
Split EthAssemblyAdapter from AsmCodeGen
2021-04-27 11:31:15 +01:00
chriseth
cb1af8b88a
Make verbatim compatible with KnownState.
2021-04-26 19:56:44 +02:00
chriseth
e2d8005737
Add verbatim builtin.
2021-04-26 19:56:44 +02:00
chriseth
d9df3d50e2
Merge pull request #11311 from anurag-git/issue_10738-3
...
Use range-v3 loops(remove_erase, remove_erase_if)
2021-04-26 14:18:15 +02:00
Harikrishnan Mulackal
2cb525f607
Merge pull request #11306 from ethereum/toevminstruction
...
Add toEVMInstruction helper
2021-04-26 08:41:25 +02:00
anurag4u80
c4cf412fed
Replaced boost remove_erase and remove_erase_if
2021-04-24 08:10:41 +05:30
Alex Beregszaszi
d508544340
Add toEVMInstruction helper
...
Co-authored-by: Harikrishnan Mulackal <webmail.hari@gmail.com>
2021-04-23 22:56:50 +01:00
Kamil Śliwak
173a511809
Merge pull request #11303 from ethereum/noncopyable
...
Remove the usage of boost::noncopyable
2021-04-23 22:38:49 +02:00
Alexander Arlt
fc7fb3cb7d
[ewasm] Polyfill: callvalue, gasprice & difficulty.
2021-04-23 15:54:10 +01:00
Alex Beregszaszi
e39433198d
Remove the usage of boost::noncopyable
...
Prior to this half of the codebase used explicit deleted copy constructors, the others used boost::noncopyable.
2021-04-23 14:57:01 +01:00
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
chriseth
6c7e6a3c9f
Merge pull request #10615 from ethereum/develop
...
Merge develop into breaking.
2020-12-15 18:34:01 +01:00
Bhargava Shastry
9b38176c77
AsmAnalysis: Fix out of bounds read due to incorrect bounds checking on literal arguments
2020-12-15 15:38:59 +01:00
chriseth
561280a5cc
Merge remote-tracking branch 'origin/develop' into breaking
2020-12-14 11:33:40 +01:00
Alex Beregszaszi
bd641a5206
Enable more C++ compiler warnings
2020-12-10 21:03:58 +00:00
Alex Beregszaszi
2b09fa14e1
Disallow using reserved identifiers in Yul
2020-12-10 17:10:38 +01:00
Alex Beregszaszi
7df986539f
Disallow using reserved identifiers in NameDispenser/VarNameCleaner
2020-12-10 17:10:38 +01:00
Alex Beregszaszi
3a687c34e4
Add reservedIdentifier to dialect
2020-12-10 17:10:38 +01:00
chriseth
482bda6887
Merge remote-tracking branch 'origin/develop' into breaking
2020-12-10 12:15:52 +01:00
chriseth
d75821e068
Merge pull request #10536 from ethereum/fix-createlinkingfunction-to-cpp
...
Move the implementation of createLinkingFunction into a cpp file
2020-12-09 17:49:16 +01:00
chriseth
b18c76e34b
Merge remote-tracking branch 'origin/develop' into breaking
2020-12-09 15:24:49 +01:00