Use unbounded allocation before returning.

This commit is contained in:
Daniel Kirchner
2021-04-08 18:37:24 +02:00
parent c060bd5633
commit 96c8123b6b
135 changed files with 200 additions and 393 deletions
@@ -89,7 +89,7 @@ object \"D_16\" {
if callvalue() { revert(0, 0) }
abi_decode_tuple_(4, calldatasize())
fun_f_15()
let memPos := allocate_memory(0)
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
@@ -109,22 +109,10 @@ object \"D_16\" {
}
function allocate_memory(size) -> memPtr {
memPtr := allocate_unbounded()
finalize_allocation(memPtr, size)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function finalize_allocation(memPtr, size) {
let newFreePtr := add(memPtr, round_up_to_mul_of_32(size))
// protect against overflow
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
mstore(64, newFreePtr)
}
function fun_f_15() {
let _1 := allocate_unbounded()
@@ -152,10 +140,6 @@ object \"D_16\" {
revert(0, returndatasize())
}
function round_up_to_mul_of_32(value) -> result {
result := and(add(value, 31), not(31))
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=