Commit Graph

410 Commits

Author SHA1 Message Date
Christian Parpart
abb9f1eed7 CMake: Renaming devcore static library to solutil (to match source code paths) 2020-01-13 15:52:46 +01:00
Christian Parpart
345f9928ab Library libdevcore renamed to libsolutil. 2020-01-07 15:51:50 +01:00
Christian Parpart
6b23412fae C++ namespace cleanup (except tests). 2020-01-07 15:51:50 +01:00
chriseth
1ebcc757e1 Merge remote-tracking branch 'origin/develop' into develop_060 2019-11-27 19:14:08 +01:00
chriseth
0bb88dabb7 Restrict usage of plain "new". 2019-11-27 17:55:11 +01:00
chriseth
b0db64ff5b Merge remote-tracking branch 'origin/develop' into develop_060 2019-11-26 16:19:35 +01:00
Alex Beregszaszi
991fbd2956 Replace uses of BOOST_THROW_EXCEPTION with assertThrow
Where appropriate.
2019-11-26 13:07:42 +01:00
Alex Beregszaszi
fc10fc3073 Move InvalidDeposit/InvalidOpcode from Instructions.h to Exceptions.h 2019-11-26 12:21:06 +01:00
chriseth
b6ad8f06e7
Merge pull request #7782 from ethereum/develop
Merge develop into develop_060
2019-11-25 17:58:09 +01:00
Alex Beregszaszi
ae428dc2a0 Clarify some notes in LinkerObject and assert that linkReferences are always correct 2019-11-22 16:48:23 +00:00
chriseth
a00f824479
Merge pull request #7773 from ethereum/develop
Merge develop into develop_060
2019-11-21 21:49:22 +01:00
chriseth
a26dd5a428 Remove trailing spaces in output. 2019-11-21 20:09:03 +01:00
Leonardo Alt
389da5228e Merge remote-tracking branch 'origin/develop' into merge_develop_060 2019-11-20 12:27:40 +01:00
Alex Beregszaszi
840aba8929 Add new gas price for deployed bytecode (EIP2028) 2019-11-19 17:09:18 +01:00
Alex Beregszaszi
21312f52f2 Add new gas prices for SLOAD/BALANCE/EXTCODEHASH for Istanbul (EIP1884) 2019-11-19 17:09:18 +01:00
Erik K
94272d44aa
Merge pull request #7745 from ethereum/develop
Merge develop into develop_060
2019-11-19 15:30:31 +01:00
chriseth
e70ef0b820 Simplify patterns. 2019-11-15 00:34:01 +01:00
chriseth
2e5a42836c
Merge pull request #7681 from ethereum/develop
Merge develop into develop_060
2019-11-11 16:42:03 +01:00
chriseth
4b6647f6e1 Generalize word. 2019-11-07 14:33:34 +01:00
chriseth
fa02667075 Generalize instructions. 2019-11-07 14:33:34 +01:00
Mathias Baumann
37d6fd9e21 Fix case-sensitivity depending on platform 2019-11-05 17:25:08 +01:00
chriseth
cb2096c82a Add modifier depth to source mappings. 2019-11-05 16:50:38 +01:00
Mathias Baumann
6705420325 Fix case-sensitivity depending on platform 2019-11-04 17:00:48 +01:00
Mathias Baumann
b3a5c9c9c0 Fix failing tests on ArchLinux and potentially MacOS 2019-10-29 12:02:50 +01:00
chriseth
c224b09bb3 Fix reordering bug in optimizer. 2019-09-17 12:33:00 +02:00
Dimitry
fd3ae0b24a add chainid and selfbalance to lllc 2019-09-09 23:35:36 +03:00
Bhargava Shastry
09fa31ccc5 yul: Add new optimizer rules for create and create2 builtins 2019-09-09 17:06:56 +02:00
Alex Beregszaszi
59df7dbc1b Add upper bound assert for PushSub/PushSubSize 2019-09-03 16:40:34 +01:00
chriseth
e86b5cf14e Replace byte(A, X) by zero if A >= 32 2019-08-29 15:35:34 +02:00
chriseth
633510eb04
Merge pull request #6935 from ethereum/subMaxValueXNotXRule
Add optimization rule SUB(~0, X) -> NOT(X).
2019-06-17 14:42:49 +02:00
Bhargava Shastry
e96003e709 optimizer: Remove redundant rule from the optimizer rule list 2019-06-17 13:41:48 +02:00
Daniel Kirchner
7f322c9433 Add optimization rule SUB(~0, X) -> NOT(X). 2019-06-14 14:07:46 +02:00
chriseth
afe887adc1 Split MovableChecker and introduce SideEffectsUpToMSize. 2019-05-28 12:54:32 +02:00
Alex Beregszaszi
5acd862b05 Document copyRoutine in ConstantOptimiser 2019-05-22 15:18:57 +01:00
chriseth
54ce3df321
Merge pull request #6755 from ethereum/useShiftDirectly
[Optimizer] Use shift directly instead of multiplication in constant optimizer.
2019-05-16 15:49:02 +02:00
chriseth
5824f5d42f Use shift directly instead of multiplication in constant optimizer. 2019-05-16 12:50:53 +02:00
chriseth
e8a88b13e4 Introduce side-effect-free as relaxed version of movable. 2019-05-16 12:30:05 +02:00
chriseth
f6437a2016 Optimizer rules that combine shifts and masks. 2019-05-15 20:30:53 +02:00
Daniel Kirchner
a5427bc63a Add optimizer rules for multiplication and division by left-shifted one. 2019-05-14 16:20:45 +02:00
chriseth
99e96c2d66 Refactor termination detection. 2019-05-13 18:58:36 +02:00
Mathias Baumann
e20acf5d0a Yul Optimizer: Remove dead code 2019-04-01 17:16:04 +02:00
Mathias Baumann
5c66ccc179 Optimize obsolete ANDs in combination with certain SHIFTs 2019-03-29 10:08:05 +01:00
Alex Beregszaszi
84fbf605aa Replace shifts by larger than 255 with 0 2019-03-29 10:07:54 +01:00
chriseth
30da62aa2c
Merge pull request #6408 from ethereum/includeCleanup
Include cleanup
2019-03-28 15:31:07 +01:00
chriseth
f2cee9ec0c Include cleanup. 2019-03-28 14:32:48 +01:00
chriseth
2308904f68 Remove "using namespace" from header and move Instruction to dev::eth. 2019-03-28 13:48:11 +01:00
Bhargava Shastry
f7b5a27581 Fixes bug in byte optimization rule and adds tests. 2019-03-21 14:29:06 +01:00
Mathias Baumann
6b60e90cde Fix commented debug output code 2019-03-19 16:15:05 +01:00
Alex Beregszaszi
f95388011b Allow simplification patterns to signal failure 2019-03-19 15:51:52 +01:00
chriseth
4c1a9aa273
Merge pull request #6256 from ethereum/completeLtGtRules
Complete the GT/LT rules.
2019-03-13 12:08:34 +01:00
chriseth
571f400a3e Complete the GT/LT rules. 2019-03-13 12:01:23 +01:00
Bhargava Shastry
515fa872c8 Fixes u256 overflow in logical shift optimization rule and adds tests. 2019-03-13 11:19:20 +01:00
chriseth
e0d1b2f5b3 Peephole optimizer for "iszero iszero <tag> jumpi". 2019-03-07 15:52:02 +01:00
chriseth
34082a2368
Merge pull request #6159 from ethereum/more-optims
More optimiser rules for LT/GT/AND/BYTE and address cleanups
2019-03-04 16:24:38 +01:00
Alex Beregszaszi
1272951bbb Do not mask with 160-bits after CREATE/CREATE2 2019-03-04 14:42:29 +01:00
Alex Beregszaszi
7aa2ee1775 More optimiser rules for LT/GT/AND/BYTE 2019-03-04 14:42:29 +01:00
Alex Beregszaszi
a7c2dba681 Document the boost multiprecision shift bug in RuleList 2019-03-04 13:37:20 +01:00
chriseth
851dd635eb Remove defaults in constructor arguments. 2019-03-04 11:41:52 +01:00
Alex Beregszaszi
cf5c13f9c7 Introduce global optimiser settings. 2019-03-04 11:40:28 +01:00
Alex Beregszaszi
4430fe6a54 Combine multiple shifts with constant shift-by values in the optimiser 2019-02-25 20:56:13 +00:00
chriseth
70bbdd8fac
Merge pull request #3464 from ethereum/iulia_interp
Yul interpreter
2019-02-25 15:38:41 +01:00
Leonardo Alt
2405b2151a EVMVersion in langutil namespace instead of solidity 2019-02-25 15:29:57 +01:00
chriseth
cc88c517a2 Review changes. 2019-02-25 11:58:37 +01:00
Alex Beregszaszi
81d011335a Support shifts in the constant optimiser when Constantinople is targeted 2019-02-22 11:55:43 +00:00
chriseth
7f6f958246 Fix: Also replace tags in the list of tags referenced from outside. 2019-02-20 15:06:23 +01:00
Alex Beregszaszi
fd936439a4 Add more optimisation rules for shifts 2019-02-20 11:59:15 +00:00
Daniel Kirchner
809b9a95f9 Even more style checks. 2019-02-14 11:53:00 +01:00
Alex Beregszaszi
6b11be8c69 Mark apropriate methods protected in ConstantOptimiser 2019-02-05 19:40:34 +00:00
Alex Beregszaszi
ae1cd252b0 Take only Assembly instance as an input to ConstantOptimiser 2019-01-31 16:02:29 +00:00
Alex Beregszaszi
4aa2d965dc Remove once-off helper in ConstantOptimiser
For clarity. Makes code easier to understand.
2019-01-28 15:44:44 +00:00
Alex Beregszaszi
9d52325b29 Move ConstantOptimiser constructor to header 2019-01-28 11:20:46 +00:00
Daniel Kirchner
870b656eda Split up rule list generation further to prevent issues in browsers with the emscripten build. 2019-01-18 17:02:47 +01:00
chriseth
ef59f35a14
Merge pull request #5693 from ethereum/assemblyitem
Use explicit break and do not coerce 0 into bool in AssemblyItem
2018-12-19 15:14:49 +01:00
Alex Beregszaszi
517beb6fa6 Use explicit break and do not coerce 0 into bool in AssemblyItem 2018-12-19 12:35:00 +00:00
Christian Parpart
62fe57479e
make use of C++ = default constructor declarations as well as more non-static member initialization syntax. 2018-12-19 11:26:42 +01:00
chriseth
27e4e25a99 Optimize some instruction comparisons. 2018-12-18 17:25:49 +01:00
chriseth
01249984f2 Provide comparison shortcut. 2018-12-18 16:10:14 +01:00
chriseth
18efbb52c0 Use the move. 2018-12-18 16:10:14 +01:00
chriseth
68ad015714 Make swappable instructions static. 2018-12-18 12:39:24 +01:00
Daniel Kirchner
2353f73c39 Add headers to targets in CMakeLists.txt. 2018-12-17 15:01:02 +01:00
Mathias Baumann
cb935fe908 Use curly-brackets initialization 2018-12-10 19:03:47 +01:00
Mathias Baumann
2f6dc2e773 Replace push_back with emplace_back where it makes sense 2018-12-10 19:02:39 +01:00
chriseth
bc6ddbdd09 Remove w parameter for toHex. 2018-12-05 22:51:49 +01:00
Christian Parpart
c48a5264be
liblangutil: SourceLocation: adds (shared) pointer to underlying CharStream source, eliminating sourceName
Also, adapted affecting code to those changes.
2018-11-30 17:07:12 +01:00
chriseth
fb2e471d00 Fix nondeterminism bug related to boost version. 2018-11-27 16:00:22 +01:00
Christian Parpart
cdd8c72c9d CMake: Explicitly state which files to compile instead of relying on globbing.
Also remove header file lists, as there is no need to add them to
add_library() or add_executable(), which should lower maintenance of the cmake files.
2018-11-26 14:39:24 +01:00
chriseth
2e861bf1a0
Merge pull request #5472 from ethereum/assemblyAnnotationOutput
Jumps with annotations cannot be functional.
2018-11-23 17:02:03 +01:00
Christian Parpart
d67322a186 Introduce namespace langutil in liblangutil directory.
Also:
- Use {}-style list initialisation for SourceLocation construction
- Introduce new system includes
- Changes the API of the Scanner to take source as value (with move) as opposed to as a reference
2018-11-21 19:13:44 +00:00
Christian Parpart
87821c53c3 Isolating files shared between Yul- and Solidity language frontend. 2018-11-21 18:58:12 +00:00
chriseth
82055cbb61 Jumps with annotations cannot be functional. 2018-11-21 19:28:41 +01:00
mordax
ea8b7d803e Removing redundant virtual from override function declaration
Remove trailing whitespace

