mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use unbounded allocation before returning.
This commit is contained in:
@@ -39,7 +39,7 @@ object "test_11" {
|
||||
if callvalue() { revert(0, 0) }
|
||||
abi_decode_tuple_(4, calldatasize())
|
||||
let ret_0 := fun_f_10()
|
||||
let memPos := allocate_memory(0)
|
||||
let memPos := allocate_unbounded()
|
||||
let memEnd := abi_encode_tuple_t_bool__to_t_bool__fromStack(memPos , ret_0)
|
||||
return(memPos, sub(memEnd, memPos))
|
||||
}
|
||||
@@ -65,11 +65,6 @@ object "test_11" {
|
||||
|
||||
}
|
||||
|
||||
function allocate_memory(size) -> memPtr {
|
||||
memPtr := allocate_unbounded()
|
||||
finalize_allocation(memPtr, size)
|
||||
}
|
||||
|
||||
function allocate_unbounded() -> memPtr {
|
||||
memPtr := mload(64)
|
||||
}
|
||||
@@ -78,13 +73,6 @@ object "test_11" {
|
||||
cleaned := iszero(iszero(value))
|
||||
}
|
||||
|
||||
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_10() -> var__5 {
|
||||
let zero_t_bool_1 := zero_value_for_split_t_bool()
|
||||
var__5 := zero_t_bool_1
|
||||
@@ -95,16 +83,6 @@ object "test_11" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error_0x41() {
|
||||
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
|
||||
mstore(4, 0x41)
|
||||
revert(0, 0x24)
|
||||
}
|
||||
|
||||
function round_up_to_mul_of_32(value) -> result {
|
||||
result := and(add(value, 31), not(31))
|
||||
}
|
||||
|
||||
function shift_right_224_unsigned(value) -> newValue {
|
||||
newValue :=
|
||||
|
||||
|
||||
Reference in New Issue
Block a user