chriseth
1531863835
Split Common.h into Numeric.h.
2021-09-23 15:27:29 +02:00
chriseth
c8e6ef9657
Merge pull request #12004 from ethereum/disambiguateBytesRequired
...
Disambiguate bytesRequired
2021-09-23 15:25:44 +02:00
Kamil Śliwak
fc7e8c56dc
Fill out originLocation with nativeLocation when importing Yul AST
2021-09-22 13:17:18 +02:00
Kamil Śliwak
d23754eafd
AsmParser: Don't use locationOverride as current location when location from comments is selected
2021-09-22 13:11:39 +02:00
Kamil Śliwak
ce4420f857
Separate DebugData fields for Solidity and Yul source locations
2021-09-22 13:11:39 +02:00
Kamil Śliwak
9c1d40debf
AsmParser: Replace m_debugDataOverride with separate variables for location and AST ID
2021-09-22 13:11:39 +02:00
chriseth
50ce1f5ddd
Disambiguate bytesRequired
2021-09-22 11:22:07 +02:00
chriseth
e6f0fe8ae3
Use source id in yul to evm code transform.
2021-09-22 11:11:51 +02:00
Kamil Śliwak
a9b5835e5d
AsmPrinter: Don't include whitespace after @src if there's no code snippet
2021-09-17 21:46:12 +02:00
chriseth
a72f4f3993
Print AST ID.
2021-09-16 17:19:17 +02:00
chriseth
dafa6f552b
Rename formatting function.
2021-09-16 17:19:17 +02:00
chriseth
05d20446bb
Parse @ast-id annotation.
2021-09-16 17:18:48 +02:00
chriseth
42739b73b1
Extend debug info.
2021-09-16 17:18:48 +02:00
chriseth
280ff8cbd4
Use iterateReplacing in StatementRemover.
2021-09-16 15:34:48 +02:00
chriseth
d708612e27
Refactor source comment parsing.
2021-09-16 12:22:27 +02:00
chriseth
a66e6f08c0
Merge pull request #11951 from ethereum/scopeFillerNullptr
...
Use locationOf helper instead of accessing debugData directly.
2021-09-14 15:43:01 +02:00
chriseth
f14ff233fc
Merge pull request #11922 from ethereum/newCodeTransformSourceLocations
...
Better source locations in Yul ControlFlowGraph and OptimizedEVMCodeTransform.
2021-09-14 14:32:39 +02:00
chriseth
a35608aa8c
Merge pull request #11797 from ethereum/optimizedEVMCodeTransform
...
Optimized EVM Code Transform. (New Code Transform Step 3)
2021-09-14 14:29:54 +02:00
Daniel Kirchner
854b8b65b5
Better source locations in Yul ControlFlowGraph and OptimizedEVMCodeTransform.
2021-09-14 13:43:16 +02:00
Daniel Kirchner
75c3286311
Optimized EVM Code Transform.
2021-09-14 13:37:04 +02:00
Kamil Śliwak
14639efc5d
Print code snippets next to source locations in IR output
2021-09-14 12:09:59 +02:00
Kamil Śliwak
d78522b08b
AsmParser: Accept optional code snippets after the @src tags
2021-09-14 12:09:59 +02:00
Kamil Śliwak
37f681c430
Deduplicate code for printing source locations
2021-09-14 11:46:57 +02:00
Daniel Kirchner
7abc55d89a
Use locationOf helper instead of accessing debugData directly.
2021-09-14 10:04:09 +02:00
Kamil Śliwak
fbdfc6bb7a
AsmParser: Require whitespace before tags in location comments
2021-09-09 18:27:29 +02:00
Kamil Śliwak
14396c207c
AsmParser: Generalize location comment parsing to make it easier to add support for more tags
2021-09-09 17:12:59 +02:00
Kamil Śliwak
aa156ab6c7
Parser::fetchSourceLocationFromComment(): Some general cleanup (renaming, wrapping, etc.)
2021-09-09 17:12:59 +02:00
Kamil Śliwak
e3a5f923eb
AsmParser: Refactor the @src regex
2021-09-09 17:12:58 +02:00
Daniel Kirchner
c499f27a63
Change RematCandidateSelector to not depend on variable name sorting.
2021-09-08 15:41:40 +02:00
Daniel Kirchner
d512f7a4fd
Merge pull request #11890 from ethereum/stackLayoutGeneratorReportTooDeep
...
Report stack too deep and conditional stack compression in StackLayoutGenerator.
2021-09-08 10:28:30 +02:00
Daniel Kirchner
a683ea7646
Remove the expression callback from the code generator functions of Yul builtins.
2021-09-06 17:07:53 +02:00
chriseth
be95a8172b
Merge pull request #11891 from ethereum/guidedRematerializer
...
Allow the Rematerializer to be restricted to an exact set of variables.
2021-09-06 16:22:14 +02:00
hrkrshnn
2cdd3b2081
Resolving Keccak-256: check if arguments are identifiers early.
...
Previously, the check on whether the optimization was useful gas wise was done before checking if
the keccak256 opcode had identifier as arguments. Since the gas meter crashes when encountering
certain Yul opcodes (create, dataoffset, etc.), this optimizer step crashed.
2021-09-06 13:48:07 +02:00
Daniel Kirchner
e022ba1bfb
Report stack too deep and conditionally aggressively compress stack in StackLayoutGenerator.
2021-09-06 09:08:04 +02:00
Daniel Kirchner
646421fee1
Allow the Rematerializer to be restricted to an exact set of variables.
2021-09-03 15:29:51 +02:00
Daniel Kirchner
d384664dcb
Merge pull request #11615 from ethereum/yulStackLayoutGenerator
...
Yul Stack Layout Generator (New Code Transform Step 2)
2021-09-03 13:13:18 +02:00
chriseth
7f137d352a
Merge pull request #11869 from ethereum/remodelUseSrc
...
Allow and require use-src to be repeated for each object.
2021-09-02 18:34:07 +02:00
Daniel Kirchner
f881409ea4
Stack layout generator for new code generation.
2021-09-02 17:47:19 +02:00
chriseth
5caa15879b
Allow and require use-src to be repeated for each object.
2021-09-02 11:29:42 +02:00
Daniel Kirchner
f4effe966e
Merge pull request #11824 from ethereum/yulControlFlowGraphRecursiveCalls
...
Mark recursive calls in yul control flow graph.
2021-09-01 15:18:04 +02:00
benldrmn
58e4cc62e0
Increase use of C++ constexpr constant expressions in code base as described in issue #7720
2021-08-31 15:03:59 +02:00
Daniel Kirchner
c82f9b9fab
Mark recursive calls in yul control flow graph.
2021-08-19 16:54:43 +02:00
chriseth
8926274000
Fix recursion protection.
2021-08-19 12:51:54 +02:00
chriseth
4b038e3f02
Extend knowledge base.
2021-08-18 12:42:46 +02:00
Daniel Kirchner
f609288cba
Add missing header.
2021-08-17 16:04:38 +02:00
chriseth
3622b30a1d
Refactor RedundantAssignEliminator.
2021-08-13 14:25:14 +02:00
chriseth
90c4623460
Some more base fees.
2021-08-12 16:37:21 +02:00
chriseth
a4c94a1b5b
Fixed inline assembly external identifier access.
2021-08-11 18:18:29 +02:00
hrkrshnn
7f1a2be0fe
Allow basefee as Yul identifier for EVMVersion < london
...
This was done to prevent basefee from being a breaking change. This change will be removed in 0.9.0.
TODO revert this commit in breaking.
2021-08-11 10:46:08 +02:00
hrkrshnn
95091f6b58
Implemented block.basefee
in Solidilty and basefee()
in Yul.
...
Also added basefee to Yul grammar.
2021-08-09 16:18:08 +02:00
chriseth
467cbf92bc
Only provide code generator to CodeTransform.
2021-08-04 18:38:10 +02:00
chriseth
ae519c1278
Merge pull request #11658 from ethereum/removeScannerFromCompilerStack
...
Remove scanner from compiler stack
2021-08-03 17:47:39 +02:00
chriseth
d7a40622e4
Merge pull request #11729 from ethereum/build-speedups
...
header file cleanups
2021-08-03 16:44:54 +02:00
Christian Parpart
af18b8afc2
Eliminate some unnecessary header inclusions in headers in Scanner.h and SourceReferenceFormatter.h
2021-08-03 15:43:17 +02:00
Christian Parpart
6294aa871a
Simplify AsmParser::parse(.) usage
2021-08-03 15:43:17 +02:00
chriseth
ffc5cfd9a5
Remove scanner from compiler stack.
2021-08-03 15:43:17 +02:00
Christian Parpart
81e9225304
Eliminate some unnecessary header inclusions in headers.
2021-08-03 15:43:14 +02:00
Mathias Baumann
2ee6c7be64
Print @src and @use-src locations in AsmPrinter
2021-08-03 15:29:52 +02:00
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