Commit Graph

261 Commits

Author SHA1 Message Date
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
Isaac van Bakel
83f326525e Replaced solAssert in Jumpdest optimization
This is the only use of solAssert in libevmasm, and the only dependency
on libsolidity.
There is no justification for why the illegal state is checked here.
2017-11-25 21:51:27 +00:00
chriseth
7989fc4c35 Merge pull request #3077 from ethereum/optimze_pops
Assume peephole optimizer was successful if number of pops increased.
2017-10-16 22:11:45 +02:00
chriseth
f5e91e4a94 Throw on too many peephole optimizer iterations. 2017-10-16 18:45:21 +02:00
chriseth
082e7b6a9e Allow `gas` in view functions. 2017-10-16 13:28:44 +02:00
chriseth
7c94e5462a Assume peephole optimizer was successful if number of pops increased. 2017-10-13 19:00:56 +02:00
Alex Beregszaszi
4d1c48eeee Remove duplicate EVMSchedule 2017-10-03 11:59:53 +01:00
Alex Beregszaszi
43719839bf Use isDup/SwapInstruction helper 2017-10-03 11:45:44 +01:00
Alex Beregszaszi
8a32d7c3d7 Add helpers for isPush/isDup/isSwap 2017-10-02 10:34:54 +01:00
Paweł Bylica
ffd440ccff
CMake: Cleanup include paths 2017-09-26 22:44:57 +02:00
Alex Beregszaszi
aad829948a Ensure parameter names match between headers and implementation 2017-09-20 01:23:21 +01:00
chriseth
068a593d9c Merge pull request #2922 from ethereum/asm-bytes-required
Properly calculate bytesRequired for subs
2017-09-18 16:38:02 +02:00
Alex Beregszaszi
20ffa1db43 Properly calculate bytesRequired for subs 2017-09-18 11:39:49 +01:00
Alex Beregszaszi
f4b87548c8 Add useful messages to exceptions in the assembler 2017-09-18 11:32:56 +01:00
chriseth
73771f5bb2 Named assembly labels. 2017-09-15 20:44:49 +01:00
chriseth
3f3bcc4f8a Merge pull request #2848 from ethereum/checkViewPure
Enforce view and pure.
2017-09-13 18:29:13 +02:00
chriseth
66c01301fe Rename to invalidInPureFunctions 2017-09-13 17:18:22 +02:00
Alex Beregszaszi
bbfb16cf5c Introduce assemblyString 2017-09-11 15:53:20 +01:00
Alex Beregszaszi
50570c6c79 Do not return the stream in asssemblyStream 2017-09-11 15:48:58 +01:00
Alex Beregszaszi
a535a8b06e Split out the JSON functionality from assembly.stream() 2017-09-11 15:48:52 +01:00
Alex Beregszaszi
55d2a459a9 Mark functions static in libevmasm 2017-09-11 15:15:02 +01:00
chriseth
15bdc48a73 Rename and add anonymous namespace. 2017-09-06 13:52:29 +02:00
chriseth
d6861d909c Analyze assembly. 2017-09-06 13:52:29 +02:00
chriseth
7c61a6daf2 Add view/pure information about instructions. 2017-09-06 13:52:29 +02:00
chriseth
2d39a42d37 Merge pull request #2843 from ethereum/anonymous-cleanup
Move all file specific globals to anonymous namespace
2017-08-29 14:07:24 +02:00
Alex Beregszaszi
7fb4a64136 Move all file specific globals to anonymous namespace 2017-08-29 11:09:18 +01:00
gcolvin
7da86daa17 Reconcile EVM 1.5 instruction numbers with working draft EIP615 2017-08-28 23:27:13 +01:00
chriseth
6951a371ec Cleanup of vector_ref.h 2017-08-25 19:36:48 +02:00
chriseth
82e4f6f604 Cleanup of FixedHash.h 2017-08-25 16:05:28 +02:00
chriseth
4b0e30d259 Cleanup of Common.h 2017-08-25 14:54:23 +02:00
Alex Beregszaszi
70e89a5dac Introduce JumpdestRemover optimisation step 2017-08-25 10:42:36 +01:00
Alex Beregszaszi
3b07c4d38e Merge pull request #2757 from ethereum/cmake
Static linking
2017-08-23 12:36:24 +01:00
chriseth
c5f11d938f Merge pull request #2656 from ethereum/performance1
Avoid some Json copy operations.
2017-08-23 13:26:43 +02:00
Paweł Bylica
388fc983fa
CMake: Cleanup "local" include path 2017-08-22 22:50:25 +02:00
Alex Beregszaszi
f2d6226718 Some smaller issues found by Covertiy Scan 2017-08-22 13:55:28 +01:00
Alex Beregszaszi
f38429fef8 Switch stream properties back after temporary modification 2017-08-22 13:55:01 +01:00
Alex Beregszaszi
9897c56b2c Mark a lot of functions static (where possible) 2017-08-22 10:51:46 +01:00
Alex Beregszaszi
2a5772cff7 Mark appropriate constructors explicit 2017-08-22 10:51:46 +01:00
Alex Beregszaszi
e2cfc9ee92 Mark a lot of functions const (where possible) 2017-08-22 10:51:46 +01:00
chriseth
e3f90565d8 Avoid some Json copy operations. 2017-08-21 16:28:30 +01:00
Paweł Bylica
63372e4a85
CMake: Simplify libevmasm config 2017-08-18 13:32:35 +02:00
Paweł Bylica
d1f4d110fb
CMake: Build static libs by default 2017-08-18 13:32:35 +02:00
Alex Beregszaszi
f9d5f7e497 Introduce fine-grained optimiser settings in libevmasm 2017-07-27 12:40:28 +01:00
chriseth
09e821619e Refactor exceptions and provide comment function. 2017-07-13 11:34:03 +02:00
Alex Beregszaszi
32d6c1c316 MLOAD has side-effects, treat it like that in the optimiser 2017-06-30 21:27:39 +01:00
chriseth
168f64f4cb Fix negative stack size checks. 2017-06-28 16:55:49 +01:00
Alex Beregszaszi
becea47ac3 Use assertThrow where possible 2017-06-22 11:25:06 +01:00
Alex Beregszaszi
bc95da354d Replace obsolete assembly code in LLL 2017-06-21 21:23:39 +01:00
chriseth
57f79ebfa6 Remove debugbreak. 2017-06-20 19:21:29 +02:00
chriseth
fb5db94879 Merge pull request #2397 from ethereum/doublepush
Peephole optimizer for double push.
2017-06-15 10:50:07 +02:00