mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
22c7cd22b9
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
529 lines
20 KiB
Plaintext
529 lines
20 KiB
Plaintext
IR:
|
|
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2" {
|
|
code {
|
|
/// @src 0:265:278 "contract C {}"
|
|
mstore(64, memoryguard(128))
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
|
|
constructor_C_2()
|
|
|
|
let _1 := allocate_unbounded()
|
|
codecopy(_1, dataoffset("C_2_deployed"), datasize("C_2_deployed"))
|
|
|
|
return(_1, datasize("C_2_deployed"))
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
/// @src 0:265:278 "contract C {}"
|
|
function constructor_C_2() {
|
|
|
|
/// @src 0:265:278 "contract C {}"
|
|
|
|
}
|
|
/// @src 0:265:278 "contract C {}"
|
|
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2_deployed" {
|
|
code {
|
|
/// @src 0:265:278 "contract C {}"
|
|
mstore(64, memoryguard(128))
|
|
|
|
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
|
|
|
|
function shift_right_224_unsigned(value) -> newValue {
|
|
newValue :=
|
|
|
|
shr(224, value)
|
|
|
|
}
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
}
|
|
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
|
}
|
|
|
|
}
|
|
|
|
|
|
Optimized IR:
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2" {
|
|
code {
|
|
{
|
|
/// @src 0:265:278 "contract C {}"
|
|
let _1 := memoryguard(0x80)
|
|
mstore(64, _1)
|
|
if callvalue() { revert(0, 0) }
|
|
let _2 := datasize("C_2_deployed")
|
|
codecopy(_1, dataoffset("C_2_deployed"), _2)
|
|
return(_1, _2)
|
|
}
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2_deployed" {
|
|
code {
|
|
{
|
|
/// @src 0:265:278 "contract C {}"
|
|
revert(0, 0)
|
|
}
|
|
}
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
|
}
|
|
}
|
|
|
|
IR:
|
|
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "D_27" {
|
|
code {
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
mstore(64, memoryguard(128))
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
|
|
constructor_D_27()
|
|
|
|
let _1 := allocate_unbounded()
|
|
codecopy(_1, dataoffset("D_27_deployed"), datasize("D_27_deployed"))
|
|
|
|
return(_1, datasize("D_27_deployed"))
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
function constructor_D_27() {
|
|
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
|
|
}
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "D_27_deployed" {
|
|
code {
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
mstore(64, memoryguard(128))
|
|
|
|
if iszero(lt(calldatasize(), 4))
|
|
{
|
|
let selector := shift_right_224_unsigned(calldataload(0))
|
|
switch selector
|
|
|
|
case 0x26121ff0
|
|
{
|
|
// f()
|
|
|
|
external_fun_f_26()
|
|
}
|
|
|
|
default {}
|
|
}
|
|
|
|
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
|
|
|
|
function shift_right_224_unsigned(value) -> newValue {
|
|
newValue :=
|
|
|
|
shr(224, value)
|
|
|
|
}
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
function abi_decode_tuple_(headStart, dataEnd) {
|
|
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
|
|
|
|
}
|
|
|
|
function array_length_t_string_memory_ptr(value) -> length {
|
|
|
|
length := mload(value)
|
|
|
|
}
|
|
|
|
function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {
|
|
mstore(pos, length)
|
|
updated_pos := add(pos, 0x20)
|
|
}
|
|
|
|
function copy_memory_to_memory_with_cleanup(src, dst, length) {
|
|
let i := 0
|
|
for { } lt(i, length) { i := add(i, 32) }
|
|
{
|
|
mstore(add(dst, i), mload(add(src, i)))
|
|
}
|
|
mstore(add(dst, length), 0)
|
|
}
|
|
|
|
function round_up_to_mul_of_32(value) -> result {
|
|
result := and(add(value, 31), not(31))
|
|
}
|
|
|
|
function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {
|
|
let length := array_length_t_string_memory_ptr(value)
|
|
pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)
|
|
copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)
|
|
end := add(pos, round_up_to_mul_of_32(length))
|
|
}
|
|
|
|
function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack(headStart , value0) -> tail {
|
|
tail := add(headStart, 32)
|
|
|
|
mstore(add(headStart, 0), sub(tail, headStart))
|
|
tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)
|
|
|
|
}
|
|
|
|
function external_fun_f_26() {
|
|
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
abi_decode_tuple_(4, calldatasize())
|
|
let ret_0 := fun_f_26()
|
|
let memPos := allocate_unbounded()
|
|
let memEnd := abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack(memPos , ret_0)
|
|
return(memPos, sub(memEnd, memPos))
|
|
|
|
}
|
|
|
|
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
function zero_value_for_split_t_string_memory_ptr() -> ret {
|
|
ret := 96
|
|
}
|
|
|
|
function panic_error_0x41() {
|
|
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
|
|
mstore(4, 0x41)
|
|
revert(0, 0x24)
|
|
}
|
|
|
|
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
|
|
tail := add(headStart, 0)
|
|
|
|
}
|
|
|
|
function revert_forward_1() {
|
|
let pos := allocate_unbounded()
|
|
returndatacopy(pos, 0, returndatasize())
|
|
revert(pos, returndatasize())
|
|
}
|
|
|
|
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 allocate_memory(size) -> memPtr {
|
|
memPtr := allocate_unbounded()
|
|
finalize_allocation(memPtr, size)
|
|
}
|
|
|
|
function array_allocation_size_t_string_memory_ptr(length) -> size {
|
|
// Make sure we can allocate memory without overflow
|
|
if gt(length, 0xffffffffffffffff) { panic_error_0x41() }
|
|
|
|
size := round_up_to_mul_of_32(length)
|
|
|
|
// add length slot
|
|
size := add(size, 0x20)
|
|
|
|
}
|
|
|
|
function allocate_memory_array_t_string_memory_ptr(length) -> memPtr {
|
|
let allocSize := array_allocation_size_t_string_memory_ptr(length)
|
|
memPtr := allocate_memory(allocSize)
|
|
|
|
mstore(memPtr, length)
|
|
|
|
}
|
|
|
|
function store_literal_in_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50(memPtr) {
|
|
|
|
mstore(add(memPtr, 0), "/*")
|
|
|
|
}
|
|
|
|
function copy_literal_to_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50() -> memPtr {
|
|
memPtr := allocate_memory_array_t_string_memory_ptr(2)
|
|
store_literal_in_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50(add(memPtr, 32))
|
|
}
|
|
|
|
function convert_t_stringliteral_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50_to_t_string_memory_ptr() -> converted {
|
|
converted := copy_literal_to_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50()
|
|
}
|
|
|
|
function store_literal_in_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b(memPtr) {
|
|
|
|
mstore(add(memPtr, 0), 0x2f2a2a204073726320303a39363a313635202022636f6e74726163742044207b)
|
|
|
|
mstore(add(memPtr, 32), 0x2e2e2e22202a2f00000000000000000000000000000000000000000000000000)
|
|
|
|
}
|
|
|
|
function copy_literal_to_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b() -> memPtr {
|
|
memPtr := allocate_memory_array_t_string_memory_ptr(39)
|
|
store_literal_in_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b(add(memPtr, 32))
|
|
}
|
|
|
|
function convert_t_stringliteral_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b_to_t_string_memory_ptr() -> converted {
|
|
converted := copy_literal_to_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b()
|
|
}
|
|
|
|
/// @ast-id 26
|
|
/// @src 0:336:597 "function f() /* @use-src 0:\"input.sol\", 1:\"#utility.yul\" @ast-id 15 *\/ public returns (string memory) { C c = new /// @src 0:149:156 \"new C()\"..."
|
|
function fun_f_26() -> var__5_mpos {
|
|
/// @src 0:423:436 "string memory"
|
|
let zero_t_string_memory_ptr_1_mpos := zero_value_for_split_t_string_memory_ptr()
|
|
var__5_mpos := zero_t_string_memory_ptr_1_mpos
|
|
|
|
/// @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..."
|
|
let _2 := allocate_unbounded()
|
|
let _3 := add(_2, datasize("C_2"))
|
|
if or(gt(_3, 0xffffffffffffffff), lt(_3, _2)) { panic_error_0x41() }
|
|
datacopy(_2, dataoffset("C_2"), datasize("C_2"))
|
|
_3 := abi_encode_tuple__to__fromStack(_3)
|
|
|
|
let expr_13_address := create(0, _2, sub(_3, _2))
|
|
|
|
if iszero(expr_13_address) { revert_forward_1() }
|
|
|
|
/// @src 0:440:491 "C c = new /// @src 0:149:156 \"new C()\"..."
|
|
let var_c_9_address := expr_13_address
|
|
/// @src 0:493:494 "c"
|
|
let _4_address := var_c_9_address
|
|
let expr_15_address := _4_address
|
|
/// @src 0:504:526 "string memory s = \"/*\""
|
|
let var_s_18_mpos := convert_t_stringliteral_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50_to_t_string_memory_ptr()
|
|
/// @src 0:528:529 "s"
|
|
let _5_mpos := var_s_18_mpos
|
|
let expr_21_mpos := _5_mpos
|
|
/// @src 0:531:581 "return \"/** @src 0:96:165 \\\"contract D {...\\\" *\/\""
|
|
var__5_mpos := convert_t_stringliteral_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b_to_t_string_memory_ptr()
|
|
leave
|
|
|
|
}
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
|
|
}
|
|
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2" {
|
|
code {
|
|
/// @src 0:265:278 "contract C {}"
|
|
mstore(64, memoryguard(128))
|
|
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
|
|
|
|
constructor_C_2()
|
|
|
|
let _1 := allocate_unbounded()
|
|
codecopy(_1, dataoffset("C_2_deployed"), datasize("C_2_deployed"))
|
|
|
|
return(_1, datasize("C_2_deployed"))
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
/// @src 0:265:278 "contract C {}"
|
|
function constructor_C_2() {
|
|
|
|
/// @src 0:265:278 "contract C {}"
|
|
|
|
}
|
|
/// @src 0:265:278 "contract C {}"
|
|
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2_deployed" {
|
|
code {
|
|
/// @src 0:265:278 "contract C {}"
|
|
mstore(64, memoryguard(128))
|
|
|
|
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
|
|
|
|
function shift_right_224_unsigned(value) -> newValue {
|
|
newValue :=
|
|
|
|
shr(224, value)
|
|
|
|
}
|
|
|
|
function allocate_unbounded() -> memPtr {
|
|
memPtr := mload(64)
|
|
}
|
|
|
|
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
|
|
revert(0, 0)
|
|
}
|
|
|
|
}
|
|
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
|
}
|
|
|
|
}
|
|
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
|
}
|
|
|
|
}
|
|
|
|
|
|
Optimized IR:
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "D_27" {
|
|
code {
|
|
{
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
let _1 := memoryguard(0x80)
|
|
mstore(64, _1)
|
|
if callvalue() { revert(0, 0) }
|
|
let _2 := datasize("D_27_deployed")
|
|
codecopy(_1, dataoffset("D_27_deployed"), _2)
|
|
return(_1, _2)
|
|
}
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "D_27_deployed" {
|
|
code {
|
|
{
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
let _1 := memoryguard(0x80)
|
|
let _2 := 64
|
|
mstore(_2, _1)
|
|
if iszero(lt(calldatasize(), 4))
|
|
{
|
|
let _3 := 0
|
|
if eq(0x26121ff0, shr(224, calldataload(_3)))
|
|
{
|
|
if callvalue() { revert(_3, _3) }
|
|
if slt(add(calldatasize(), not(3)), _3) { revert(_3, _3) }
|
|
/// @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..."
|
|
let _4 := datasize("C_2")
|
|
let _5 := add(_1, _4)
|
|
let _6 := 0xffffffffffffffff
|
|
if or(gt(_5, _6), lt(_5, _1))
|
|
{
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
mstore(_3, shl(224, 0x4e487b71))
|
|
mstore(4, 0x41)
|
|
revert(_3, 0x24)
|
|
}
|
|
/// @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..."
|
|
datacopy(_1, dataoffset("C_2"), _4)
|
|
if iszero(create(/** @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." */ _3, /** @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..." */ _1, sub(_5, _1)))
|
|
{
|
|
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
|
|
let pos := mload(_2)
|
|
returndatacopy(pos, _3, returndatasize())
|
|
revert(pos, returndatasize())
|
|
}
|
|
let memPtr := mload(_2)
|
|
let newFreePtr := add(memPtr, _2)
|
|
if or(gt(newFreePtr, /** @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..." */ _6), /** @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." */ lt(newFreePtr, memPtr))
|
|
{
|
|
mstore(_3, shl(224, 0x4e487b71))
|
|
mstore(4, 0x41)
|
|
revert(_3, 0x24)
|
|
}
|
|
mstore(_2, newFreePtr)
|
|
mstore(memPtr, 2)
|
|
let _7 := 32
|
|
mstore(add(memPtr, _7), "/*")
|
|
let memPtr_1 := mload(_2)
|
|
let newFreePtr_1 := add(memPtr_1, 96)
|
|
if or(gt(newFreePtr_1, /** @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..." */ _6), /** @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." */ lt(newFreePtr_1, memPtr_1))
|
|
{
|
|
mstore(_3, shl(224, 0x4e487b71))
|
|
mstore(4, 0x41)
|
|
revert(_3, 0x24)
|
|
}
|
|
mstore(_2, newFreePtr_1)
|
|
mstore(memPtr_1, 39)
|
|
mstore(add(memPtr_1, _7), 0x2f2a2a204073726320303a39363a313635202022636f6e74726163742044207b)
|
|
mstore(add(memPtr_1, _2), shl(200, 0x2e2e2e22202a2f))
|
|
let memPos := mload(_2)
|
|
mstore(memPos, _7)
|
|
let length := mload(memPtr_1)
|
|
mstore(add(memPos, _7), length)
|
|
let i := _3
|
|
for { } lt(i, length) { i := add(i, _7) }
|
|
{
|
|
mstore(add(add(memPos, i), _2), mload(add(add(memPtr_1, i), _7)))
|
|
}
|
|
mstore(add(add(memPos, length), _2), _3)
|
|
return(memPos, add(sub(add(memPos, and(add(length, 31), not(31))), memPos), _2))
|
|
}
|
|
}
|
|
revert(0, 0)
|
|
}
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2" {
|
|
code {
|
|
{
|
|
/// @src 0:265:278 "contract C {}"
|
|
let _1 := memoryguard(0x80)
|
|
mstore(64, _1)
|
|
if callvalue() { revert(0, 0) }
|
|
let _2 := datasize("C_2_deployed")
|
|
codecopy(_1, dataoffset("C_2_deployed"), _2)
|
|
return(_1, _2)
|
|
}
|
|
}
|
|
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
|
|
object "C_2_deployed" {
|
|
code {
|
|
{
|
|
/// @src 0:265:278 "contract C {}"
|
|
revert(0, 0)
|
|
}
|
|
}
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
|
}
|
|
}
|
|
data ".metadata" hex"<BYTECODE REMOVED>"
|
|
}
|
|
}
|