Commit Graph

958 Commits

Author SHA1 Message Date
Daniel Kirchner
90b66a7362 Fix struct member access for memory and implement for calldata. 2020-06-10 20:01:30 +02:00
Djordje Mijovic
c6e4943089 Adding fixes for signedness warnings in libsolidity
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2020-06-10 10:41:55 +02:00
chriseth
2724ce9511 Index access to fixed bytes and byte arrays. 2020-06-09 10:50:28 +02:00
chriseth
e7f3c042b6 Struct member access for storage and memory. 2020-06-03 10:37:39 +02:00
chriseth
37e8d78cff [Sol->Yul] Implement getters. 2020-06-03 10:33:37 +02:00
chriseth
eb923af09c Do not set source locations for small internal assembly routines. 2020-05-27 18:26:46 +02:00
chriseth
0aa3fb5026
Merge pull request #9014 from ethereum/sol-yul-abidecode
[Sol - Yul] Add support for ABIDecode.
2020-05-27 11:44:13 +02:00
chriseth
f066050ec0 Merge pull request #9024 from ethereum/namableTypes
Disallow non-namable types for inline arrays.
2020-05-27 09:21:07 +02:00
Kamil Śliwak
f574d8ec3a Don't assume that an expression cannot be associated with a function declaration 2020-05-27 00:05:18 +02:00
Alexander Arlt
118cb13476 [Sol - Yul] Add support for ABIDecode. 2020-05-26 13:30:37 -05:00
chriseth
309f0fbc8a Unimplemented assert for conversion from calldata slices to memory. 2020-05-26 18:17:36 +02:00
Kamil Śliwak
1a2e441bc5 Generate internal dispatch only for functions that might actually get called via pointers
- This also adds support for internal library calls as a side-effect since they'll now be pulled into the internal dispatch automatically.
2020-05-26 17:01:50 +02:00
Kamil Śliwak
2716b5ff83 Replace conditionally empty whiskers variables for punctuation with <?+> syntax in IRGenerator::generateInternalDispatchFunctions() 2020-05-26 16:33:40 +02:00
chriseth
e6b399c86e
Merge pull request #8942 from ethereum/calldataVariables
Calldata variables.
2020-05-26 11:34:40 +02:00
chriseth
499cb0526f Calldata variables. 2020-05-26 10:51:13 +02:00
chriseth
76d27bcfaa Fix assumption for member not in memory. 2020-05-26 10:35:04 +02:00
chriseth
6d64095ccf
Merge pull request #8987 from ethereum/sol-yul-bound-functions
[Sol->Yul] Bound functions
2020-05-25 16:53:33 +02:00
chriseth
44e62c1fae
Merge pull request #8997 from ethereum/sol-yul-refactor-no-internal-functions-with-arbitrary-parameters
[Sol->Yul] Remove unnecessary code for handling internal functions with arbitrary parameters (refactor)
2020-05-25 16:47:10 +02:00
chriseth
042dc965fa
Merge pull request #8952 from ethereum/sol-yul-refactor-simplify-end-visit-for-internal-calls
[Sol->Yul] Simplify end visit for internal calls (refactor)
2020-05-25 16:46:36 +02:00
Mathias Baumann
d45bb2aa07 Add proper unipmlemented errors for array copying 2020-05-25 10:48:42 +02:00
a3d4
a499ef16fa Fix spelling errors 2020-05-25 02:54:37 +02:00
Kamil Śliwak
4a2ce57bed Add support for bound function calls in IR generator 2020-05-20 21:10:20 +02:00
Kamil Śliwak
a68b4ab7ed IRGeneratorForStatements: Slightly reorganize local variables in endVisit(MemberAccess)
- Add memberFunctionType accessible in the whole function to avoid declaring it multiple times
- Add objectCategory
2020-05-20 21:09:27 +02:00
Kamil Śliwak
87c598863f IRGeneratorForStatements: Remove unnecessary code for handling internal functions with arbitrary parameters
- Internal functions cannot have arbitrary parameters
2020-05-20 21:08:59 +02:00
Kamil Śliwak
0943333276 Simplify endVisit() for internal calls
- Define IRHelpers::referencedFunctionDeclaration() to avoid repeating the same dynamic_casts over and over again.
2020-05-20 21:07:37 +02:00
Kamil Śliwak
6c6a8a74e8 IRGenerationContext: Extract code for enumerating dispatchable functions from generateInternalDispatch() into a separate function 2020-05-20 13:16:08 +02:00
Kamil Śliwak
bd75543900 Add IRNames::internalDispatch() and use it in IRGenerationContext 2020-05-20 12:48:49 +02:00
Kamil Śliwak
22c0568d34 IRGenerationContext::internalDispatch(): Remove unused local YulUtilFunctions instance 2020-05-20 12:46:32 +02:00
Kamil Śliwak
7d2292fbaf Rename IRGenerationContext::internalDispatch() to generateInternalDispatchFunction() 2020-05-20 12:46:31 +02:00
Kamil Śliwak
1a521cc7ac Use YulArity in IR generator 2020-05-19 23:03:21 +02:00
Kamil Śliwak
16e58449ab ir/Common: Add YulArity struct 2020-05-19 23:03:15 +02:00
Kamil Śliwak
b0ae85b6b0 IRGenerationContext::internalDispatch(): Don't use asCallableFunction() to get internal function type 2020-05-19 18:00:50 +02:00
Djordje Mijovic
d235d0c166 [Sol->Yul] Implementing Byte array push() and pop() 2020-05-19 14:47:00 +02:00
Kamil Śliwak
465e4d4088 Extract more functions for generating function and variable names into IRNames 2020-05-15 14:51:00 +02:00
Kamil Śliwak
7af7273b60 Move static functions for constructing names from IRGenerationContext into the new Common module 2020-05-14 19:48:00 +02:00
chriseth
7ef114db9a
Merge pull request #8841 from ethereum/sol_yul_ripemd160_ecrecover
[Sol - Yul] Add support for ripemd160 & ecrecover.
2020-05-14 18:43:55 +02:00
Alexander Arlt
91e9d54c71 [Sol - Yul] Add support for ripemd160 & ecrecover. 2020-05-14 10:44:39 -05:00
Djordje Mijovic
472fb21ee0 [Sol->Yul] Enabling new bytes(n) 2020-05-14 12:55:14 +02:00
Daniel Kirchner
97296d8622 Allow ABI encoding for array slices without explicit casts. 2020-05-13 18:20:07 +02:00
Daniel Kirchner
6f04664cfa Disallow array slicing for arrays with dyanmically encoded base types. 2020-05-13 15:52:22 +02:00
Daniel Kirchner
c2f5a66a79 Implement .creationCode for Sol->Yul. 2020-05-11 18:51:51 +02:00
Daniel Kirchner
3fbde6e782
Merge pull request #8856 from ethereum/implicitConstructorCallvalueCheck
Implicit constructor callvalue check
2020-05-11 18:50:36 +02:00
Daniel Kirchner
79b217dfb3 Callvalue checks for implicit constructors. 2020-05-11 16:14:34 +02:00
chriseth
f1e0aa7a56
Merge pull request #8763 from ethereum/bareCall
IR code generation for call.
2020-05-11 16:06:54 +02:00
chriseth
e2f7e8a3a7
Merge pull request #8890 from ethereum/fixclangv10
Fix clang v10 compilation errors
2020-05-11 15:39:09 +02:00
chriseth
c0bf529236 Support bare calls. 2020-05-11 15:11:46 +02:00
chriseth
0248303c15
Merge pull request #8872 from ethereum/int-min-max
implemented type(X).min and type(X).max for all integer types
2020-05-11 15:08:19 +02:00
Mathias Baumann
fe43132003 Fix clang v10 compilation errors 2020-05-11 14:59:51 +02:00
Harikrishnan Mulackal
e54c4eecfc implemented type(X).min and type(X).max for all integer types 2020-05-11 14:51:13 +05:30
chriseth
a0e291bd06 Implement Yul IR generation for abi.encode* 2020-05-07 19:39:15 +02:00
chriseth
d0b82fe854
Merge pull request #8869 from ethereum/useSlotes
Use vector of slots.
2020-05-07 19:03:59 +02:00
chriseth
75ca072ae6 Assertion about getters for non-value type immutables. 2020-05-07 18:18:40 +02:00
chriseth
f38cf85482 Use vector of slots. 2020-05-07 17:54:04 +02:00
Mathias Baumann
eb4926cb48 run addMissingFunctions only once 2020-05-07 17:06:11 +02:00
chriseth
f42dc70c9f
Merge pull request #8863 from ethereum/nonReversedEncoder
Introduce non-reversed version of tupleEncoder.
2020-05-07 15:47:32 +02:00
chriseth
e986fde0c1 Introduce non-reversed version of tupleEncoder. 2020-05-07 15:08:09 +02:00
chriseth
6fb112fa8e Remove some unneeded headers. 2020-05-07 01:49:46 +02:00
Alex Beregszaszi
327c75bc1b IR generation for shifts 2020-05-06 19:14:23 +02:00
chriseth
76275cf34a
Merge pull request #8824 from ethereum/solYulDirtyMemory
Fix accessing memory reference types in yul codegen and clean up on memory reads.
2020-05-06 16:17:19 +02:00
Daniel Kirchner
234ffcf278
Merge pull request #8718 from ethereum/irConstants
IR generation for constants.
2020-05-06 16:05:17 +02:00
Daniel Kirchner
c25a3eba14 Fix accessing memory reference types in yul codegen and clean up on memory reads. 2020-05-06 11:34:11 +02:00
chriseth
02c20698c9 IR generation for constants. 2020-05-05 17:07:55 +02:00
Daniel Kirchner
4d739b16a4 Cleanup function for internal function pointers. 2020-05-05 13:07:10 +02:00
Daniel Kirchner
7ad319687d Sol->Yul: Add cleanup to operations. 2020-05-05 13:06:01 +02:00
Djordje Mijovic
e8f6f63e77 [Sol2Yul] Adding support for builtin revert(string) 2020-05-05 07:05:39 +02:00
Djordje Mijovic
cf607aa887 [Sol->Yul] Checking if there is base contract when calling base constructror via modifier invocation. 2020-05-04 20:38:22 +02:00
chriseth
1aef9c7d20
Merge pull request #8777 from ethereum/sol_yul_simplefunctions
[Sol - Yul] Add some built-in functions.
2020-05-04 16:07:10 +02:00
chriseth
51ccb1519f Yul codegen for immutables. 2020-05-04 15:00:50 +02:00
Alexander Arlt
a9f4d14010 [Sol - Yul] Add support for send(..) & transfer(..) 2020-05-01 08:32:51 -05:00
Alexander Arlt
151e637336 [Sol - Yul] Add some built-in functions.
- simplifications for GasLeft, Selfdestruct and BlockHash.
- add support for addmod & mulmod.
2020-04-30 14:10:09 -05:00
Jason Cobb
8973732b74
Compare categories instead of types in ContractCompiler(740) 2020-04-28 13:13:45 -04:00
Djordje Mijovic
f3f729549d [Sol->Yul] Enabling creation function call 2020-04-27 16:15:57 +02:00
Alex Beregszaszi
99aa821410
Merge pull request #8720 from ethereum/irSha256
IR generation for sha256.
2020-04-27 13:44:26 +01:00
Alex Beregszaszi
aa0a69b47f IRGenerator: include assertion for FunctionType::Kind::Declaration 2020-04-27 12:03:44 +01:00
chriseth
dda883b585 IR generation for sha256. 2020-04-27 11:10:20 +02:00
chriseth
61b1369fc2
Merge pull request #8701 from ethereum/solc-yul-chromosome
solc option for selecting yul optimisations
2020-04-27 10:44:14 +02:00
Alexander Arlt
66edaf43f4 [Sol - Yul] Add support for built-in logN(). 2020-04-25 11:10:28 -05:00
Alexander Arlt
2fa26f4e92 [Sol - Yul] Add support for built-in selfdestruct(..). 2020-04-24 17:03:41 -05:00
Kamil Śliwak
c41a832f65 Move the default optimisation steps from OptimiserSuite to OptimiserSettings
- Now it's a mandatory parameter in OptimiserSuite::run()
2020-04-24 17:30:56 +02:00
Kamil Śliwak
d3da878200 Enable internal library calls 2020-04-24 15:00:51 +02:00
Kamil Śliwak
64bce597a1 IRGenerator: Enable code generation for libraries 2020-04-24 15:00:17 +02:00
Kamil Śliwak
56a85d6cb3 IRGeneratorForStatements: Handle internal calls to functions from specific base contracts as static calls rather than calls via pointers 2020-04-24 15:00:16 +02:00
Kamil Śliwak
397ea18b78 IRVariable: Fix improperly wrapped docstring 2020-04-24 15:00:16 +02:00
chriseth
2b39f3b988
Merge pull request #8766 from ethereum/sol_yul_gasleft
[Sol - Yul] Add support for built-in gasleft().
2020-04-24 14:24:01 +02:00
Alexander Arlt
aafa4583df [Sol - Yul] Add support for built-in gasleft(). 2020-04-23 17:14:03 -05:00
Kamil Śliwak
e65a5a562e IRGenerationContext::internalDispatch(): Fix code generated when the function called via pointer does not return anything 2020-04-23 21:16:41 +02:00
chriseth
16ed53ddd0
Merge pull request #8591 from mijovic/sol2YulConstructorParams
[Sol2Yul] Adding support for constructors with parameters (inheritance)
2020-04-23 12:56:54 +02:00
chriseth
edef6a0edd
Merge pull request #8757 from ethereum/removeMove
Remove unnecessary move.
2020-04-23 12:28:33 +02:00
chriseth
a371910674
Merge pull request #8642 from ethereum/interfaceid
Add support for interfaceId.
2020-04-23 12:24:49 +02:00
chriseth
b864fe1c43 Remove unnecessary move. 2020-04-23 12:13:26 +02:00
Djordje Mijovic
5329da93fb [Sol2Yul] Adding support for constructors with parameters in case of inheritance 2020-04-22 14:47:08 +02:00
chriseth
4908101ad7 Yul IR generation for member access to type types. 2020-04-22 11:25:27 +02:00
chriseth
1d8e742296
Merge pull request #8684 from ethereum/yulForSelector
Yul codegen for `.selector`.
2020-04-20 16:32:11 +02:00
chriseth
55483445e9
Merge pull request #8663 from ethereum/ir-function-generation-queue
[Sol->Yul] IR function generation queue (refactor)
2020-04-20 15:17:53 +02:00
hrkrshnn
4760b8589d Replaced all instances of lValueRequested to willBeWrittenTo 2020-04-20 12:33:30 +05:30
Kamil Śliwak
c7947c1af6 Implement lazy function generation using function generation queue 2020-04-17 13:28:07 +02:00
Kamil Śliwak
1f28f79ae6 IRGenerator::generate(): Remove duplicate call to setMostDerivedContract()
- The same call happens in resetContext(_contract) called immediately before
2020-04-17 13:28:07 +02:00
Alexander Arlt
3754a86ab2 Add support for interfaceID. 2020-04-16 12:17:40 -05:00
chriseth
f271dfa2e2 Yul codegen for .selector. 2020-04-16 13:42:58 +02:00
chriseth
06adbc2c59 Implement bit operations. 2020-04-16 00:33:45 +02:00
Daniel Kirchner
0c5c93f3c2 Fix tuple assignments for empty tuples in Yul IR. 2020-04-15 11:10:52 +02:00
Christian Parpart
d00d3c45b1 [Sol2Yul] Implements codegen part for try/catch statements. 2020-04-14 18:42:37 +02:00
a3d4
aba0b2957c Fix tuple assignments with multi-slot components. 2020-04-07 18:39:25 +02:00
chriseth
823a119117
Merge pull request #8570 from aarlt/clang-tidy-apply-modernize-use-emplace
clang-tidy: Apply modernize-use-emplace.
2020-04-07 17:28:50 +02:00
chriseth
398c515982
Merge pull request #8618 from mijovic/nextConstructorRefactor
Refactoring nextConstructor by moving it from CompilerContext to ContractDefinition
2020-04-06 19:31:12 +02:00
Djordje Mijovic
8cc16eb128 Refactoring nextConstructor by moving it from CompilerContext to ContractDefinition 2020-04-06 17:35:08 +02:00
Daniel Kirchner
81652686be Debug information for immutable references. 2020-04-06 10:56:42 +02:00
Alexander Arlt
90bb1d8a7c Apply modernize-use-emplace. 2020-04-02 17:35:48 -05:00
chriseth
d7a39c86ce Accessors for immutable variables. 2020-04-02 19:09:54 +02:00
Leonardo Alt
39ff0deb05 Zero initialize memory arrays 2020-04-02 15:55:18 +02:00
Daniel Kirchner
77ea896b68 Properly handle assignments of immutables at declaration. 2020-04-02 08:35:22 +02:00
Daniel Kirchner
fe9f8d520c Restrict size for dynamic memory array creation. 2020-04-01 17:25:09 +02:00
chriseth
2853cba3e5 Fix call to internalDispatch. 2020-04-01 12:13:32 +02:00
Djordje Mijovic
89d5ecdd24 [Sol2Yul] Adding support for constructor with parameters 2020-03-27 01:19:11 +01:00
chriseth
173f234860 Refactor: Replace inheritance hierarchy by most derived contract. 2020-03-26 18:27:39 +01:00
Daniel Kirchner
04d8ad2ae1 Legacy codegeneration for immutable state variables. 2020-03-24 16:45:25 +01:00
Leonardo Alt
0fcb1427c9 Fix Yul codegen when dynamic array is used as rhs of assignment 2020-03-20 17:52:51 +01:00
Djordje Mijovic
96d278b101 [Sol->Yul] Adding slicing for call data arrays 2020-03-13 13:40:38 +01:00
chriseth
fa148f2483 Parsing of immutable state variable. 2020-03-12 17:11:24 +01:00
a3d4
a86c511713 Replaced "assert" with "if" (incorrect contract code is not supposed to trigger asserts). 2020-03-12 14:03:27 +01:00
chriseth
6a896f766a Function call options for YulIR. 2020-03-10 22:38:11 +01:00
Christian Parpart
bb29a7e497
Merge pull request #8460 from ethereum/yulutil-convert-array
YulUtilFunctions: convertionFunction() to also handle array string/memory casts
2020-03-10 14:00:34 +01:00
Christian Parpart
5d7a370248 YulUtilFunctions: convertionFunction() to also handle array string/memory casts. 2020-03-10 11:21:12 +01:00
chriseth
b7c001eb7f
Merge pull request #8416 from ethereum/reuseYulCalldataTailAccess
Fix yul calldata tail access functions and reuse them for old codegen.
2020-03-09 15:10:48 +01:00
Christian Parpart
105d89bea8 Compilation fix. 2020-03-09 11:42:34 +01:00
Christian Parpart
988bd6780b
Merge pull request #8414 from ethereum/sol2yul-func-type-conversion
[Sol2Yul] Implements function-to-function cast.
2020-03-09 11:31:44 +01:00
Christian Parpart
d33376cce6
Merge pull request #8409 from ethereum/multiUseYulFunctionNoSharedPtr
Use plain members and references instead of shared pointers for MultiUseYulFunctionCollector
2020-03-09 11:18:40 +01:00
Christian Parpart
e210026e74 [Sol2Yul] Implements function-to-function cast. 2020-03-09 10:40:57 +01:00
Christian Parpart
c8cbb98002 [Sol2Yul] Fixes appendExternalFunctionCall for argumentStrings.size() == 0. 2020-03-09 10:30:07 +01:00
Djordje Mijovic
092827b7ad Adding sol->yul for f.selector and f.address 2020-03-06 21:43:14 +01:00
Daniel Kirchner
9318dae42c
Merge pull request #8420 from mijovic/iceStackTooDeepFix
Throwing stack too deep ICE in case of calling encode with too many a…
2020-03-04 17:41:59 +01:00
Djordje Mijovic
38b219d140 Throwing stack too deep ICE in case of calling encode with too many arguments instead of invalid opcode 2020-03-04 16:29:07 +01:00
Daniel Kirchner
857ed12b05 Use plain members and references instead of shared pointers for MultiUseYulFunctionCollector 2020-03-04 16:16:34 +01:00
Daniel Kirchner
919888ddbc Use yul function for calldata tail access, fix checks and add additional revert reason. 2020-03-04 14:39:36 +01:00
Daniel Kirchner
561e5d9b27 Rename variables and review suggestion. 2020-03-03 15:12:00 +01:00
Daniel Kirchner
24d6e6295e Reuse the mechanism for abi functions and move tracking of used functions to CompilerContext 2020-03-03 15:11:18 +01:00
Daniel Kirchner
90fa56c719 Allow use of yul util functions in legacy code generation. 2020-03-02 16:32:30 +01:00
chriseth
45041e5d3a Allow access to `_slot` for local storage pointer variables. 2020-02-25 14:28:04 +01:00
chriseth
663a9f892f
Merge pull request #8333 from ethereum/fix-8332
Use explicit variant constructor in direct list initializer
2020-02-18 14:46:31 +01:00
chriseth
64f9dc351e
Merge pull request #8337 from mijovic/assembly-multifile
Assembly: Added missing source field to legacy assembly json output
2020-02-18 12:47:19 +01:00
Djordje Mijovic
18dea6b69c Assembly: Added missing source field to legacy assembly json output to complete the source reference 2020-02-18 10:22:34 +01:00
Bhargava Shastry
786c63ec3c Use explicit type for variant constructor that is part of direct list initializer 2020-02-18 10:42:08 +05:30
Jason Cobb
6db0d50094
Don't use identifiers starting with an underscore followed by an uppercase letter 2020-02-17 12:44:39 -05:00
chriseth
99f88742d6
Merge pull request #8263 from ethereum/functionSelectorPure
Mark function selectors accessed via declaration as pure.
2020-02-14 12:34:39 +01:00
Daniel Kirchner
9f094d59b9 Mark function selector accesses as pure for pure expressions and mark function accesses via contract name as pure. 2020-02-14 12:33:33 +01:00
Christian Parpart
c92fe69a60 Finishes external call implementation. 2020-02-14 11:59:04 +01:00
Leonardo Alt
3800391a1a [Yul] Support conditionals 2020-02-13 17:02:15 -04:00
Daniel Kirchner
df0873d138 Implement calldata arrays for Yul IR 2020-02-12 14:00:29 +01:00
Daniel Kirchner
3c9f18b749 Use IRVariable's in IR code generation and implement tuples. 2020-02-12 12:36:14 +01:00
Mathias Baumann
80bd0f47cc Unify optimize yul code in CompilerContext/ContractCompiler 2020-02-11 13:55:47 +01:00