Remove changelog change
2018-11-21 14:37:32 +00:00
chriseth
6bbedab383
Merge pull request #5265 from ethereum/cleanupsha3
Simplify sha3.
2018-11-09 15:39:57 +01:00
Christian Parpart
ab0de38f16
Eliminate byte-typedef and use uint8_t in all their places instead.
This change is made to (easily) be forward compatible with future C++
standards, in order to allow compiling the code with newer standards at
some point in the future.

* Removed the `using byte = uint8_t;` line from Common.h
* Mechanically change all uses of `byte` to `uint8_t`.

Tested with GCC 7.3 in C++11/14/17 modes :-)
2018-11-07 12:17:57 +01:00
chriseth
e78b95d9d4 Renamed SHA3.{h,cpp} files. 2018-10-18 14:31:36 +02:00
chriseth
26c693aa92 Change library placeholder to __$<hash>$__. 2018-10-12 15:15:02 +02:00
chriseth
4d6d224cf8 Prefix "0x" to library placeholder. 2018-10-12 15:15:01 +02:00
chriseth
6daeb39ecc Use hash for library placeholders. 2018-10-12 15:15:01 +02:00
chriseth
d76bfcd935 Fix typos. 2018-10-04 13:28:16 +02:00
chriseth
7609710d4f
Merge pull request #5110 from codemascot/libevmasm/Assembly.cpp
Use 'switch' instead of 'else if'
2018-10-02 13:18:22 +02:00
Khan M Rashedun-Naby
14738d05e4 Use 'switch' instead of 'else if' 2018-09-27 17:46:53 +06:00
Alex Beregszaszi
6a1e79a8e3 Set the price of EXTCODEHASH properly 2018-09-26 16:11:02 +01:00
Jared Wasinger
c6bd2979b1 Add assembly support for EXTCODEHASH (EIP-1052) 2018-09-26 16:11:02 +01:00
Alex Beregszaszi
410d94c498
Merge pull request #5089 from ethereum/gasmeter
Small pathgasmeter cleanups
2018-09-26 15:16:38 +01:00
chriseth
2c860b7d74
Merge pull request #5094 from ethereum/evmasm-grouping
Group LLL only assembly features in libevmasm
2018-09-26 15:51:20 +02:00
Alex Beregszaszi
d7c3f197c4 Some cleanups in GasMeter 2018-09-26 14:25:40 +01:00
Alex Beregszaszi
d64be90497 Add PathGasMeter.estimateMax helper 2018-09-26 14:25:40 +01:00
Alex Beregszaszi
9be058eb70 Add explanation to GasMeter::dataGas 2018-09-26 14:25:40 +01:00
Alex Beregszaszi
913ddf158f Group LLL only assembly features in libevmasm 2018-09-26 12:46:03 +01:00
Alex Beregszaszi
535026b492 Group append() functions in libevmasm 2018-09-26 11:14:40 +01:00
Alex Beregszaszi
21beba76e2 Add helpers for the LOG instruction 2018-09-25 20:39:35 +01:00
Alex Beregszaszi
0db76a01da CREATE2 opcode has been moved from 0xfb to 0xf5 2018-09-18 23:04:57 +01:00
Alex Beregszaszi
c42dfc5b10
Merge pull request #4967 from ethereum/const-opt-cost
Move dataGas calculation helper to GasMeter
2018-09-18 15:46:15 +01:00
Alex Beregszaszi
0b68d093b4 Move dataGas calculation helper to GasMeter 2018-09-18 14:47:53 +01:00
Daniel Kirchner
a1d73a7bef Split simplification rules into two functions. 2018-09-18 14:28:21 +02:00
Alex Beregszaszi
0b6a26f854 Calculate the dataGas correctly in the constant optimiser
This may cause a wrong decision about cost (and as a result choosing the least efficient code),
but will not cause any miscompilation or invalid output.
2018-08-14 17:45:43 +02:00
Leonardo Alt
17cac588d0 Replace safety stop by invalid 2018-08-14 12:32:47 +02:00
chriseth
7d9692c31d Explicitly use std::next to avoid boost version. 2018-08-09 01:12:55 +02:00
Alex Beregszaszi
d3c3fd2079 Use dev::toString() in Assembly instead of misusing string{} for u256 2018-08-08 20:52:19 +01:00
Leo Arias
c4a3c48aea
Fix typo 2018-08-07 13:35:15 -06:00
Augusto F. Hack
6c3b48ddfc Added guards for unknown pragmas
Removed push/pop if there was no change to the warnings *in the same
file* for a given compiler. This assumes the imported boost headers use
a warning stack themselves.

