Commit Graph

97 Commits

Author SHA1 Message Date
Alex Beregszaszi
e82917d4e6 Add LLL error when assembly instruction causes stack underflow 2018-11-13 13:47:29 +01:00
Alex Beregszaszi
c320a650f9 LLL: terminate sequences with a STOP 2018-11-13 13:47:29 +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
liangdzou
24e5dcc352 fix code format problems 2018-09-19 00:18:49 +08:00
Alex Beregszaszi
9062704054
Merge pull request #4753 from mattaereal/boost-to-string-patch
Replace boost:lexical_cast<std::string> for std::to_string.
2018-08-08 16:07:25 +01:00
Matías Aereal Aeón
e902ce1aa0 Removing std:: from std::to_string and include for boost/lexical_cast 2018-08-08 11:26:30 -03: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
Alex Beregszaszi
7c509137cf Replace dev::eth namespace with dev::lll in LLL 2018-07-28 12:00:36 +01:00
chriseth
6ec4517929 Use EVM version in gas meter and optimizer. 2018-03-05 11:36:33 +01:00
Alex Beregszaszi
15517b571d lll: disallow useless PUSHn in assembly 2017-10-13 02:04:36 +01:00
Alex Beregszaszi
ab206b8113 LLL: do not crash if import callback is null 2017-10-03 10:22:30 +01:00
Alex Beregszaszi
26f3ea8cf7 LLL: change (include) to use a callback 2017-10-02 21:19:36 +01:00
Alex Beregszaszi
cbd4465a7f lll: do not expose push/dup/swap/jumpdest as functions 2017-10-02 16:21:21 +01:00
Alex Beregszaszi
6cbb726fb8 Merge pull request #2622 from benjaminion/lll-switch
LLL: Implement a "switch" expression
2017-10-02 13:38:21 +01:00
benjaminion
326c7887a4 LLL: Implement a switch expression. 2017-10-02 12:01:15 +01:00
Alex Beregszaszi
cddfec27ee lll: better error reporting in some cases 2017-10-02 11:48:26 +01:00
Alex Beregszaszi
bbfb16cf5c Introduce assemblyString 2017-09-11 15:53:20 +01:00
Alex Beregszaszi
a535a8b06e Split out the JSON functionality from assembly.stream() 2017-09-11 15:48:52 +01:00
Alex Beregszaszi
3b07c4d38e Merge pull request #2757 from ethereum/cmake
Static linking
2017-08-23 12:36:24 +01:00
Paweł Bylica
388fc983fa
CMake: Cleanup "local" include path 2017-08-22 22:50:25 +02:00
Alex Beregszaszi
9897c56b2c Mark a lot of functions static (where possible) 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
Paweł Bylica
99d198ffb0
CMake: Make libs dependencies explicit 2017-08-21 12:27:06 +02:00
Paweł Bylica
7337054d8e
CMake: Simplify liblll 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
d70974ea7c Merge pull request #2573 from benjaminion/lll-error-report-symbol
LLL: Improve error reporting in certain cases.
2017-07-20 11:02:31 +01:00
Yoichi Hirai
3ad326beba Merge pull request #2592 from ethereum/lll-simplify
LLL: remove useless code
2017-07-19 11:47:21 +02:00
Alex Beregszaszi
fa2781d6da LLL: remove useless code 2017-07-18 21:12:43 +01:00
Alex Beregszaszi
c880550fbc LLL: disable optimiser entirely if requested 2017-07-18 21:09:05 +01:00
benjaminion
4c0953385e LLL: Improve error reporting in certain cases. 2017-07-15 22:17:20 +01:00
benjaminion
3bc935d932 LLL: rewrite alloc to avoid issues with edge cases. 2017-07-11 21:22:38 +01:00
Alex Beregszaszi
dbbdcc66e6 LLL: fix redefinitions on some compilers 2017-06-24 12:59:30 +01:00
Alex Beregszaszi
b46bb70b96 LLL: remove obsolete header 2017-06-23 02:52:44 +01:00
Alex Beregszaszi
af57c083f2 LLL: fix the set keyword (create symbol if not present) 2017-06-23 02:52:44 +01:00
Alex Beregszaszi
1ffe286a81 LLL: report correct name if a symbol was not found 2017-06-22 23:00:22 +01:00
Alex Beregszaszi
581aace501 LLL: do not allow empty variable names 2017-06-22 23:00:22 +01:00
chriseth
0868a50eb1 Merge pull request #2440 from ethereum/lll-include
LLL: better error reporting in (include)
2017-06-22 17:18:34 +02:00
benjaminion
0175008ffa LLL: Fix msg macro with six arguments.
The previous macro used the set built-in in a way incompatible with the current
implementation of set. This commit updates the macro to be more transparent in how it's
working and avoids the use of the set and alloc built-ins.
2017-06-22 13:46:52 +01:00
chriseth
de7a488f82 Merge pull request #2415 from benjaminion/lll-fix-create-macro
LLL: Fix for edge case in the create macros.
2017-06-22 12:33:45 +02:00
chriseth
1c54ce2a2c Merge pull request #2399 from ethereum/lll-if
LLL: Replace obsolete assembly code
2017-06-22 12:22:28 +02:00
Alex Beregszaszi
a14a1254ca LLL: report errors if (include) failed 2017-06-22 10:56:58 +01:00
benjaminion
ff8de3e9fa LLL: Fix for edge case in the create macros.
When (msize) is initially zero the previous create commands failed due to the "lll"
expression overwriting the memory at 0x00. This fix "reserves" memory location 0x00
before calling msize. If msize is already 32 or greater it has no effect.
2017-06-22 09:44:34 +01:00
benjaminion
6cab6b6f49 LLL: Correctly label arguments to ecrecover built-in macro.
(r s v hash) -> (hash v r s) which corresponds to the order that the built-in EVM contract uses.
2017-06-21 23:32:47 +01:00
Alex Beregszaszi
bc95da354d Replace obsolete assembly code in LLL 2017-06-21 21:23:39 +01:00
Alex Beregszaszi
c08c4b8b6f Move subroutine helpers from CompilerContext to Assembly 2017-06-14 21:21:26 +01:00
Alex Beregszaszi
6a260a9ff1 Remove single use Assembly::popTo 2017-06-14 21:21:26 +01:00
Alex Beregszaszi
18fc667658 Remove obsolete Assembly::out 2017-06-14 21:21:26 +01:00
Alex Beregszaszi
600e3ad240 Support shl/shr in LLL 2017-06-14 14:08:28 +01:00
benjaminion
3299c479b6 LLL: fix handling of "sha3" expression
When PR #2317 changed the EVM opcode from SHA3 to KECCAK256 it broke the `(sha3 loc len)` expression in LLL. This PR fixes things while allowing existing code using the sha3 expression (such as the ENS registrar) to continue to compile.  I.e. both `(keccak256 loc len)` and `(sha3 loc len)` may be used, and the existing related sha3 macros continue to work.

Three end-to-end test cases have been added for kekkac256 and sha3.
2017-06-13 22:20:14 +01:00
benjaminion
c603369a51 Change opcode generated by (panic) to INVALID
EIP-141 ethereum/EIPs#141 has preserved 0xfe as an invalid opcode for aborting EVM execution. The EVM assembler supports this via the INVALID opcode.

The LLL "panic" expression used to generate a jump to an invalid location in order to abort EVM execution.  This change brings "panic" into line with EIP-141 by generating the INVALID opcode instead.
2017-06-13 17:01:38 +01:00