Commit Graph

1182 Commits

Author SHA1 Message Date
chriseth
ef3d5874fe Remove error reporter from code generation phase. 2017-06-08 15:52:45 +02:00
chriseth
19f707aeaa Some more comments. 2017-06-08 15:52:45 +02:00
chriseth
0185f3cbf6 Correct stack height adjustment after returnsub. 2017-06-08 15:52:45 +02:00
chriseth
ba5ee71b7f Generate only single error in inline assembly. 2017-06-08 15:52:45 +02:00
chriseth
fefd3b866d Introduce machine-dependent stack adjustment. 2017-06-08 15:52:45 +02:00
chriseth
97cc968a13 Initial EVM1.5 assembly implementation. 2017-06-08 15:52:44 +02:00
Alex Beregszaszi
aa310f9fec Refactor AssemblyStack 2017-06-07 14:42:22 +01:00
Alex Beregszaszi
502304f30b Add analyze(block) to AssemblyStack 2017-06-07 14:42:22 +01:00
Alex Beregszaszi
937c208320 Reset error list in parseAndAnalyze 2017-06-07 14:41:44 +01:00
chriseth
1fba984966 Merge pull request #2332 from ethereum/fixLiteralPrint
fix Literalprint
2017-06-06 15:09:48 +02:00
djudjuu
62eafdd010 adjusted testcase and renaming 2017-06-06 13:26:23 +02:00
chriseth
b4ae188a0f Merge pull request #2336 from ethereum/expectExpression
Refactor to use expectExpression in analyzer.
2017-06-01 15:57:28 +02:00
chriseth
d5408f78ad Add comma. 2017-06-01 15:56:49 +02:00
chriseth
40f3e4413b Improved error message. 2017-06-01 15:31:07 +02:00
Alex Beregszaszi
998ca552b8 Fix state after CompilerStack.reset() 2017-06-01 13:44:08 +01:00
chriseth
05004253ba Refactor to use expectExpression in analyzer. 2017-06-01 14:28:39 +02:00
Alex Beregszaszi
c212d7c2e6 Remove unused functions from CompilerStack 2017-06-01 13:28:05 +01:00
djudjuu
597bf8a43d fix Literalprint 2017-05-30 19:53:32 +02:00
chriseth
d4a57d81ba Merge pull request #2317 from ethereum/keccak256
Use keccak256 in tests and replace the SHA3 instruction in assembly
2017-05-30 19:34:28 +02:00
djudjuu
2e7190534b documentation field added to ContractDefinition-Node 2017-05-30 18:52:43 +02:00
Rhett Aultman
89b60ffbd4 Refactor error reporting
This commit introduces ErrorReporter, a utility class which consolidates
all of the error logging functionality into a common set of functions.
It also replaces all direct interactions with an ErrorList with calls to
an ErrorReporter.