The pragmas don't seem to be required anymore, but were not removed to
mantain compatibility with older versions of the boost library.

Compiled with
- clang version 6.0.1 (tags/RELEASE_601/final)
- gcc (GCC) 8.1.1 20180531
 against:
- libboost 1.67.0-5
2018-08-05 19:21:33 -03:00
Christian Parpart
fb4857abed evmasm/Instruction: fixes undefined behavior of advancing iterator beyond the end of a container.
Usually the STL doesn't check whether or not the developer advances beyond its container's end, but MSVC does (found out by running soltest in debug mode on Win32 / VS2017).
2018-08-02 19:53:46 +02:00
chriseth
28ac3f0a6c
Merge pull request #4473 from ethereum/fixGasTuple
Fix comparison operator for GasConsumption.
2018-07-11 11:55:19 +02:00
Cryptomental
140dbfdbd8 Code, Changelog, ReleaseChecklist: Fix typos.
Refs: #4442
2018-07-11 00:26:23 +02:00
chriseth
1fed3519e1 Fix comparison operator for GasConsumption. 2018-07-10 21:36:47 +02:00
Khan M Rashedun-Naby
0e5b97446a As SWITCH..CASE is better than ELSE..IF 2018-07-02 15:42:30 +06:00
Nicolás Venturo
172e208c6a Add TruthyAnd Peephole optimization 2018-06-15 11:27:39 -03:00
chriseth
fba7e055d9 Follow highest gas usage only for gas estimation. 2018-05-09 10:53:30 +02:00
chriseth
e681f4ee79
Merge pull request #4028 from ethereum/asm-tags-32bit
Restrict assembly tags to 32-bit
2018-05-02 17:34:13 +02:00
Alexander Arlt
f94b793472 Add virtual destructors on base classes. 2018-05-02 13:29:16 +02:00
Alex Beregszaszi
d569ad91e4 Restrict assembly tags to 32-bit 2018-04-30 18:47:57 +01:00
Alex Beregszaszi
3ac3018e1d Ensure that subId and tag handling is correct on all compilers in AssemblyItem 2018-04-30 15:57:17 +01:00
Omar Boukli-Hacene
090f9995f2 Fix comment typos 2018-04-27 19:31:30 +04:00
Alexander Arlt
70fcf1a8e0 CMake: remove direct jsoncpp dependency in libevmasm 2018-04-20 20:37:26 +01:00
Alex Beregszaszi
38460d8b47 Remove unnecessary masking of the result of known short instructions 2018-04-19 23:59:06 +01:00
Alex Beregszaszi
cb352edd26 Add constant optimiser for SHR/SHL instructions 2018-04-09 20:07:44 +01:00
Alex Beregszaszi
02ea0e547f Replace comparison operators with opposites if preceded by SWAP1 2018-04-04 17:47:58 +02:00
Alex Beregszaszi
17bcabb6cf Remove useless SWAP1 in front of commutative operations 2018-04-03 18:57:07 +02:00
chriseth
6777f7a57f Optimize across MLOAD if MSIZE is not used. 2018-04-03 14:34:32 +02:00
chriseth
6ec4517929 Use EVM version in gas meter and optimizer. 2018-03-05 11:36:33 +01:00
Alex Beregszaszi
afa4a48e37 Remove ROL/ROR as they are not part of EIP145 anymore 2018-02-27 13:42:41 +01:00
Alex Beregszaszi
59e6ea601b Add bitwise shift operators to libevmasm (EIP145) 2018-02-27 12:03:18 +01:00
Alex Beregszaszi
037b97ef4a Replace MOD with AND if constant is power of 2 2018-02-12 22:47:04 +00:00
chriseth
c961a3079d Turn simplification rule tuple into struct. 2018-02-06 22:51:30 +01:00
chriseth
65c31ecaeb Remove recursive call to simplify with reversed arguments.
(We now have explicit rules for that).
2018-02-06 22:51:30 +01:00
chriseth
295f8c07ad Explicitly add reversed operands for commutative operations. 2018-02-06 22:51:30 +01:00
chriseth
9eea3f29ba Expression simplifier. 2018-02-06 22:51:30 +01:00
chriseth
b8074cdf78 Add flag to indicate whether it can be applied to expressions with side-effects. 2018-02-06 22:51:30 +01:00
chriseth
491d6d3e0c Move out the rule list. 2018-02-06 22:51:30 +01:00
chriseth
6807010dc7 Prevent libraries from being called. 2018-01-19 16:27:44 +01:00
chriseth
95cf9266ab Movability. 2018-01-12 17:48:51 +01:00