Handle "leaf functions" first in full inliner.

This commit is contained in:
chriseth
2020-09-10 17:01:19 +02:00
parent 0db79dbc29
commit f102feaf09
17 changed files with 463 additions and 346 deletions
+6 -24
View File
@@ -33,11 +33,14 @@ object "Arraysum_33" {
for { }
lt(vloc_i, _2)
{
vloc_i := increment_t_uint256(vloc_i)
if gt(vloc_i, not(1)) { revert(_1, _1) }
vloc_i := add(vloc_i, 1)
}
{
let _3, _4 := storage_array_index_access$_t_uint256_$dyn_storage(_1, vloc_i)
vloc_sum := checked_add_t_uint256(vloc_sum, extract_from_storage_value_dynamict_uint256(sload(_3), _4))
mstore(_1, _1)
let _3 := sload(add(keccak256(_1, 0x20), vloc_i))
if gt(vloc_sum, not(_3)) { revert(_1, _1) }
vloc_sum := add(vloc_sum, _3)
}
let memPos := allocateMemory(_1)
return(memPos, sub(abi_encode_uint(memPos, _1), memPos))
@@ -57,27 +60,6 @@ object "Arraysum_33" {
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
mstore(64, newFreePtr)
}
function checked_add_t_uint256(x, y) -> sum
{
if gt(x, not(y)) { revert(sum, sum) }
sum := add(x, y)
}
function extract_from_storage_value_dynamict_uint256(slot_value, offset) -> value
{
value := shr(mul(offset, 8), slot_value)
}
function increment_t_uint256(value) -> ret
{
if gt(value, not(1)) { revert(ret, ret) }
ret := add(value, 1)
}
function storage_array_index_access$_t_uint256_$dyn_storage(array, index) -> slot, offset
{
if iszero(lt(index, sload(array))) { invalid() }
mstore(slot, array)
slot := add(keccak256(slot, 0x20), index)
offset := offset
}
}
}
}