This commit resolves issue #2209
2017-05-30 07:28:31 -07:00
Alex Beregszaszi
75e4a2be1b Alias sha3 to keccak256 in inline assembly 2017-05-30 10:54:29 +01:00
Alex Beregszaszi
0c8beac357 Rename the SHA3 assembly instruction to KECCAK256 2017-05-30 10:54:29 +01:00
chriseth
8b29cc5535 Merge pull request #2319 from ethereum/virtualBlocks
Introduce virtual blocks for function arguments.
2017-05-29 16:52:51 +02:00
chriseth
4af55c78eb Introduce virtual blocks for function arguments. 2017-05-29 16:18:16 +02:00
chriseth
9adff68ecc Introduce LabelID typedef. 2017-05-29 15:40:32 +02:00
chriseth
2c4a107f43 Merge pull request #2311 from ethereum/julia-types
Validate types for Julia (part 1)
2017-05-29 14:12:38 +02:00
Alex Beregszaszi
751c97ca19 Pull out common code to a helper 2017-05-26 21:40:14 +01:00
Alex Beregszaszi
48f58aa3f9 Remove duplicate code 2017-05-26 21:02:31 +01:00
Alex Beregszaszi
9337003d5e Use the new ParserBase API in AsmParser 2017-05-26 20:44:34 +01:00
Alex Beregszaszi
3459052ae8 Add scanner helpers to ParserBase 2017-05-26 20:44:34 +01:00
Alex Beregszaszi
2fefe3b549 Move Solidity specific methods from ParserBase to the Solidity Parser 2017-05-26 20:44:34 +01:00
Alex Beregszaszi
2a50e869d0 Move builtin type list to the top 2017-05-26 20:43:28 +01:00
Alex Beregszaszi
efadf7e41f Change error message for invalid type 2017-05-26 20:42:17 +01:00
Alex Beregszaszi
8fe79fe706 Introduce Julia mode in AsmAnalyzer 2017-05-26 20:39:30 +01:00
Alex Beregszaszi
3b75c5b45f Validate that only basic types are used in Julia 2017-05-26 20:39:10 +01:00
Alex Beregszaszi
dda497ca02 Move constructor to AsmAnalyzer header 2017-05-26 20:39:10 +01:00
chriseth
fe32531a16 More comments for assembly 2017-05-26 15:08:27 +02:00
chriseth
261731f7ee Adapt EVM codegen to new namespace. 2017-05-26 15:08:27 +02:00
chriseth
71b923cc36 Move EVM codegen to libjulia. 2017-05-26 15:03:30 +02:00
chriseth
eaa13d42a0 Support multiple assembly front and backends. 2017-05-26 15:03:29 +02:00
chriseth
68e1e464be Merge pull request #2316 from ethereum/inlineasm-cleanup
Better error message for elementary operations
2017-05-26 11:29:51 +02:00
chriseth
ec676ba9f2 Merge pull request #2224 from ethereum/julia-switch
Implement switch statement in the assembly parser/printer
2017-05-26 11:24:38 +02:00
chriseth
40d5d5a956 Also change error message. 2017-05-26 11:13:32 +02:00
Alex Beregszaszi
e410cec19a Better error message for elementary operations 2017-05-26 09:41:53 +01:00
Alex Beregszaszi
05fcf1989c Better error messages for invalid switch cases 2017-05-26 03:20:34 +01:00
Alex Beregszaszi
c64bd33784 Disallow instructions as a switch expression 2017-05-26 03:20:34 +01:00
Alex Beregszaszi
d745dd6542 Visit case bodies in scope filler 2017-05-26 03:20:34 +01:00
Alex Beregszaszi
ba8a79c600 Do not stop on first switch error 2017-05-26 03:20:31 +01:00
Alex Beregszaszi
e48e84ca2b Check token within parseCase 2017-05-26 03:20:15 +01:00
Alex Beregszaszi
db3d9e0416 Switch cases are not followed by colon 2017-05-26 03:20:15 +01:00
Alex Beregszaszi
66eab1caf6 Change switch case string to Literal 2017-05-26 03:20:10 +01:00
Alex Beregszaszi
b5080860d5 Implement switch statement in the assembly parser/printer 2017-05-26 03:16:09 +01:00
Alex Beregszaszi
8c3ec16132 Scanner requires only the SourcesSet state 2017-05-24 22:45:10 +01:00
Alex Beregszaszi
338202ea96 Uniform error messages 2017-05-24 13:35:52 +01:00
Alex Beregszaszi
56fe3a6ab9 Better error messages during parsing functional instructions 2017-05-24 13:35:52 +01:00
chriseth
451acd4c9f Merge pull request #2301 from ethereum/ASTFunctionTypeFix
insert ParameterList-node in FunctionType-json
2017-05-24 14:28:07 +02:00
chriseth
6873c936ed Merge pull request #2294 from ethereum/inlineasm
Fix scope assert in AsmAnalyzer
2017-05-24 14:19:08 +02:00
chriseth
e980812fab Merge pull request #2289 from ethereum/astjson-fix
Fix AST JSON converter type lookup
2017-05-24 13:55:56 +02:00
djudjuu
26abd61d9b insert ParameterList-node in FunctionType-json 2017-05-24 13:52:16 +02:00
Alex Beregszaszi
74d41ad25f Fix scope assert in AsmAnalyzer 2017-05-24 11:58:49 +01:00
Alex Beregszaszi
b77b11781d Rename parseFunctionalInstruction to parseCall 2017-05-24 01:48:54 +01:00
Alex Beregszaszi
4f738ff1c0 Reorder AsmData for readability 2017-05-24 01:48:54 +01:00
Alex Beregszaszi
187fa50751 Rename FunctionalAssignment to Assignment 2017-05-24 01:48:53 +01:00
Alex Beregszaszi
f15d6ea45f Rename Assignment to StackAssignment 2017-05-24 01:07:07 +01:00
Alex Beregszaszi
604d254e8c Fix AST JSON converter type lookup 2017-05-23 23:12:40 +01:00
Alex Beregszaszi
e9b106cd0e Merge pull request #2292 from roadriverrail/inline_asm_unused_warning
Drop the inline asm includes from StaticAnalyzer
2017-05-23 23:11:03 +01:00
Rhett Aultman
f735207732 Drop the inline asm includes from StaticAnalyzer 2017-05-23 06:38:17 -07:00
Alex Beregszaszi
3451a30e5c Display actual error message and not assertion in analysis 2017-05-22 18:45:34 +01:00
Alex Beregszaszi
cb4966046d Enable a single right hand item on let 2017-05-22 18:45:34 +01:00
Alex Beregszaszi
15b4d4def2 Support multiple variables in a variable declaration in inline assembly 2017-05-22 18:45:34 +01:00
chriseth
74d2e7311a Merge pull request #2265 from roadriverrail/inline_asm_unused_warning
Analyze InlineAssembly for variable use
2017-05-22 16:34:29 +02:00
chriseth
8eead553af Merge pull request #1810 from ethereum/compactJson
Compact format for AST-Json.
2017-05-22 14:33:46 +02:00
djudjuu
e82df073d1 minor fixes and changelog update 2017-05-22 12:25:50 +02:00
Rhett Aultman
621c3fa22f Analyze InlineAssembly for variable use
The unused variable checker in StaticAnalyzer did not conssider
InlineAssembly objects.  This commit introduces that missing feature.
2017-05-21 15:23:05 -07:00
chriseth
7f5601fd4b Add const 2017-05-19 20:15:28 +02:00
chriseth
69413ae32a Review changes. 2017-05-19 20:12:12 +02:00
chriseth
e2b21e1c96 Refactor to abstract assembly to JULIA. 2017-05-19 19:20:28 +02:00
chriseth
56424bb202 Merge pull request #2262 from ethereum/interface-cleanup
Cleanup the external interfaces (ABI and Natspec)
2017-05-19 17:55:33 +02:00
Alex Beregszaszi
cd5d93da2a Rename CompilerStack.metadata to CompilerStack.natspec 2017-05-19 16:11:04 +01:00
Alex Beregszaszi
81877cc594 Rename InterfaceHandler to Natspec 2017-05-19 16:11:04 +01:00
Alex Beregszaszi
12328b7848 Split ABI out of InterfaceHandler 2017-05-19 16:11:03 +01:00
Alex Beregszaszi
4bf3cbb09a Use CompilerStack.contractABI directly 2017-05-19 15:57:36 +01:00
Alex Beregszaszi
8169e149c9 Rename CompilerStack.interface to CompilerStack.contractABI 2017-05-19 15:57:36 +01:00
djudjuu
1d22233a43 refactoring functionCallAnnotation 2017-05-19 15:48:07 +02:00
Alex Beregszaszi
ebcb27e5c1 Accept bool as a type in Julia mode 2017-05-19 09:44:16 +01:00
Alex Beregszaszi
edd0afa3c3 Support true/false literals in inline assembly 2017-05-19 09:44:16 +01:00
djudjuu
6316a76ab9 testsuite adjustment 2017-05-19 09:51:23 +02:00
djudjuu
e3583d04f7 include new InlineAssemblyInformation into JSON 2017-05-17 15:58:28 +02:00
djuju
a4ba5ace8a prefixChanges and contractKind-field 2017-05-17 11:14:33 +02:00
djuju
2fa7646944 fixed styletypos, renaming and added helperfunction 2017-05-17 11:14:33 +02:00
Alex Beregszaszi
487eef18cc Use different AST node names in legacy and new format 2017-05-17 11:14:33 +02:00
Alex Beregszaszi
f2a6331ffb Support the new AST in StandardCompiler 2017-05-17 11:14:33 +02:00
chriseth
dea7b864e6 Compact format for AST-Json with backwards compatibility 2017-05-17 11:14:33 +02:00
chriseth
d9b5ff0b43 Merge pull request #2222 from ethereum/julia-types
Add support for types in Julia
2017-05-16 16:59:15 +02:00
Alex Beregszaszi
c0f31e4c1b Ensure proper checks are in CompilerStack 2017-05-11 08:02:03 +01:00
Alex Beregszaszi
5b4b620d8b Do not crash on AST if parsing failed 2017-05-11 08:02:03 +01:00
Erik Quenon Steggall
0489c99870 Added change to make compile happy on MacOS 10.9.5 2017-05-05 16:49:09 -07:00
Alex Beregszaszi
8688b63fa6 Use boost range adaptors in AsmPrinter 2017-05-05 22:31:22 +01:00
Alex Beregszaszi
d6396ee85f Parse types in Julia mode 2017-05-05 22:31:22 +01:00
Alex Beregszaszi
07176e82de Assert that invalid AST elements are not printed in Julia mode 2017-05-05 14:21:25 +01:00
Alex Beregszaszi
c423e140ee Add flag for JULIA printing 2017-05-05 14:21:25 +01:00
Alex Beregszaszi
804971973d Show better error message for Julia mode 2017-05-05 14:21:25 +01:00
Alex Beregszaszi
f1f209db40 Do not allow literal pushes in Julia 2017-05-05 14:21:25 +01:00
Alex Beregszaszi
d61f9c4d4e Disable labels in Julia 2017-05-05 14:21:25 +01:00
chriseth
0582fcb93b Merge pull request #2194 from ethereum/removeerrorlabel
Remove error label / invalid jump label.
2017-05-05 14:25:43 +02:00
chriseth
230f51efb7 Cleanup, style and additional test. 2017-05-03 11:26:21 +02:00
chriseth
e0266b79f3 Refactor: Combine bool and function pointer. 2017-05-03 11:26:21 +02:00
Rhett Aultman
a6faa5acf3 Treat returns with expressions as return param use
There are many cases of code where the return parameters exist mostly
as a form of documentation.  This change ensures that they do not have
to be used in the function body so long as there is a return supplying
values
2017-05-03 11:26:21 +02:00
Rhett Aultman
a40c8cfb68 Warn on unused local variables
Analyze functions for all local variables, parameters, and named
return variables which are never used in the function, and issue
a warning.
2017-05-03 11:26:21 +02:00
Alex Beregszaszi
c09f071ff6 Merge pull request #2211 from ethereum/jsonio-fixes
Follow the JSON I/O spec closely
2017-05-02 16:47:14 +01:00
Alex Beregszaszi
ed3ab3506a Follow the JSON I/O spec closely 2017-05-02 16:52:38 +02:00
chriseth
acab525fef Merge pull request #2199 from roadriverrail/no_unary_plus
Deprecate use of unary '+'
2017-05-02 16:43:47 +02:00
Alex Beregszaszi
2871663cad Remove why3 from standard compiler 2017-05-02 14:49:13 +01:00
chriseth
96870686a9 Style and stricter tests. 2017-05-02 15:48:58 +02:00
chriseth
f42a9a9408 Merge pull request #2198 from ethereum/conditionalCompilerStateReset
conditional reset of compilerState-Enum
2017-05-02 15:17:10 +02:00
chriseth
2891b98882 Merge pull request #2110 from federicobond/fix-posttypechecker
Fix PostTypeChecker retaining state across contracts
2017-05-02 12:12:46 +02:00
Rhett Aultman
e544698ad3 Deprecate use of unary '+'
The unary '+' serves no meaningful purpose in Solidity and it makes it
possible to produce typos with dagerous implications (e.g. 'a =+5 '),
so we are deprecating it.  The SyntaxChecker currently issues warnings
on the unary '+' but will still compile it for now.
2017-04-28 17:43:19 -07:00
djuju
e9954eb325 conditional reset of compilerState-Enum 2017-04-28 18:46:27 +02:00
chriseth
f33614e1f7 Merge pull request #2171 from ethereum/splitParseAndAnalyze
refactoring parse() into two separate functions
2017-04-28 17:19:31 +02:00
djuju
a6306a1d44 error fixed 2017-04-28 16:20:32 +02:00
djuju
45f8c5aa88 enumchecks not working 2017-04-28 15:24:59 +02:00
chriseth
28f10f4783 Remove error label / invalid jump label. 2017-04-28 13:14:52 +02:00
chriseth
f9bccab7b7 Merge pull request #2193 from ethereum/julia-assign-stack
Disallow assign from stack in Julia (=: var)
2017-04-27 22:00:33 +02:00
chriseth
6776be33a8 Merge pull request #2189 from ethereum/julia-instructions
Do not disallow EVM instructions as identifiers in Julia
2017-04-27 21:58:45 +02:00
Alex Beregszaszi
20206a04dd Disallow assign from stack in Julia (=: var) 2017-04-27 19:20:53 +01:00
Alex Beregszaszi
8020144d06 Do not validate identifiers against EVM instructions in JULIA 2017-04-27 18:16:42 +01:00
Alex Beregszaszi
01b60a4f8d Add flag for JULIA parsing 2017-04-27 18:16:42 +01:00
Alex Beregszaszi
b0485e327b Make assembler errors fatal 2017-04-27 16:34:57 +01:00
Alex Beregszaszi
16276ab10b Catch assembler exceptions and throw readable Solidity exceptions 2017-04-27 16:06:49 +01:00
Alex Beregszaszi
8b79517d47 Do not validate identifiers against EVM instructions in JULIA 2017-04-27 14:12:48 +01:00
Alex Beregszaszi
b48bc81d40 Add flag for JULIA parsing 2017-04-27 14:12:43 +01:00
djuju
5fd7942173 documentation, checks and renaming 2017-04-27 12:56:56 +02:00
djuju
99a7aefb75 refactoring parse() into two separate functions 2017-04-27 12:38:24 +02:00
Alex Beregszaszi
35f1cf92db Remove parentheses from around function return parameters 2017-04-27 10:08:02 +01:00
chriseth
d7b3ce24a4 Check stack height during code generation. 2017-04-26 17:12:04 +02:00
chriseth
f3ec2ba39e Refactor to combined scope and stack height info. 2017-04-26 17:12:04 +02:00
chriseth
68218387cf Store stack height in analysis phase. 2017-04-26 12:34:24 +02:00
chriseth
1d712c7d64 Fix storage access tests. 2017-04-25 16:49:04 +02:00
chriseth
e841b23bfd Special case for storage types with offset zero. 2017-04-25 16:49:04 +02:00
chriseth
3df7b06464 Pass internal resolver to assembly analyzer. 2017-04-25 16:49:04 +02:00
chriseth
0ebaf220b5 Fix refactoring error. 2017-04-25 16:49:04 +02:00
chriseth
978884d9ca Build fix. 2017-04-25 16:49:04 +02:00
chriseth
478f2997ea Storage access from inline assembly. 2017-04-25 16:49:04 +02:00
chriseth
5f4b68e211 Another stack check. 2017-04-25 16:49:04 +02:00
chriseth
dfb7d5ebd9 Move analysis out of code generator. 2017-04-25 16:49:04 +02:00
chriseth
dfaab73efe Only allow access to local variables and only if they have a stack size of one. 2017-04-25 16:49:04 +02:00
chriseth
f19e6a09a7 Check again that instruction argument count is correct. 2017-04-25 16:49:03 +02:00
chriseth
b622c2e9d3 Only run stack filler on AST elements that are or contain declarations. 2017-04-25 16:49:03 +02:00
chriseth
34717838da Review comments. 2017-04-25 16:49:03 +02:00