diff --git a/libyul/backends/wasm/polyfill/Conversion.yul b/libyul/backends/wasm/polyfill/Conversion.yul index 3168b80ca..17d205ddd 100644 --- a/libyul/backends/wasm/polyfill/Conversion.yul +++ b/libyul/backends/wasm/polyfill/Conversion.yul @@ -59,20 +59,21 @@ function u256_to_address(x1, x2, x3, x4) -> r1, r2, r3 { r3 := x4 } -function bswap16(x) -> y { - let hi := i64.and(i64.shl(x, 8), 0xff00) - let lo := i64.and(i64.shr_u(x, 8), 0xff) - y := i64.or(hi, lo) +function bswap16(x:i32) -> y:i32 { + let hi:i32 := i32.and(i32.shl(x, 8:i32), 0xff00:i32) + let lo:i32 := i32.and(i32.shr_u(x, 8:i32), 0xff:i32) + y := i32.or(hi, lo) } -function bswap32(x) -> y { - let hi := i64.shl(bswap16(x), 16) - let lo := bswap16(i64.shr_u(x, 16)) - y := i64.or(hi, lo) +function bswap32(x:i32) -> y:i32 { + let hi:i32 := i32.shl(bswap16(x), 16:i32) + let lo:i32 := bswap16(i32.shr_u(x, 16:i32)) + y := i32.or(hi, lo) } + function bswap64(x) -> y { - let hi := i64.shl(bswap32(x), 32) - let lo := bswap32(i64.shr_u(x, 32)) + let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32) + let lo := i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32)))) y := i64.or(hi, lo) } diff --git a/libyul/backends/wasm/polyfill/Interface.yul b/libyul/backends/wasm/polyfill/Interface.yul index 6251409bf..9c5fb59b4 100644 --- a/libyul/backends/wasm/polyfill/Interface.yul +++ b/libyul/backends/wasm/polyfill/Interface.yul @@ -19,14 +19,15 @@ // NOTE: This file is used to generate `ewasmPolyfills/Interface.h`. function address() -> z1, z2, z3, z4 { - eth.getAddress(0:i32) - z1, z2, z3, z4 := mload_internal(0:i32) + eth.getAddress(12:i32) + z1, z2, z3, z4 := mload_address(0:i32) } function balance(x1, x2, x3, x4) -> z1, z2, z3, z4 { mstore_address(0:i32, x1, x2, x3, x4) - eth.getExternalBalance(12:i32, 48:i32) - z1, z2, z3, z4 := mload_internal(32:i32) + eth.getExternalBalance(12:i32, 32:i32) + z3 := i64.load(40:i32) + z4 := i64.load(32:i32) } function selfbalance() -> z1, z2, z3, z4 { @@ -40,13 +41,13 @@ function chainid() -> z1, z2, z3, z4 { } function origin() -> z1, z2, z3, z4 { - eth.getTxOrigin(0:i32) - z1, z2, z3, z4 := mload_internal(0:i32) + eth.getTxOrigin(12:i32) + z1, z2, z3, z4 := mload_address(0:i32) } function caller() -> z1, z2, z3, z4 { - eth.getCaller(0:i32) - z1, z2, z3, z4 := mload_internal(0:i32) + eth.getCaller(12:i32) + z1, z2, z3, z4 := mload_address(0:i32) } function callvalue() -> z1, z2, z3, z4 { @@ -155,8 +156,8 @@ function blockhash(x1, x2, x3, x4) -> z1, z2, z3, z4 { } function coinbase() -> z1, z2, z3, z4 { - eth.getBlockCoinbase(0:i32) - z1, z2, z3, z4 := mload_internal(0:i32) + eth.getBlockCoinbase(12:i32) + z1, z2, z3, z4 := mload_address(0:i32) } function timestamp() -> z1, z2, z3, z4 { @@ -180,34 +181,10 @@ function mload(x1, x2, x3, x4) -> z1, z2, z3, z4 { z1, z2, z3, z4 := mload_internal(to_internal_i32ptr(x1, x2, x3, x4)) } -function mload_internal(pos:i32) -> z1, z2, z3, z4 { - z1 := bswap64(i64.load(pos)) - z2 := bswap64(i64.load(i32.add(pos, 8:i32))) - z3 := bswap64(i64.load(i32.add(pos, 16:i32))) - z4 := bswap64(i64.load(i32.add(pos, 24:i32))) -} - function mstore(x1, x2, x3, x4, y1, y2, y3, y4) { mstore_internal(to_internal_i32ptr(x1, x2, x3, x4), y1, y2, y3, y4) } -function mstore_internal(pos:i32, y1, y2, y3, y4) { - i64.store(pos, bswap64(y1)) - i64.store(i32.add(pos, 8:i32), bswap64(y2)) - i64.store(i32.add(pos, 16:i32), bswap64(y3)) - i64.store(i32.add(pos, 24:i32), bswap64(y4)) -} - -function mstore_address(pos:i32, a1, a2, a3, a4) { - a1, a2, a3 := u256_to_address(a1, a2, a3, a4) - mstore_internal(pos, 0, a1, a2, a3) -} - -function mstore8(x1, x2, x3, x4, y1, y2, y3, y4) { - let v := u256_to_byte(y1, y2, y3, y4) - i64.store8(to_internal_i32ptr(x1, x2, x3, x4), v) -} - // Needed? function msize() -> z1, z2, z3, z4 { // TODO implement diff --git a/libyul/backends/wasm/polyfill/Memory.yul b/libyul/backends/wasm/polyfill/Memory.yul index aec8e86c6..410c42d8f 100644 --- a/libyul/backends/wasm/polyfill/Memory.yul +++ b/libyul/backends/wasm/polyfill/Memory.yul @@ -61,9 +61,49 @@ function memoryguard(x:i64) -> y1, y2, y3, y4 { y4 := x } +// Fill `length` bytes starting from `ptr` with `value`. function memset(ptr:i32, value:i32, length:i32) { for { let i:i32 := 0:i32 } i32.lt_u(i, length) { i := i32.add(i, 1:i32) } { i32.store8(i32.add(ptr, i), value) } -} \ No newline at end of file +} + +// Writes 256-bits from `pos`, but only set the bottom 160-bits. +function mstore_address(pos:i32, a1, a2, a3, a4) { + a1, a2, a3 := u256_to_address(a1, a2, a3, a4) + i64.store(pos, 0:i64) + i32.store(i32.add(pos, 8:i32), 0:i32) + i32.store(i32.add(pos, 12:i32), bswap32(i32.wrap_i64(a1))) + i64.store(i32.add(pos, 16:i32), bswap64(a2)) + i64.store(i32.add(pos, 24:i32), bswap64(a3)) +} + +// Reads 256-bits from `pos`, but only returns the bottom 160-bits. +function mload_address(pos:i32) -> z1, z2, z3, z4 { + z2 := i64.extend_i32_u(bswap32(i32.load(i32.add(pos, 12:i32)))) + z3 := bswap64(i64.load(i32.add(pos, 16:i32))) + z4 := bswap64(i64.load(i32.add(pos, 24:i32))) +} + +// Writes 256-bits from `pos`. +function mstore_internal(pos:i32, y1, y2, y3, y4) { + i64.store(pos, bswap64(y1)) + i64.store(i32.add(pos, 8:i32), bswap64(y2)) + i64.store(i32.add(pos, 16:i32), bswap64(y3)) + i64.store(i32.add(pos, 24:i32), bswap64(y4)) +} + +// Reads 256-bits from `pos`. +function mload_internal(pos:i32) -> z1, z2, z3, z4 { + z1 := bswap64(i64.load(pos)) + z2 := bswap64(i64.load(i32.add(pos, 8:i32))) + z3 := bswap64(i64.load(i32.add(pos, 16:i32))) + z4 := bswap64(i64.load(i32.add(pos, 24:i32))) +} + +// Stores one byte at position `x` of value `y`. +function mstore8(x1, x2, x3, x4, y1, y2, y3, y4) { + let v := u256_to_byte(y1, y2, y3, y4) + i64.store8(to_internal_i32ptr(x1, x2, x3, x4), v) +} diff --git a/test/cmdlineTests/evm_to_wasm/output b/test/cmdlineTests/evm_to_wasm/output index 772149b0a..f8423bafe 100644 --- a/test/cmdlineTests/evm_to_wasm/output +++ b/test/cmdlineTests/evm_to_wasm/output @@ -19,19 +19,19 @@ object "object" { mstore_internal(32:i32, _1, _1, _1, 1) eth.storageStore(0:i32, 32:i32) } - function bswap16(x) -> y + function bswap16(x:i32) -> y:i32 { - y := i64.or(i64.and(i64.shl(x, 8), 0xff00), i64.and(i64.shr_u(x, 8), 0xff)) + y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) } - function bswap32(x) -> y + function bswap32(x:i32) -> y:i32 { - let hi := i64.shl(bswap16(x), 16) - y := i64.or(hi, bswap16(i64.shr_u(x, 16))) + let hi:i32 := i32.shl(bswap16(x), 16:i32) + y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) } function bswap64(x) -> y { - let hi := i64.shl(bswap32(x), 32) - y := i64.or(hi, bswap32(i64.shr_u(x, 32))) + let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32) + y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32))))) } function mstore_internal(pos:i32, y1, y2, y3, y4) { @@ -45,7 +45,7 @@ object "object" { Binary representation: -0061736d0100000001160460000060017e017e60057f7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000303060500010101020503010001060100071102066d656d6f72790200046d61696e00010abc01052901017e0240420021004100200020002000200010054120200020002000420110054100412010000b0b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100242108621022002200042108810028421010b20010b1e01027e02402000100342208621022002200042208810038421010b20010b32000240200020011004370000200041086a20021004370000200041106a20031004370000200041186a200410043700000b0b +0061736d01000000011b0560000060017e017e60017f017f60057f7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000403060500020201030503010001060100071102066d656d6f72790200046d61696e00010ac001052901017e0240420021004100200020002000200010054120200020002000420110054100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b2201027e02402000a71003ad422086210220022000422088a71003ad8421010b20010b32000240200020011004370000200041086a20021004370000200041106a20031004370000200041186a200410043700000b0b Text representation: (module @@ -64,24 +64,24 @@ Text representation: ) (func $bswap16 - (param $x i64) - (result i64) - (local $y i64) + (param $x i32) + (result i32) + (local $y i32) (block $label__1 - (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) ) (local.get $y) ) (func $bswap32 - (param $x i64) - (result i64) - (local $y i64) - (local $hi i64) + (param $x i32) + (result i32) + (local $y i32) + (local $hi i32) (block $label__2 - (local.set $hi (i64.shl (call $bswap16 (local.get $x)) (i64.const 16))) - (local.set $y (i64.or (local.get $hi) (call $bswap16 (i64.shr_u (local.get $x) (i64.const 16))))) + (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) + (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) ) (local.get $y) @@ -93,8 +93,8 @@ Text representation: (local $y i64) (local $hi i64) (block $label__3 - (local.set $hi (i64.shl (call $bswap32 (local.get $x)) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (call $bswap32 (i64.shr_u (local.get $x) (i64.const 32))))) + (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32))) + (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32))))))) ) (local.get $y) diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output index 88212dd94..4db5a8645 100644 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ b/test/cmdlineTests/evm_to_wasm_break/output @@ -42,11 +42,11 @@ object "object" { x_7 := x_11 } { - let _4, _5, _6, _7 := iszero_200_872_1499(_1, _1, _1, lt_202(x_4, x_5, x_6, x_7, _1, _1, _1, 10)) + let _4, _5, _6, _7 := iszero_204_878_1509(_1, _1, _1, lt_206(x_4, x_5, x_6, x_7, _1, _1, _1, 10)) if i32.eqz(i64.eqz(i64.or(i64.or(_4, _5), i64.or(_6, _7)))) { break } - let _8, _9, _10, _11 := eq_201_873_1500(x_4, x_5, x_6, x_7, _1, _1, _1, 2) + let _8, _9, _10, _11 := eq_205_879_1510(x_4, x_5, x_6, x_7, _1, _1, _1, 2) if i32.eqz(i64.eqz(i64.or(i64.or(_8, _9), i64.or(_10, _11)))) { break } - let _12, _13, _14, _15 := eq_201_873_1500(x_4, x_5, x_6, x_7, _1, _1, _1, 4) + let _12, _13, _14, _15 := eq_205_879_1510(x_4, x_5, x_6, x_7, _1, _1, _1, 4) if i32.eqz(i64.eqz(i64.or(i64.or(_12, _13), i64.or(_14, _15)))) { continue } } sstore(_1, _1, _1, _1, x_4, x_5, x_6, x_7) @@ -68,15 +68,15 @@ object "object" { let r1_1, carry_2 := add_carry(x1, y1, carry_1) r1 := r1_1 } - function iszero_200_872_1499(x1, x2, x3, x4) -> r1, r2, r3, r4 + function iszero_204_878_1509(x1, x2, x3, x4) -> r1, r2, r3, r4 { r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(x1, x2), i64.or(x3, x4)))) } - function eq_201_873_1500(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 + function eq_205_879_1510(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { r4 := i64.extend_i32_u(i32.and(i64.eq(x1, y1), i32.and(i64.eq(x2, y2), i32.and(i64.eq(x3, y3), i64.eq(x4, y4))))) } - function lt_202(x1, x2, x3, x4, y1, y2, y3, y4) -> z4 + function lt_206(x1, x2, x3, x4, y1, y2, y3, y4) -> z4 { let z:i32 := false let _1:i32 := 0xffffffff:i32 @@ -102,19 +102,19 @@ object "object" { if i64.ne(0, i64.shr_u(x4, 32)) { unreachable() } v := i32.wrap_i64(x4) } - function bswap16(x) -> y + function bswap16(x:i32) -> y:i32 { - y := i64.or(i64.and(i64.shl(x, 8), 0xff00), i64.and(i64.shr_u(x, 8), 0xff)) + y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) } - function bswap32(x) -> y + function bswap32(x:i32) -> y:i32 { - let hi := i64.shl(bswap16(x), 16) - y := i64.or(hi, bswap16(i64.shr_u(x, 16))) + let hi:i32 := i32.shl(bswap16(x), 16:i32) + y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) } function bswap64(x) -> y { - let hi := i64.shl(bswap32(x), 32) - y := i64.or(hi, bswap32(i64.shr_u(x, 32))) + let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32) + y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32))))) } function calldataload(x1, x2, x3, x4) -> z1, z2, z3, z4 { @@ -150,6 +150,12 @@ object "object" { z3 := z3_1 z4 := z4_1 } + function sstore(x1, x2, x3, x4, y1, y2, y3, y4) + { + mstore_internal(0:i32, x1, x2, x3, x4) + mstore_internal(32:i32, y1, y2, y3, y4) + eth.storageStore(0:i32, 32:i32) + } function mstore_internal(pos:i32, y1, y2, y3, y4) { i64.store(pos, bswap64(y1)) @@ -157,18 +163,12 @@ object "object" { i64.store(i32.add(pos, 16:i32), bswap64(y3)) i64.store(i32.add(pos, 24:i32), bswap64(y4)) } - function sstore(x1, x2, x3, x4, y1, y2, y3, y4) - { - mstore_internal(0:i32, x1, x2, x3, x4) - mstore_internal(32:i32, y1, y2, y3, y4) - eth.storageStore(0:i32, 32:i32) - } } } Binary representation: -0061736d01000000014e0b6000006000017f60017e017e60037e7e7e017e60047e7e7e7e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60057f7e7e7e7e0060027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000908657468657265756d06726576657274000908657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000a030e0d0003070407070502020204080605030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00040abc090dcb02030a7e017f107e02404200210002402000200020002000100e21012300210223012103230221040b20012105200221062003210720042108420121092000200084200020098484504545210a02400340200a45450d01024002402000200020002005200620072008200020002000420a10091007210b2300210c2301210d2302210e0b200b200c84200d200e8484504504400c030b0240200520062007200820002000200042021008210f2300211023012111230221120b200f201084201120128484504504400c030b024020052006200720082000200020004204100821132300211423012115230221160b2013201484201520168484504504400c010b0b0240200520062007200820002000200020091006211723002118230121192302211a0b201721052018210620192107201a21080c000b0b2000200020002000200520062007200810100b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1005210d2300210e0b200d210a024020012005200e1005210f230021100b200f2109024020002004201010052111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b2f01047e02402000200451200120055120022006512003200751717171ad210b0b20092400200a2401200b240220080ba30102017e057f024041002109417f210a0240200a200020045220002004541b210b200b41004604400240200a200120055220012005541b210c200c41004604400240200a200220065220022006541b210d200d41004604402003200754210905200d41014604404100210905410121090b0b0b05200c41014604404100210905410121090b0b0b05200b41014604404100210905410121090b0b0b2009ad21080b20080b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100b421086210220022000421088100b8421010b20010b1e01027e02402000100c422086210220022000422088100c8421010b20010bfc0105047e017f017e087f047e024010022108420021092009200920092009100a210a2000200120022003100a210b2009200920094220100a210c200b417f200c6b4b04404100410010010b2008200b6b210d200b20084b04404100210d0b4100210e200d200e4b0440200a200b200d10030b200c200d4b0440200c200d6b210f200a200d6a2110200e2111024003402011200f49450d010240201020116a200e3a00000b201141016a21110c000b0b0b200e290000100d2112200e41086a290000100d2113200e41106a290000100d2114200e41186a290000100d2115201221042013210520142106201521070b20052400200624012007240220040b3200024020002001100d370000200041086a2002100d370000200041106a2003100d370000200041186a2004100d3700000b0b2300024041002000200120022003100f41202004200520062007100f4100412010000b0b +0061736d0100000001530c6000006000017f60017e017e60037e7e7e017e60047e7e7e7e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60017f017f60057f7e7e7e7e0060027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000a08657468657265756d06726576657274000a08657468657265756d0f67657443616c6c4461746153697a65000108657468657265756d0c63616c6c44617461436f7079000b030e0d0003070407070508080204060905030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00040ac0090dcb02030a7e017f107e02404200210002402000200020002000100e21012300210223012103230221040b20012105200221062003210720042108420121092000200084200020098484504545210a02400340200a45450d01024002402000200020002005200620072008200020002000420a10091007210b2300210c2301210d2302210e0b200b200c84200d200e8484504504400c030b0240200520062007200820002000200042021008210f2300211023012111230221120b200f201084201120128484504504400c030b024020052006200720082000200020004204100821132300211423012115230221160b2013201484201520168484504504400c010b0b0240200520062007200820002000200020091006211723002118230121192302211a0b201721052018210620192107201a21080c000b0b20002000200020002005200620072008100f0b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1005210d2300210e0b200d210a024020012005200e1005210f230021100b200f2109024020002004201010052111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b2f01047e02402000200451200120055120022006512003200751717171ad210b0b20092400200a2401200b240220080ba30102017e057f024041002109417f210a0240200a200020045220002004541b210b200b41004604400240200a200120055220012005541b210c200c41004604400240200a200220065220022006541b210d200d41004604402003200754210905200d41014604404100210905410121090b0b0b05200c41014604404100210905410121090b0b0b05200b41014604404100210905410121090b0b0b2009ad21080b20080b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100b411074210220022000411076100b7221010b20010b2201027e02402000a7100cad422086210220022000422088a7100cad8421010b20010bfc0105047e017f017e087f047e024010022108420021092009200920092009100a210a2000200120022003100a210b2009200920094220100a210c200b417f200c6b4b04404100410010010b2008200b6b210d200b20084b04404100210d0b4100210e200d200e4b0440200a200b200d10030b200c200d4b0440200c200d6b210f200a200d6a2110200e2111024003402011200f49450d010240201020116a200e3a00000b201141016a21110c000b0b0b200e290000100d2112200e41086a290000100d2113200e41106a290000100d2114200e41186a290000100d2115201221042013210520142106201521070b20052400200624012007240220040b230002404100200020012002200310104120200420052006200710104100412010000b0b3200024020002001100d370000200041086a2002100d370000200041106a2003100d370000200041186a2004100d3700000b0b Text representation: (module @@ -230,7 +230,7 @@ Text representation: (br_if $label__3 (i32.eqz (i32.eqz (local.get $_3)))) (block $label__4 (block - (local.set $_4 (call $iszero_200_872_1499 (local.get $_1) (local.get $_1) (local.get $_1) (call $lt_202 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10)))) + (local.set $_4 (call $iszero_204_878_1509 (local.get $_1) (local.get $_1) (local.get $_1) (call $lt_206 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10)))) (local.set $_5 (global.get $global_)) (local.set $_6 (global.get $global__1)) (local.set $_7 (global.get $global__2)) @@ -240,7 +240,7 @@ Text representation: (br $label__3) )) (block - (local.set $_8 (call $eq_201_873_1500 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2))) + (local.set $_8 (call $eq_205_879_1510 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2))) (local.set $_9 (global.get $global_)) (local.set $_10 (global.get $global__1)) (local.set $_11 (global.get $global__2)) @@ -250,7 +250,7 @@ Text representation: (br $label__3) )) (block - (local.set $_12 (call $eq_201_873_1500 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4))) + (local.set $_12 (call $eq_205_879_1510 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4))) (local.set $_13 (global.get $global_)) (local.set $_14 (global.get $global__1)) (local.set $_15 (global.get $global__2)) @@ -348,7 +348,7 @@ Text representation: (local.get $r1) ) -(func $iszero_200_872_1499 +(func $iszero_204_878_1509 (param $x1 i64) (param $x2 i64) (param $x3 i64) @@ -368,7 +368,7 @@ Text representation: (local.get $r1) ) -(func $eq_201_873_1500 +(func $eq_205_879_1510 (param $x1 i64) (param $x2 i64) (param $x3 i64) @@ -392,7 +392,7 @@ Text representation: (local.get $r1) ) -(func $lt_202 +(func $lt_206 (param $x1 i64) (param $x2 i64) (param $x3 i64) @@ -473,24 +473,24 @@ Text representation: ) (func $bswap16 - (param $x i64) - (result i64) - (local $y i64) + (param $x i32) + (result i32) + (local $y i32) (block $label__14 - (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) ) (local.get $y) ) (func $bswap32 - (param $x i64) - (result i64) - (local $y i64) - (local $hi i64) + (param $x i32) + (result i32) + (local $y i32) + (local $hi i32) (block $label__15 - (local.set $hi (i64.shl (call $bswap16 (local.get $x)) (i64.const 16))) - (local.set $y (i64.or (local.get $hi) (call $bswap16 (i64.shr_u (local.get $x) (i64.const 16))))) + (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) + (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) ) (local.get $y) @@ -502,8 +502,8 @@ Text representation: (local $y i64) (local $hi i64) (block $label__16 - (local.set $hi (i64.shl (call $bswap32 (local.get $x)) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (call $bswap32 (i64.shr_u (local.get $x) (i64.const 32))))) + (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32))) + (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32))))))) ) (local.get $y) @@ -580,20 +580,6 @@ Text representation: (local.get $z1) ) -(func $mstore_internal - (param $pos i32) - (param $y1 i64) - (param $y2 i64) - (param $y3 i64) - (param $y4 i64) - (block $label__21 - (i64.store (local.get $pos) (call $bswap64 (local.get $y1))) - (i64.store (i32.add (local.get $pos) (i32.const 8)) (call $bswap64 (local.get $y2))) - (i64.store (i32.add (local.get $pos) (i32.const 16)) (call $bswap64 (local.get $y3))) - (i64.store (i32.add (local.get $pos) (i32.const 24)) (call $bswap64 (local.get $y4))) - ) -) - (func $sstore (param $x1 i64) (param $x2 i64) @@ -603,11 +589,25 @@ Text representation: (param $y2 i64) (param $y3 i64) (param $y4 i64) - (block $label__22 + (block $label__21 (call $mstore_internal (i32.const 0) (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)) (call $mstore_internal (i32.const 32) (local.get $y1) (local.get $y2) (local.get $y3) (local.get $y4)) (call $eth.storageStore (i32.const 0) (i32.const 32)) ) ) +(func $mstore_internal + (param $pos i32) + (param $y1 i64) + (param $y2 i64) + (param $y3 i64) + (param $y4 i64) + (block $label__22 + (i64.store (local.get $pos) (call $bswap64 (local.get $y1))) + (i64.store (i32.add (local.get $pos) (i32.const 8)) (call $bswap64 (local.get $y2))) + (i64.store (i32.add (local.get $pos) (i32.const 16)) (call $bswap64 (local.get $y3))) + (i64.store (i32.add (local.get $pos) (i32.const 24)) (call $bswap64 (local.get $y4))) + ) +) + ) diff --git a/test/cmdlineTests/standard_ewasm_requested/output.json b/test/cmdlineTests/standard_ewasm_requested/output.json index b63bc50dc..c7c994435 100644 --- a/test/cmdlineTests/standard_ewasm_requested/output.json +++ b/test/cmdlineTests/standard_ewasm_requested/output.json @@ -1,7 +1,7 @@ -{"contracts":{"A":{"C":{"ewasm":{"wasm":"0061736d01000000013a0860000060017e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e00600c7e7e7e7e7e7e7e7e7e7e7e7e0060017f0060027f7f0060037f7f7f0002510408657468657265756d08636f6465436f7079000708657468657265756d06726576657274000608657468657265756d0c67657443616c6c56616c7565000508657468657265756d0666696e6973680006030a090002020101010403030503010001060100071102066d656d6f72790200046d61696e0004009d030c435f335f6465706c6f7965640061736d0100000001160460000060017e017e60047e7e7e7e017f60027f7f0002130108657468657265756d067265766572740003030504000201010503010001060100071102066d656d6f72790200046d61696e00010ab60204ca0104017e027f057e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b20001003421086210320032000421088100384422086210420042000422088100484210520022005370000200241086a2005370000200241106a20053700004280011003421086210620064280014210881003844220862107200241186a2007428001422088100484370000200020002000200010022108200020002000200010022109200941c0006a210a200a2009490440000b200a200810000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100342108621022002200042108810038421010b20010b0aec0309dc0103017e027f057e02404200210020002000200042c00010052101200141c0006a210220022001490440000b20001009210320022003370000200241086a2003370000200241106a2003370000200241186a428001100937000041001002410029000010092104410041086a29000010092105410041106a2900001009210620042005842006410041186a290000100984845045044020002000200020002000200020002000100c0b4290032107200020002000200020002000200042ce012000200020002007100a20002000200020002000200020002007100b0b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b2601027f0240200020012002200310052105200541c0006a210420042005490440000b0b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100742108621022002200042108810078421010b20010b1e01027e02402000100842208621022002200042208810088421010b20010b25000240200020012002200310062004200520062007100520082009200a200b100510000b0b1b000240200020012002200310062004200520062007100510030b0b1b000240200020012002200310062004200520062007100510010b0b","wast":"(module +{"contracts":{"A":{"C":{"ewasm":{"wasm":"0061736d01000000013f0960000060017e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e00600c7e7e7e7e7e7e7e7e7e7e7e7e0060017f0060017f017f60027f7f0060037f7f7f0002510408657468657265756d08636f6465436f7079000808657468657265756d06726576657274000708657468657265756d0c67657443616c6c56616c7565000508657468657265756d0666696e6973680007030a090002020606010403030503010001060100071102066d656d6f72790200046d61696e00040086030c435f335f6465706c6f7965640061736d0100000001160460000060047e7e7e7e017f60017f017f60027f7f0002130108657468657265756d067265766572740003030504000102020503010001060100071102066d656d6f72790200046d61696e00010a9f0204b30104017e027f037e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b2000a71004ad422086210320032000422088a71004ad84210420022004370000200241086a2004370000200241106a2004370000428001a71004ad4220862105200241186a2005428001422088a71004ad84370000200020002000200010022106200020002000200010022107200741c0006a210820082007490440000b2008200610000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100341107421022002200041107610037221010b20010b0af00309dc0103017e027f057e02404200210020002000200042c00010052101200141c0006a210220022001490440000b20001009210320022003370000200241086a2003370000200241106a2003370000200241186a428001100937000041001002410029000010092104410041086a29000010092105410041106a2900001009210620042005842006410041186a290000100984845045044020002000200020002000200020002000100c0b42f9022107200020002000200020002000200042d3012000200020002007100a20002000200020002000200020002007100b0b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b2601027f0240200020012002200310052105200541c0006a210420042005490440000b0b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100741107421022002200041107610077221010b20010b2201027e02402000a71008ad422086210220022000422088a71008ad8421010b20010b25000240200020012002200310062004200520062007100520082009200a200b100510000b0b1b000240200020012002200310062004200520062007100510030b0b1b000240200020012002200310062004200520062007100510010b0b","wast":"(module ;; custom section for sub-module - ;; The Keccak-256 hash of the text representation of \"C_3_deployed\": 0289c074ac70ccfdbeb7817862087cc066a9f7707de1a981bb8b5b12dd2ce4e9 - ;; (@custom \"C_3_deployed\" \"0061736d0100000001160460000060017e017e60047e7e7e7e017f60027f7f0002130108657468657265756d067265766572740003030504000201010503010001060100071102066d656d6f72790200046d61696e00010ab60204ca0104017e027f057e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b20001003421086210320032000421088100384422086210420042000422088100484210520022005370000200241086a2005370000200241106a20053700004280011003421086210620064280014210881003844220862107200241186a2007428001422088100484370000200020002000200010022108200020002000200010022109200941c0006a210a200a2009490440000b200a200810000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100342108621022002200042108810038421010b20010b\") + ;; The Keccak-256 hash of the text representation of \"C_3_deployed\": 380167268971b84f9fd4e61f1659da4fd304bd6e30ec2dd33d412f3c8203ced7 + ;; (@custom \"C_3_deployed\" \"0061736d0100000001160460000060047e7e7e7e017f60017f017f60027f7f0002130108657468657265756d067265766572740003030504000102020503010001060100071102066d656d6f72790200046d61696e00010a9f0204b30104017e027f037e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b2000a71004ad422086210320032000422088a71004ad84210420022004370000200241086a2004370000200241106a2004370000428001a71004ad4220862105200241186a2005428001422088a71004ad84370000200020002000200010022106200020002000200010022107200741c0006a210820082007490440000b2008200610000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100341107421022002200041107610037221010b20010b\") (import \"ethereum\" \"codeCopy\" (func $eth.codeCopy (param i32 i32 i32))) (import \"ethereum\" \"revert\" (func $eth.revert (param i32 i32))) (import \"ethereum\" \"getCallValue\" (func $eth.getCallValue (param i32))) @@ -78,24 +78,24 @@ ) (func $bswap16 - (param $x i64) - (result i64) - (local $y i64) + (param $x i32) + (result i32) + (local $y i32) (block $label__3 - (local.set $y (i64.or (i64.and (i64.shl (local.get $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $x) (i64.const 8)) (i64.const 255)))) + (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) ) (local.get $y) ) (func $bswap32 - (param $x i64) - (result i64) - (local $y i64) - (local $hi i64) + (param $x i32) + (result i32) + (local $y i32) + (local $hi i32) (block $label__4 - (local.set $hi (i64.shl (call $bswap16 (local.get $x)) (i64.const 16))) - (local.set $y (i64.or (local.get $hi) (call $bswap16 (i64.shr_u (local.get $x) (i64.const 16))))) + (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) + (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) ) (local.get $y) @@ -107,8 +107,8 @@ (local $y i64) (local $hi i64) (block $label__5 - (local.set $hi (i64.shl (call $bswap32 (local.get $x)) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (call $bswap32 (i64.shr_u (local.get $x) (i64.const 32))))) + (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32))) + (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32))))))) ) (local.get $y) diff --git a/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol b/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol index 59aa6ca56..1cfc19a3f 100644 --- a/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol +++ b/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol @@ -9,5 +9,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x00 diff --git a/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol b/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol index 87e33ed46..958254a86 100644 --- a/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol +++ b/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol @@ -9,6 +9,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> FAILURE, hex"4e487b71", 0x11 // f(uint16,uint16,uint16): 0xe000, 0x1000, 0x1000 -> 0x00 diff --git a/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol b/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol index 895a9b17c..2b7d4eaa0 100644 --- a/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol +++ b/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol @@ -11,6 +11,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f(uint16): 7 -> 0x0207 // f(uint16): 0xffff -> 511 diff --git a/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol b/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol index 83d57ce26..a44ec8374 100644 --- a/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol +++ b/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol @@ -15,6 +15,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // div(uint256,uint256): 7, 2 -> 3 // div(uint256,uint256): 7, 0 -> FAILURE, hex"4e487b71", 0x12 # throws # diff --git a/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol b/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol index 21085a7d0..bd795a28c 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol @@ -14,6 +14,7 @@ contract Test { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // g(uint256[]): 0x20, 4, 1, 2, 3, 4 -> 4, 1 -// h(uint256[], uint256, uint256): 0x60, 1, 3, 4, 1, 2, 3, 4 -> 2, 2 +// h(uint256[],uint256,uint256): 0x60, 1, 3, 4, 1, 2, 3, 4 -> 2, 2 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol index 98642c9e1..207777edb 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol @@ -15,5 +15,6 @@ contract c { // ==== // compileViaYul: also +// compileToEwasm: also // ---- // test() -> 8, 0 diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol index 0d7d6f1f8..c436f50b2 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol @@ -6,5 +6,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f(uint256[2]): 43, 57 -> 43, 57 diff --git a/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol b/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol index 21675e51a..fdb9905fb 100644 --- a/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol +++ b/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol @@ -7,5 +7,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 11, 10 diff --git a/test/libsolidity/semanticTests/constantEvaluator/rounding.sol b/test/libsolidity/semanticTests/constantEvaluator/rounding.sol index a640d8676..af4eee954 100644 --- a/test/libsolidity/semanticTests/constantEvaluator/rounding.sol +++ b/test/libsolidity/semanticTests/constantEvaluator/rounding.sol @@ -11,5 +11,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 2, 2, 2, 2 diff --git a/test/libsolidity/semanticTests/constants/consteval_array_length.sol b/test/libsolidity/semanticTests/constants/consteval_array_length.sol index 91e929834..ff76cfdfe 100644 --- a/test/libsolidity/semanticTests/constants/consteval_array_length.sol +++ b/test/libsolidity/semanticTests/constants/consteval_array_length.sol @@ -9,6 +9,7 @@ contract C { } // ==== // compileViaYul: true +// compileToEwasm: also // ---- // constructor() -> // f() -> 0x0a, 0x0a diff --git a/test/libsolidity/semanticTests/fallback/falback_return.sol b/test/libsolidity/semanticTests/fallback/falback_return.sol index 2868d85d0..43a1a88fa 100644 --- a/test/libsolidity/semanticTests/fallback/falback_return.sol +++ b/test/libsolidity/semanticTests/fallback/falback_return.sol @@ -7,6 +7,7 @@ contract A { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // () // x() -> 1 diff --git a/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol b/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol index 15e171dfc..3ae44ac06 100644 --- a/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol +++ b/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol @@ -12,5 +12,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol b/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol index 68a52182b..38ec8af39 100644 --- a/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol +++ b/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol @@ -19,6 +19,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // withValue() -> 0x00 // withoutValue() -> 0x60 diff --git a/test/libsolidity/semanticTests/multiSource/circular_import_2.sol b/test/libsolidity/semanticTests/multiSource/circular_import_2.sol index 920890b37..89084b901 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_import_2.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_import_2.sol @@ -12,5 +12,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // foo() -> 992 diff --git a/test/libsolidity/semanticTests/multiSource/circular_reimport.sol b/test/libsolidity/semanticTests/multiSource/circular_reimport.sol index 4514b24b0..9f0a797d2 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_reimport.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_reimport.sol @@ -14,5 +14,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // foo() -> 0x60 diff --git a/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol b/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol index 07faf9356..c7b3bdd71 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol @@ -14,5 +14,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // foo() -> 0x2324 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol b/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol index 722fdae18..0554a639d 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol @@ -11,5 +11,6 @@ contract C { // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x0 diff --git a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol index e393d81e2..0144318a7 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol @@ -16,7 +16,8 @@ contract C { } } // ==== -// EVMVersion: >=byzantium // compileViaYul: also +// compileToEwasm: also +// EVMVersion: >=byzantium // ---- -// test() -> FAILURE, hex"4e487b71", 33 # should throw # +// test() -> FAILURE, hex"4e487b71", 0x21 # should throw # diff --git a/test/libsolidity/semanticTests/state/block_coinbase.sol b/test/libsolidity/semanticTests/state/block_coinbase.sol index 45cb64c5d..c8b7f4bf9 100644 --- a/test/libsolidity/semanticTests/state/block_coinbase.sol +++ b/test/libsolidity/semanticTests/state/block_coinbase.sol @@ -5,6 +5,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x7878787878787878787878787878787878787878 // f() -> 0x7878787878787878787878787878787878787878 diff --git a/test/libsolidity/semanticTests/state/block_gaslimit.sol b/test/libsolidity/semanticTests/state/block_gaslimit.sol index 7fb313825..c9eec9621 100644 --- a/test/libsolidity/semanticTests/state/block_gaslimit.sol +++ b/test/libsolidity/semanticTests/state/block_gaslimit.sol @@ -5,6 +5,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 20000000 // f() -> 20000000 diff --git a/test/libsolidity/semanticTests/state/block_number.sol b/test/libsolidity/semanticTests/state/block_number.sol index a08261b92..031c84829 100644 --- a/test/libsolidity/semanticTests/state/block_number.sol +++ b/test/libsolidity/semanticTests/state/block_number.sol @@ -6,6 +6,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // constructor() // f() -> 2 diff --git a/test/libsolidity/semanticTests/state/block_timestamp.sol b/test/libsolidity/semanticTests/state/block_timestamp.sol index 4b4bba38d..73e7d9491 100644 --- a/test/libsolidity/semanticTests/state/block_timestamp.sol +++ b/test/libsolidity/semanticTests/state/block_timestamp.sol @@ -6,7 +6,8 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- -// constructor() # This is the 1st block # -// f() -> 0x1e # This is the 2nd block (each block is "15 seconds") # -// f() -> 0x2d # This is the 3rd block # +// constructor() # This is the 1st block # +// f() -> 0x1e # This is the 2nd block (each block is "15 seconds") # +// f() -> 0x2d # This is the 3rd block # diff --git a/test/libsolidity/semanticTests/state/gasleft.sol b/test/libsolidity/semanticTests/state/gasleft.sol index 0339ff17a..0d6118aa1 100644 --- a/test/libsolidity/semanticTests/state/gasleft.sol +++ b/test/libsolidity/semanticTests/state/gasleft.sol @@ -5,6 +5,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> true // f() -> true diff --git a/test/libsolidity/semanticTests/state/msg_sender.sol b/test/libsolidity/semanticTests/state/msg_sender.sol index 57c7fd5f3..d7c129863 100644 --- a/test/libsolidity/semanticTests/state/msg_sender.sol +++ b/test/libsolidity/semanticTests/state/msg_sender.sol @@ -5,5 +5,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x1212121212121212121212121212120000000012 diff --git a/test/libsolidity/semanticTests/state/msg_sig.sol b/test/libsolidity/semanticTests/state/msg_sig.sol index e7c7b1b75..69d87106a 100644 --- a/test/libsolidity/semanticTests/state/msg_sig.sol +++ b/test/libsolidity/semanticTests/state/msg_sig.sol @@ -8,6 +8,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x26121ff000000000000000000000000000000000000000000000000000000000 // g() -> 0xe2179b8e00000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/state/tx_origin.sol b/test/libsolidity/semanticTests/state/tx_origin.sol index 34f19f616..ea9d574ef 100644 --- a/test/libsolidity/semanticTests/state/tx_origin.sol +++ b/test/libsolidity/semanticTests/state/tx_origin.sol @@ -5,6 +5,7 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x9292929292929292929292929292929292929292 // f() -> 0x9292929292929292929292929292929292929292 diff --git a/test/libsolidity/semanticTests/state/uncalled_blockhash.sol b/test/libsolidity/semanticTests/state/uncalled_blockhash.sol index 9a964335d..007cd9788 100644 --- a/test/libsolidity/semanticTests/state/uncalled_blockhash.sol +++ b/test/libsolidity/semanticTests/state/uncalled_blockhash.sol @@ -5,5 +5,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x3737373737373737373737373737373737373737373737373737373737373738 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_signed.sol b/test/libsolidity/semanticTests/storage/packed_storage_signed.sol index 2f789a41b..861d955c3 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_signed.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_signed.sol @@ -22,5 +22,6 @@ contract C { // ==== // compileViaYul: also +// compileToEwasm: also // ---- // test() -> -2, 4, -112, 0 diff --git a/test/libsolidity/semanticTests/strings/string_escapes.sol b/test/libsolidity/semanticTests/strings/string_escapes.sol index 66a8b1ea3..a53998a1d 100644 --- a/test/libsolidity/semanticTests/strings/string_escapes.sol +++ b/test/libsolidity/semanticTests/strings/string_escapes.sol @@ -6,5 +6,6 @@ contract test { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> 0x090a0d27225c0000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol index bac400295..5f6c54b2d 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol @@ -20,5 +20,6 @@ contract C { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f((uint32,uint256[],uint64)): 0x20, 42, 0x60, 23, 2, 1, 2 -> 42, 1, 2, 23 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol index 9fa78f530..bfdb36858 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol @@ -21,5 +21,6 @@ contract Test { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol index 2477ad963..0149b479e 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol @@ -21,5 +21,6 @@ contract Test { } // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/various/balance.sol b/test/libsolidity/semanticTests/various/balance.sol index 99fdf4da7..7a479700b 100644 --- a/test/libsolidity/semanticTests/various/balance.sol +++ b/test/libsolidity/semanticTests/various/balance.sol @@ -8,6 +8,7 @@ contract test { // ==== // compileViaYul: also +// compileToEwasm: also // ---- // constructor(), 23 wei -> // getBalance() -> 23 diff --git a/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol b/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol index e957fbc8e..dc702c744 100644 --- a/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol +++ b/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol @@ -17,5 +17,6 @@ contract C { // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/various/nested_calldata_struct.sol b/test/libsolidity/semanticTests/various/nested_calldata_struct.sol index 6a05524f5..2f72d72cc 100644 --- a/test/libsolidity/semanticTests/various/nested_calldata_struct.sol +++ b/test/libsolidity/semanticTests/various/nested_calldata_struct.sol @@ -24,5 +24,6 @@ contract C { // ==== // compileViaYul: also +// compileToEwasm: also // ---- // f((uint256,uint256,(uint256,uint256),uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5 diff --git a/test/libyul/ewasmTranslationTests/address.yul b/test/libyul/ewasmTranslationTests/address.yul index 405e8c09b..0290bad4d 100644 --- a/test/libyul/ewasmTranslationTests/address.yul +++ b/test/libyul/ewasmTranslationTests/address.yul @@ -4,6 +4,6 @@ // ---- // Trace: // Memory dump: -// 20: 0000000000000000000000000000000011111111000000000000000000000000 +// 20: 0000000000000000000000000000000000000000000000000000000011111111 // Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000011111111000000000000000000000000 +// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000011111111 diff --git a/test/libyul/ewasmTranslationTests/balance.yul b/test/libyul/ewasmTranslationTests/balance.yul index e9adc3470..f8bb5017a 100644 --- a/test/libyul/ewasmTranslationTests/balance.yul +++ b/test/libyul/ewasmTranslationTests/balance.yul @@ -6,7 +6,7 @@ // Trace: // Memory dump: // 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 0000000000000000000000000000000022222222000000000000000000000000 +// 20: 0000000000000000000000000000000000000000000000000000000022222222 // Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000022222222000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000022222222000000000000000000000000 +// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000022222222 +// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000022222222 diff --git a/test/libyul/ewasmTranslationTests/caller.yul b/test/libyul/ewasmTranslationTests/caller.yul index 8da3ba23d..1abb288d5 100644 --- a/test/libyul/ewasmTranslationTests/caller.yul +++ b/test/libyul/ewasmTranslationTests/caller.yul @@ -4,6 +4,6 @@ // ---- // Trace: // Memory dump: -// 20: 0000000000000000000000000000000044444444000000000000000000000000 +// 20: 0000000000000000000000000000000000000000000000000000000044444444 // Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000044444444000000000000000000000000 +// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000044444444 diff --git a/test/libyul/ewasmTranslationTests/coinbase.yul b/test/libyul/ewasmTranslationTests/coinbase.yul index ad9eac9cc..b83e298f5 100644 --- a/test/libyul/ewasmTranslationTests/coinbase.yul +++ b/test/libyul/ewasmTranslationTests/coinbase.yul @@ -4,6 +4,6 @@ // ---- // Trace: // Memory dump: -// 20: 0000000000000000000000000000000077777777000000000000000000000000 +// 20: 0000000000000000000000000000000000000000000000000000000077777777 // Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000077777777000000000000000000000000 +// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000077777777 diff --git a/test/libyul/ewasmTranslationTests/extcodehash.yul b/test/libyul/ewasmTranslationTests/extcodehash.yul index 1ee4b0e39..26bc4f8b4 100644 --- a/test/libyul/ewasmTranslationTests/extcodehash.yul +++ b/test/libyul/ewasmTranslationTests/extcodehash.yul @@ -7,5 +7,5 @@ // Trace: // INVALID() // Memory dump: -// 0: 0000000000000000000000000000000011111111000000000000000000000000 +// 0: 0000000000000000000000000000000000000000000000000000000011111111 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/extcodesize.yul b/test/libyul/ewasmTranslationTests/extcodesize.yul index 99df58cbc..fb12db5ea 100644 --- a/test/libyul/ewasmTranslationTests/extcodesize.yul +++ b/test/libyul/ewasmTranslationTests/extcodesize.yul @@ -4,6 +4,6 @@ // ---- // Trace: // Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000dd6 +// 20: 000000000000000000000000000000000000000000000000000000000000077b // Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000dd6 +// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000077b diff --git a/test/libyul/ewasmTranslationTests/origin.yul b/test/libyul/ewasmTranslationTests/origin.yul index 95523283c..16fe9181f 100644 --- a/test/libyul/ewasmTranslationTests/origin.yul +++ b/test/libyul/ewasmTranslationTests/origin.yul @@ -4,6 +4,6 @@ // ---- // Trace: // Memory dump: -// 20: 0000000000000000000000000000000033333333000000000000000000000000 +// 20: 0000000000000000000000000000000000000000000000000000000033333333 // Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000033333333000000000000000000000000 +// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000033333333