mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove EWASM backend.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
sstore(0, 1)
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
|
||||
======= evm_to_wasm/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code { { sstore(0, 1) } }
|
||||
}
|
||||
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32)
|
||||
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32)))))
|
||||
i64.store(0:i32, y)
|
||||
i64.store(i32.add(0:i32, 8:i32), y)
|
||||
i64.store(i32.add(0:i32, 16:i32), y)
|
||||
i64.store(i32.add(0:i32, 24:i32), y)
|
||||
i64.store(32:i32, y)
|
||||
i64.store(i32.add(32:i32, 8:i32), y)
|
||||
i64.store(i32.add(32:i32, 16:i32), y)
|
||||
let hi_1 := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(1))), 32)
|
||||
i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(1, 32))))))
|
||||
eth.storageStore(0:i32, 32:i32)
|
||||
}
|
||||
function bswap16(x:i32) -> y:i32
|
||||
{
|
||||
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:i32) -> y:i32
|
||||
{
|
||||
let hi:i32 := i32.shl(bswap16(x), 16:i32)
|
||||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d01000000010e0360000060017f017f60027f7f0002190108657468657265756d0c73746f7261676553746f726500020304030001010503010001060100071102066d656d6f72790200046d61696e00010ac70103850101037e02404200a71003ad422086210020004200422088a71003ad84210141002001370000410041086a2001370000410041106a2001370000410041186a200137000041202001370000412041086a2001370000412041106a20013700004201a71003ad4220862102412041186a20024201422088a71003ad843700004100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
|
||||
(func $main
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $hi_1 i64)
|
||||
(block $label_
|
||||
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
|
||||
(i64.store (i32.const 0) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y))
|
||||
(i64.store (i32.const 32) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 16)) (local.get $y))
|
||||
(local.set $hi_1 (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 1)))) (i64.const 32)))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 24)) (i64.or (local.get $hi_1) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 1) (i64.const 32)))))))
|
||||
(call $eth.storageStore (i32.const 0) (i32.const 32))
|
||||
)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__1
|
||||
(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 i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__2
|
||||
(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)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
let x := calldataload(0)
|
||||
for { } lt(x, 10) { x := add(x, 1) } {
|
||||
if eq(x, 2) { break }
|
||||
if eq(x, 4) { continue }
|
||||
}
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,583 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_break/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code {
|
||||
{
|
||||
let x := calldataload(0)
|
||||
for { } lt(x, 10) { x := add(x, 1) }
|
||||
{
|
||||
if eq(x, 2) { break }
|
||||
if eq(x, 4) { continue }
|
||||
}
|
||||
sstore(0, x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let x, x_1, x_2, x_3 := calldataload()
|
||||
let x_4 := x
|
||||
let x_5 := x_1
|
||||
let x_6 := x_2
|
||||
let x_7 := x_3
|
||||
let _1:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, 1)))))
|
||||
for { }
|
||||
i32.eqz(_1)
|
||||
{
|
||||
let x_8, x_9, x_10, x_11 := add(x_4, x_5, x_6, x_7)
|
||||
x_4 := x_8
|
||||
x_5 := x_9
|
||||
x_6 := x_10
|
||||
x_7 := x_11
|
||||
}
|
||||
{
|
||||
let _2, _3, _4, _5 := iszero_1324_2108(lt(x_4, x_5, x_6, x_7))
|
||||
if i32.eqz(i64.eqz(i64.or(i64.or(_2, _3), i64.or(_4, _5)))) { break }
|
||||
let _6, _7, _8, _9 := eq_771_2109(x_4, x_5, x_6, x_7)
|
||||
if i32.eqz(i64.eqz(i64.or(i64.or(_6, _7), i64.or(_8, _9)))) { break }
|
||||
let _10, _11, _12, _13 := eq_772_2110(x_4, x_5, x_6, x_7)
|
||||
if i32.eqz(i64.eqz(i64.or(i64.or(_10, _11), i64.or(_12, _13)))) { continue }
|
||||
}
|
||||
sstore(x_4, x_5, x_6, x_7)
|
||||
}
|
||||
function add(x1, x2, x3, x4) -> r1, r2, r3, r4
|
||||
{
|
||||
let t := i64.add(x4, 1)
|
||||
r4 := i64.add(t, 0)
|
||||
let t_1 := i64.add(x3, 0)
|
||||
r3 := i64.add(t_1, i64.extend_i32_u(i32.or(i64.lt_u(t, x4), i64.lt_u(r4, t))))
|
||||
let t_2 := i64.add(x2, 0)
|
||||
r2 := i64.add(t_2, i64.extend_i32_u(i32.or(i64.lt_u(t_1, x3), i64.lt_u(r3, t_1))))
|
||||
r1 := i64.add(i64.add(x1, 0), i64.extend_i32_u(i32.or(i64.lt_u(t_2, x2), i64.lt_u(r2, t_2))))
|
||||
}
|
||||
function iszero_1324_2108(x4) -> r1, r2, r3, r4
|
||||
{
|
||||
r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, x4))))
|
||||
}
|
||||
function eq_771_2109(x1, x2, x3, x4) -> r1, r2, r3, r4
|
||||
{
|
||||
r4 := i64.extend_i32_u(i32.and(i64.eq(x1, 0), i32.and(i64.eq(x2, 0), i32.and(i64.eq(x3, 0), i64.eq(x4, 2)))))
|
||||
}
|
||||
function eq_772_2110(x1, x2, x3, x4) -> r1, r2, r3, r4
|
||||
{
|
||||
r4 := i64.extend_i32_u(i32.and(i64.eq(x1, 0), i32.and(i64.eq(x2, 0), i32.and(i64.eq(x3, 0), i64.eq(x4, 4)))))
|
||||
}
|
||||
function lt(x1, x2, x3, x4) -> z4
|
||||
{
|
||||
let z:i32 := false
|
||||
let _1 := 0
|
||||
let _2:i32 := 0xffffffff:i32
|
||||
switch i32.select(_2, i64.ne(x1, _1), i64.lt_u(x1, _1))
|
||||
case 0:i32 {
|
||||
switch i32.select(_2, i64.ne(x2, _1), i64.lt_u(x2, _1))
|
||||
case 0:i32 {
|
||||
switch i32.select(_2, i64.ne(x3, _1), i64.lt_u(x3, _1))
|
||||
case 0:i32 { z := i64.lt_u(x4, 10) }
|
||||
case 1:i32 { z := 0:i32 }
|
||||
default { z := 1:i32 }
|
||||
}
|
||||
case 1:i32 { z := 0:i32 }
|
||||
default { z := 1:i32 }
|
||||
}
|
||||
case 1:i32 { z := 0:i32 }
|
||||
default { z := 1:i32 }
|
||||
z4 := i64.extend_i32_u(z)
|
||||
}
|
||||
function u256_to_i32_774() -> v:i32
|
||||
{
|
||||
let _1 := 0
|
||||
if i64.ne(_1, i64.or(i64.or(_1, _1), _1)) { unreachable() }
|
||||
if i64.ne(_1, i64.shr_u(_1, 32)) { unreachable() }
|
||||
v := i32.wrap_i64(_1)
|
||||
}
|
||||
function u256_to_i32() -> v:i32
|
||||
{
|
||||
if i64.ne(0, i64.or(i64.or(0, 0), 0)) { unreachable() }
|
||||
if i64.ne(0, i64.shr_u(32, 32)) { unreachable() }
|
||||
v := i32.wrap_i64(32)
|
||||
}
|
||||
function bswap16(x:i32) -> y:i32
|
||||
{
|
||||
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:i32) -> y:i32
|
||||
{
|
||||
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(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() -> z1, z2, z3, z4
|
||||
{
|
||||
let cds:i32 := eth.getCallDataSize()
|
||||
let destination:i32 := u256_to_i32_774()
|
||||
let offset:i32 := u256_to_i32_774()
|
||||
let requested_size:i32 := u256_to_i32()
|
||||
if i32.gt_u(offset, i32.sub(0xffffffff:i32, requested_size)) { eth.revert(0:i32, 0:i32) }
|
||||
let available_size:i32 := i32.sub(cds, offset)
|
||||
if i32.gt_u(offset, cds) { available_size := 0:i32 }
|
||||
let _1:i32 := 0:i32
|
||||
if i32.gt_u(available_size, _1)
|
||||
{
|
||||
eth.callDataCopy(destination, offset, available_size)
|
||||
}
|
||||
if i32.gt_u(requested_size, available_size)
|
||||
{
|
||||
let _2:i32 := i32.sub(requested_size, available_size)
|
||||
let _3:i32 := i32.add(destination, available_size)
|
||||
let i:i32 := _1
|
||||
for { } i32.lt_u(i, _2) { i := i32.add(i, 1:i32) }
|
||||
{
|
||||
i32.store8(i32.add(_3, i), _1)
|
||||
}
|
||||
}
|
||||
let z1_1 := bswap64(i64.load(_1))
|
||||
let z2_1 := bswap64(i64.load(i32.add(_1, 8:i32)))
|
||||
let z3_1 := bswap64(i64.load(i32.add(_1, 16:i32)))
|
||||
let z4_1 := bswap64(i64.load(i32.add(_1, 24:i32)))
|
||||
z1 := z1_1
|
||||
z2 := z2_1
|
||||
z3 := z3_1
|
||||
z4 := z4_1
|
||||
}
|
||||
function sstore(y1, y2, y3, y4)
|
||||
{
|
||||
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32)
|
||||
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32)))))
|
||||
i64.store(0:i32, y)
|
||||
i64.store(i32.add(0:i32, 8:i32), y)
|
||||
i64.store(i32.add(0:i32, 16:i32), y)
|
||||
i64.store(i32.add(0:i32, 24:i32), y)
|
||||
i64.store(32:i32, bswap64(y1))
|
||||
i64.store(i32.add(32:i32, 8:i32), bswap64(y2))
|
||||
i64.store(i32.add(32:i32, 16:i32), bswap64(y3))
|
||||
i64.store(i32.add(32:i32, 24:i32), bswap64(y4))
|
||||
eth.storageStore(0:i32, 32:i32)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d010000000130096000006000017e6000017f60017e017e60047e7e7e7e0060047e7e7e7e017e60017f017f60027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000708657468657265756d06726576657274000708657468657265756d0f67657443616c6c4461746153697a65000208657468657265756d0c63616c6c44617461436f70790008030e0d0005030505050202060603010405030100010615047e0142000b7e0142000b7e0142000b7f0141000b071102066d656d6f72790200046d61696e00040abd090d8d0203087e017f107e02400240100f21002300210123012102230221030b200021042001210520022106200321074200420084420042018484504545210802400340200845450d010240024020042005200620071009100621092303210a2300210b2301210c0b2009200a84200b200c8484504504400c030b024020042005200620071007210d2300210e2301210f230221100b200d200e84200f20108484504504400c030b02402004200520062007100821112300211223012113230221140b2011201284201320148484504504400c010b0b02402004200520062007100521152300211623012117230221180b201521042016210520172106201821070c000b0b200420052006200710100b0b6701077e0240200342017c2108200842007c2107200242007c210920092008200354200720085472ad7c2106200142007c210a200a2009200254200620095472ad7c2105200042007c200a2001542005200a5472ad7c21040b20052400200624012007240220040b2401047e0240420042008442002000848450ad21040b20022400200324012004240220010b2f01047e02402000420051200142005120024200512003420251717171ad21070b20052400200624012007240220040b2f01047e02402000420051200142005120024200512003420451717171ad21070b20052400200624012007240220040bab0104017e017f017e047f02404100210542002106417f210702402007200020065220002006541b21082008410046044002402007200120065220012006541b21092009410046044002402007200220065220022006541b210a200a41004604402003420a54210505200a41014604404100210505410121050b0b0b05200941014604404100210505410121050b0b0b05200841014604404100210505410121050b0b0b2005ad21040b20040b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b2901017f024042004200420084420084520440000b42004220422088520440000b4220a721000b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100c411074210220022000411076100c7221010b20010b2201027e02402000a7100dad422086210220022000422088a7100dad8421010b20010bdc0103047e097f047e024010022104100a2105100a2106100b21072006417f20076b4b04404100410010010b200420066b2108200620044b0440410021080b41002109200820094b044020052006200810030b200720084b0440200720086b210a200520086a210b2009210c02400340200c200a49450d010240200b200c6a20093a00000b200c41016a210c0c000b0b0b2009290000100e210d200941086a290000100e210e200941106a290000100e210f200941186a290000100e2110200d2100200e2101200f2102201021030b20012400200224012003240220000b7801027e02404200a7100dad422086210420044200422088a7100dad84210541002005370000410041086a2005370000410041106a2005370000410041186a200537000041202000100e370000412041086a2001100e370000412041106a2002100e370000412041186a2003100e3700004100412010000b0b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
|
||||
(import "ethereum" "revert" (func $eth.revert (param i32 i32)))
|
||||
(import "ethereum" "getCallDataSize" (func $eth.getCallDataSize (result i32)))
|
||||
(import "ethereum" "callDataCopy" (func $eth.callDataCopy (param i32 i32 i32)))
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
(global $global_ (mut i64) (i64.const 0))
|
||||
(global $global__1 (mut i64) (i64.const 0))
|
||||
(global $global__2 (mut i64) (i64.const 0))
|
||||
(global $global__6 (mut i32) (i32.const 0))
|
||||
|
||||
(func $main
|
||||
(local $x i64)
|
||||
(local $x_1 i64)
|
||||
(local $x_2 i64)
|
||||
(local $x_3 i64)
|
||||
(local $x_4 i64)
|
||||
(local $x_5 i64)
|
||||
(local $x_6 i64)
|
||||
(local $x_7 i64)
|
||||
(local $_1 i32)
|
||||
(local $_2 i64)
|
||||
(local $_3 i64)
|
||||
(local $_4 i64)
|
||||
(local $_5 i64)
|
||||
(local $_6 i64)
|
||||
(local $_7 i64)
|
||||
(local $_8 i64)
|
||||
(local $_9 i64)
|
||||
(local $_10 i64)
|
||||
(local $_11 i64)
|
||||
(local $_12 i64)
|
||||
(local $_13 i64)
|
||||
(local $x_8 i64)
|
||||
(local $x_9 i64)
|
||||
(local $x_10 i64)
|
||||
(local $x_11 i64)
|
||||
(block $label_
|
||||
(block
|
||||
(local.set $x (call $calldataload))
|
||||
(local.set $x_1 (global.get $global_))
|
||||
(local.set $x_2 (global.get $global__1))
|
||||
(local.set $x_3 (global.get $global__2))
|
||||
|
||||
)
|
||||
(local.set $x_4 (local.get $x))
|
||||
(local.set $x_5 (local.get $x_1))
|
||||
(local.set $x_6 (local.get $x_2))
|
||||
(local.set $x_7 (local.get $x_3))
|
||||
(local.set $_1 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (i64.const 0) (i64.const 1)))))))
|
||||
(block $label__3
|
||||
(loop $label__5
|
||||
(br_if $label__3 (i32.eqz (i32.eqz (local.get $_1))))
|
||||
(block $label__4
|
||||
(block
|
||||
(local.set $_2 (call $iszero_1324_2108 (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))))
|
||||
(local.set $_3 (global.get $global__6))
|
||||
(local.set $_4 (global.get $global_))
|
||||
(local.set $_5 (global.get $global__1))
|
||||
|
||||
)
|
||||
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_2) (local.get $_3)) (i64.or (local.get $_4) (local.get $_5))))) (then
|
||||
(br $label__3)
|
||||
))
|
||||
(block
|
||||
(local.set $_6 (call $eq_771_2109 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))
|
||||
(local.set $_7 (global.get $global_))
|
||||
(local.set $_8 (global.get $global__1))
|
||||
(local.set $_9 (global.get $global__2))
|
||||
|
||||
)
|
||||
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_6) (local.get $_7)) (i64.or (local.get $_8) (local.get $_9))))) (then
|
||||
(br $label__3)
|
||||
))
|
||||
(block
|
||||
(local.set $_10 (call $eq_772_2110 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))
|
||||
(local.set $_11 (global.get $global_))
|
||||
(local.set $_12 (global.get $global__1))
|
||||
(local.set $_13 (global.get $global__2))
|
||||
|
||||
)
|
||||
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_10) (local.get $_11)) (i64.or (local.get $_12) (local.get $_13))))) (then
|
||||
(br $label__4)
|
||||
))
|
||||
|
||||
)
|
||||
(block
|
||||
(local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))
|
||||
(local.set $x_9 (global.get $global_))
|
||||
(local.set $x_10 (global.get $global__1))
|
||||
(local.set $x_11 (global.get $global__2))
|
||||
|
||||
)
|
||||
(local.set $x_4 (local.get $x_8))
|
||||
(local.set $x_5 (local.get $x_9))
|
||||
(local.set $x_6 (local.get $x_10))
|
||||
(local.set $x_7 (local.get $x_11))
|
||||
(br $label__5)
|
||||
)
|
||||
|
||||
)
|
||||
(call $sstore (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))
|
||||
)
|
||||
)
|
||||
|
||||
(func $add
|
||||
(param $x1 i64)
|
||||
(param $x2 i64)
|
||||
(param $x3 i64)
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $r1 i64)
|
||||
(local $r2 i64)
|
||||
(local $r3 i64)
|
||||
(local $r4 i64)
|
||||
(local $t i64)
|
||||
(local $t_1 i64)
|
||||
(local $t_2 i64)
|
||||
(block $label__7
|
||||
(local.set $t (i64.add (local.get $x4) (i64.const 1)))
|
||||
(local.set $r4 (i64.add (local.get $t) (i64.const 0)))
|
||||
(local.set $t_1 (i64.add (local.get $x3) (i64.const 0)))
|
||||
(local.set $r3 (i64.add (local.get $t_1) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x4)) (i64.lt_u (local.get $r4) (local.get $t))))))
|
||||
(local.set $t_2 (i64.add (local.get $x2) (i64.const 0)))
|
||||
(local.set $r2 (i64.add (local.get $t_2) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t_1) (local.get $x3)) (i64.lt_u (local.get $r3) (local.get $t_1))))))
|
||||
(local.set $r1 (i64.add (i64.add (local.get $x1) (i64.const 0)) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t_2) (local.get $x2)) (i64.lt_u (local.get $r2) (local.get $t_2))))))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $r2))
|
||||
(global.set $global__1 (local.get $r3))
|
||||
(global.set $global__2 (local.get $r4))
|
||||
(local.get $r1)
|
||||
)
|
||||
|
||||
(func $iszero_1324_2108
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $r1 i64)
|
||||
(local $r2 i64)
|
||||
(local $r3 i64)
|
||||
(local $r4 i64)
|
||||
(block $label__8
|
||||
(local.set $r4 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (i64.const 0) (local.get $x4))))))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $r2))
|
||||
(global.set $global__1 (local.get $r3))
|
||||
(global.set $global__2 (local.get $r4))
|
||||
(local.get $r1)
|
||||
)
|
||||
|
||||
(func $eq_771_2109
|
||||
(param $x1 i64)
|
||||
(param $x2 i64)
|
||||
(param $x3 i64)
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $r1 i64)
|
||||
(local $r2 i64)
|
||||
(local $r3 i64)
|
||||
(local $r4 i64)
|
||||
(block $label__9
|
||||
(local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (i64.const 0)) (i32.and (i64.eq (local.get $x2) (i64.const 0)) (i32.and (i64.eq (local.get $x3) (i64.const 0)) (i64.eq (local.get $x4) (i64.const 2)))))))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $r2))
|
||||
(global.set $global__1 (local.get $r3))
|
||||
(global.set $global__2 (local.get $r4))
|
||||
(local.get $r1)
|
||||
)
|
||||
|
||||
(func $eq_772_2110
|
||||
(param $x1 i64)
|
||||
(param $x2 i64)
|
||||
(param $x3 i64)
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $r1 i64)
|
||||
(local $r2 i64)
|
||||
(local $r3 i64)
|
||||
(local $r4 i64)
|
||||
(block $label__10
|
||||
(local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (i64.const 0)) (i32.and (i64.eq (local.get $x2) (i64.const 0)) (i32.and (i64.eq (local.get $x3) (i64.const 0)) (i64.eq (local.get $x4) (i64.const 4)))))))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $r2))
|
||||
(global.set $global__1 (local.get $r3))
|
||||
(global.set $global__2 (local.get $r4))
|
||||
(local.get $r1)
|
||||
)
|
||||
|
||||
(func $lt
|
||||
(param $x1 i64)
|
||||
(param $x2 i64)
|
||||
(param $x3 i64)
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $z4 i64)
|
||||
(local $z i32)
|
||||
(local $_1 i64)
|
||||
(local $_2 i32)
|
||||
(local $condition i32)
|
||||
(local $condition_12 i32)
|
||||
(local $condition_13 i32)
|
||||
(block $label__11
|
||||
(local.set $z (i32.const 0))
|
||||
(local.set $_1 (i64.const 0))
|
||||
(local.set $_2 (i32.const 4294967295))
|
||||
(block
|
||||
(local.set $condition (select (local.get $_2) (i64.ne (local.get $x1) (local.get $_1)) (i64.lt_u (local.get $x1) (local.get $_1))))
|
||||
(if (i32.eq (local.get $condition) (i32.const 0)) (then
|
||||
(block
|
||||
(local.set $condition_12 (select (local.get $_2) (i64.ne (local.get $x2) (local.get $_1)) (i64.lt_u (local.get $x2) (local.get $_1))))
|
||||
(if (i32.eq (local.get $condition_12) (i32.const 0)) (then
|
||||
(block
|
||||
(local.set $condition_13 (select (local.get $_2) (i64.ne (local.get $x3) (local.get $_1)) (i64.lt_u (local.get $x3) (local.get $_1))))
|
||||
(if (i32.eq (local.get $condition_13) (i32.const 0)) (then
|
||||
(local.set $z (i64.lt_u (local.get $x4) (i64.const 10)))
|
||||
)(else
|
||||
(if (i32.eq (local.get $condition_13) (i32.const 1)) (then
|
||||
(local.set $z (i32.const 0))
|
||||
)(else
|
||||
(local.set $z (i32.const 1))
|
||||
))
|
||||
))
|
||||
|
||||
)
|
||||
)(else
|
||||
(if (i32.eq (local.get $condition_12) (i32.const 1)) (then
|
||||
(local.set $z (i32.const 0))
|
||||
)(else
|
||||
(local.set $z (i32.const 1))
|
||||
))
|
||||
))
|
||||
|
||||
)
|
||||
)(else
|
||||
(if (i32.eq (local.get $condition) (i32.const 1)) (then
|
||||
(local.set $z (i32.const 0))
|
||||
)(else
|
||||
(local.set $z (i32.const 1))
|
||||
))
|
||||
))
|
||||
|
||||
)
|
||||
(local.set $z4 (i64.extend_i32_u (local.get $z)))
|
||||
|
||||
)
|
||||
(local.get $z4)
|
||||
)
|
||||
|
||||
(func $u256_to_i32_774
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(local $_1 i64)
|
||||
(block $label__14
|
||||
(local.set $_1 (i64.const 0))
|
||||
(if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then
|
||||
(unreachable)))
|
||||
(if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (local.get $_1)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $u256_to_i32
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(block $label__15
|
||||
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
|
||||
(unreachable)))
|
||||
(if (i64.ne (i64.const 0) (i64.shr_u (i64.const 32) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (i64.const 32)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__16
|
||||
(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 i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__17
|
||||
(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)
|
||||
)
|
||||
|
||||
(func $bswap64
|
||||
(param $x i64)
|
||||
(result i64)
|
||||
(local $y i64)
|
||||
(local $hi i64)
|
||||
(block $label__18
|
||||
(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)
|
||||
)
|
||||
|
||||
(func $calldataload
|
||||
(result i64)
|
||||
(local $z1 i64)
|
||||
(local $z2 i64)
|
||||
(local $z3 i64)
|
||||
(local $z4 i64)
|
||||
(local $cds i32)
|
||||
(local $destination i32)
|
||||
(local $offset i32)
|
||||
(local $requested_size i32)
|
||||
(local $available_size i32)
|
||||
(local $_1 i32)
|
||||
(local $_2 i32)
|
||||
(local $_3 i32)
|
||||
(local $i i32)
|
||||
(local $z1_1 i64)
|
||||
(local $z2_1 i64)
|
||||
(local $z3_1 i64)
|
||||
(local $z4_1 i64)
|
||||
(block $label__19
|
||||
(local.set $cds (call $eth.getCallDataSize))
|
||||
(local.set $destination (call $u256_to_i32_774))
|
||||
(local.set $offset (call $u256_to_i32_774))
|
||||
(local.set $requested_size (call $u256_to_i32))
|
||||
(if (i32.gt_u (local.get $offset) (i32.sub (i32.const 4294967295) (local.get $requested_size))) (then
|
||||
(call $eth.revert (i32.const 0) (i32.const 0))))
|
||||
(local.set $available_size (i32.sub (local.get $cds) (local.get $offset)))
|
||||
(if (i32.gt_u (local.get $offset) (local.get $cds)) (then
|
||||
(local.set $available_size (i32.const 0))
|
||||
))
|
||||
(local.set $_1 (i32.const 0))
|
||||
(if (i32.gt_u (local.get $available_size) (local.get $_1)) (then
|
||||
(call $eth.callDataCopy (local.get $destination) (local.get $offset) (local.get $available_size))))
|
||||
(if (i32.gt_u (local.get $requested_size) (local.get $available_size)) (then
|
||||
(local.set $_2 (i32.sub (local.get $requested_size) (local.get $available_size)))
|
||||
(local.set $_3 (i32.add (local.get $destination) (local.get $available_size)))
|
||||
(local.set $i (local.get $_1))
|
||||
(block $label__20
|
||||
(loop $label__22
|
||||
(br_if $label__20 (i32.eqz (i32.lt_u (local.get $i) (local.get $_2))))
|
||||
(block $label__21
|
||||
(i32.store8 (i32.add (local.get $_3) (local.get $i)) (local.get $_1))
|
||||
)
|
||||
(local.set $i (i32.add (local.get $i) (i32.const 1)))
|
||||
(br $label__22)
|
||||
)
|
||||
|
||||
)
|
||||
))
|
||||
(local.set $z1_1 (call $bswap64 (i64.load (local.get $_1))))
|
||||
(local.set $z2_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 8)))))
|
||||
(local.set $z3_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 16)))))
|
||||
(local.set $z4_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 24)))))
|
||||
(local.set $z1 (local.get $z1_1))
|
||||
(local.set $z2 (local.get $z2_1))
|
||||
(local.set $z3 (local.get $z3_1))
|
||||
(local.set $z4 (local.get $z4_1))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $z2))
|
||||
(global.set $global__1 (local.get $z3))
|
||||
(global.set $global__2 (local.get $z4))
|
||||
(local.get $z1)
|
||||
)
|
||||
|
||||
(func $sstore
|
||||
(param $y1 i64)
|
||||
(param $y2 i64)
|
||||
(param $y3 i64)
|
||||
(param $y4 i64)
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(block $label__23
|
||||
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
|
||||
(i64.store (i32.const 0) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y))
|
||||
(i64.store (i32.const 32) (call $bswap64 (local.get $y1)))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 8)) (call $bswap64 (local.get $y2)))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 16)) (call $bswap64 (local.get $y3)))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 24)) (call $bswap64 (local.get $y4)))
|
||||
(call $eth.storageStore (i32.const 0) (i32.const 32))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm --asm
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_output_selection_asm_only/input.yul (Ewasm) =======
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm --ewasm-ir
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_output_selection_ewasm_ir_only/input.yul (Ewasm) =======
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32)
|
||||
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32)))))
|
||||
i64.store(0:i32, y)
|
||||
i64.store(i32.add(0:i32, 8:i32), y)
|
||||
i64.store(i32.add(0:i32, 16:i32), y)
|
||||
i64.store(i32.add(0:i32, 24:i32), y)
|
||||
i64.store(32:i32, y)
|
||||
i64.store(i32.add(32:i32, 8:i32), y)
|
||||
i64.store(i32.add(32:i32, 16:i32), y)
|
||||
let hi_1 := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(42))), 32)
|
||||
i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(42, 32))))))
|
||||
eth.storageStore(0:i32, 32:i32)
|
||||
}
|
||||
function bswap16(x:i32) -> y:i32
|
||||
{
|
||||
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:i32) -> y:i32
|
||||
{
|
||||
let hi:i32 := i32.shl(bswap16(x), 16:i32)
|
||||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --optimize --yul-dialect evm --machine ewasm --ewasm
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
======= evm_to_wasm_output_selection_ewasm_only/input.yul (Ewasm) =======
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
|
||||
(func $main
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $hi_1 i64)
|
||||
(block $label_
|
||||
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
|
||||
(i64.store (i32.const 0) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y))
|
||||
(i64.store (i32.const 32) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 16)) (local.get $y))
|
||||
(local.set $hi_1 (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 42)))) (i64.const 32)))
|
||||
(i64.store (i32.add (i32.const 32) (i32.const 24)) (i64.or (local.get $hi_1) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 42) (i64.const 32)))))))
|
||||
(call $eth.storageStore (i32.const 0) (i32.const 32))
|
||||
)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__1
|
||||
(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 i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__2
|
||||
(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)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--assemble --machine ewasm
|
||||
@@ -1 +0,0 @@
|
||||
The selected input language is not directly supported when targeting the Ewasm machine and automatic translation is not available.
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
sstore(0, 1)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +1 @@
|
||||
--link --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
--link --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
|
||||
@@ -1 +1 @@
|
||||
The following outputs are not supported in linker mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --ewasm, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
The following outputs are not supported in linker mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--optimize --ewasm-ir
|
||||
@@ -1 +0,0 @@
|
||||
The following outputs are not supported in compiler mode: --ewasm-ir.
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,4 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
pragma solidity *;
|
||||
|
||||
contract C {}
|
||||
@@ -1 +1 @@
|
||||
--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --ewasm-ir --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
|
||||
@@ -1 +1 @@
|
||||
The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --ewasm, --ewasm-ir, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer":
|
||||
{
|
||||
"enabled": true,
|
||||
"details": {"yul": true}
|
||||
},
|
||||
"outputSelection":
|
||||
{
|
||||
"*": { "*": ["ewasm.wast", "ewasm.wasm"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
{
|
||||
"contracts":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"C":
|
||||
{
|
||||
"ewasm":
|
||||
{
|
||||
"wasm": "<BYTECODE REMOVED>",
|
||||
"wast": "(module
|
||||
;; custom section for sub-module
|
||||
;; The Keccak-256 hash of the text representation of <REMOVED>
|
||||
;; (@custom \"C_3_deployed\" \"<BYTECODE REMOVED>\")
|
||||
(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)))
|
||||
(import \"ethereum\" \"finish\" (func $eth.finish (param i32 i32)))
|
||||
(memory $memory (export \"memory\") 1)
|
||||
(export \"main\" (func $main))
|
||||
|
||||
(func $main
|
||||
(local $p i32)
|
||||
(local $r i32)
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $z3 i64)
|
||||
(local $_1 i64)
|
||||
(block $label_
|
||||
(local.set $p (call $u256_to_i32_716))
|
||||
(local.set $r (i32.add (local.get $p) (i32.const 64)))
|
||||
(if (i32.lt_u (local.get $r) (local.get $p)) (then
|
||||
(unreachable)))
|
||||
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32)))))))
|
||||
(i64.store (local.get $r) (local.get $y))
|
||||
(i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $y))
|
||||
(i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $y))
|
||||
(i64.store (i32.add (local.get $r) (i32.const 24)) (call $bswap64))
|
||||
(call $eth.getCallValue (i32.const 0))
|
||||
(local.set $z3 (i64.load (i32.const 8)))
|
||||
(if (i32.eqz (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (local.get $z3) (i64.load (i32.const 0)))))) (then
|
||||
(call $eth.revert (call $to_internal_i32ptr_334) (call $u256_to_i32_333))))
|
||||
(local.set $_1 (datasize \"C_3_deployed\"))
|
||||
(call $eth.codeCopy (call $to_internal_i32ptr) (call $u256_to_i32 (dataoffset \"C_3_deployed\")) (call $u256_to_i32 (local.get $_1)))
|
||||
(call $eth.finish (call $to_internal_i32ptr) (call $u256_to_i32 (local.get $_1)))
|
||||
)
|
||||
)
|
||||
|
||||
(func $u256_to_i32_333
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(local $_1 i64)
|
||||
(block $label__1
|
||||
(local.set $_1 (i64.const 0))
|
||||
(if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then
|
||||
(unreachable)))
|
||||
(if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (local.get $_1)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $u256_to_i32
|
||||
(param $x4 i64)
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(block $label__2
|
||||
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
|
||||
(unreachable)))
|
||||
(if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (local.get $x4)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $u256_to_i32_716
|
||||
(result i32)
|
||||
(local $v i32)
|
||||
(block $label__3
|
||||
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
|
||||
(unreachable)))
|
||||
(if (i64.ne (i64.const 0) (i64.shr_u (i64.const 64) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (i64.const 64)))
|
||||
|
||||
)
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $to_internal_i32ptr_334
|
||||
(result i32)
|
||||
(local $r i32)
|
||||
(local $p i32)
|
||||
(block $label__4
|
||||
(local.set $p (call $u256_to_i32_333))
|
||||
(local.set $r (i32.add (local.get $p) (i32.const 64)))
|
||||
(if (i32.lt_u (local.get $r) (local.get $p)) (then
|
||||
(unreachable)))
|
||||
|
||||
)
|
||||
(local.get $r)
|
||||
)
|
||||
|
||||
(func $to_internal_i32ptr
|
||||
(result i32)
|
||||
(local $r i32)
|
||||
(local $v i32)
|
||||
(block $label__5
|
||||
(if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then
|
||||
(unreachable)))
|
||||
(if (i64.ne (i64.const 0) (i64.shr_u (i64.const 128) (i64.const 32))) (then
|
||||
(unreachable)))
|
||||
(local.set $v (i32.wrap_i64 (i64.const 128)))
|
||||
(local.set $r (i32.add (local.get $v) (i32.const 64)))
|
||||
(if (i32.lt_u (local.get $r) (local.get $v)) (then
|
||||
(unreachable)))
|
||||
|
||||
)
|
||||
(local.get $r)
|
||||
)
|
||||
|
||||
(func $bswap16
|
||||
(param $x i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(block $label__6
|
||||
(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 i32)
|
||||
(result i32)
|
||||
(local $y i32)
|
||||
(local $hi i32)
|
||||
(block $label__7
|
||||
(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)
|
||||
)
|
||||
|
||||
(func $bswap64
|
||||
(result i64)
|
||||
(local $y i64)
|
||||
(local $hi i64)
|
||||
(block $label__8
|
||||
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 128)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 128) (i64.const 32)))))))
|
||||
|
||||
)
|
||||
(local.get $y)
|
||||
)
|
||||
|
||||
)
|
||||
"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"id": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; abstract contract C { }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer":
|
||||
{
|
||||
"enabled": true,
|
||||
"details": {"yul": true}
|
||||
},
|
||||
"outputSelection":
|
||||
{
|
||||
"*": { "*": ["ewasm.wast", "ewasm.wasm"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"contracts":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"C":
|
||||
{
|
||||
"ewasm":
|
||||
{
|
||||
"wasm": "",
|
||||
"wast": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"id": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
--yul-dialect evm --machine ewasm
|
||||
--yul-dialect evm --machine evm
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--strict-assembly --optimize --ewasm-ir
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
======= strict_asm_output_selection_ewasm_ir_only/input.yul (EVM) =======
|
||||
@@ -1 +0,0 @@
|
||||
--strict-assembly --optimize --ewasm
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
let x := 42
|
||||
sstore(0, x)
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
======= strict_asm_output_selection_ewasm_only/input.yul (EVM) =======
|
||||
@@ -1 +1 @@
|
||||
--strict-assembly --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
--strict-assembly --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--yul --yul-dialect ewasm --machine ewasm
|
||||
@@ -1,17 +0,0 @@
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let m:i64, n:i32, p:i32, q:i64 := multireturn(1:i32, 2:i64, 3:i64, 4:i32)
|
||||
}
|
||||
|
||||
function multireturn(a:i32, b:i64, c:i64, d:i32) -> x:i64, y:i32, z:i32, w:i64
|
||||
{
|
||||
x := b
|
||||
w := c
|
||||
|
||||
y := a
|
||||
z := d
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
|
||||
======= wasm_to_wasm_function_returning_multiple_values/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let m, n:i32, p:i32, q := multireturn(1:i32, 2, 3, 4:i32)
|
||||
}
|
||||
function multireturn(a:i32, b, c, d:i32) -> x, y:i32, z:i32, w
|
||||
{
|
||||
x := b
|
||||
w := c
|
||||
y := a
|
||||
z := d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d01000000010c0260000060047f7e7e7f017e020100030302000105030100010610037f0141000b7f0141000b7e0142000b071102066d656d6f72790200046d61696e00000a52022603017e027f017e024002404101420242034104100121002300210123012102230221030b0b0b2903017e027f017e0240200121042002210720002105200321060b20052400200624012007240220040b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
(global $global_ (mut i32) (i32.const 0))
|
||||
(global $global__1 (mut i32) (i32.const 0))
|
||||
(global $global__2 (mut i64) (i64.const 0))
|
||||
|
||||
(func $main
|
||||
(local $m i64)
|
||||
(local $n i32)
|
||||
(local $p i32)
|
||||
(local $q i64)
|
||||
(block $label_
|
||||
(block
|
||||
(local.set $m (call $multireturn (i32.const 1) (i64.const 2) (i64.const 3) (i32.const 4)))
|
||||
(local.set $n (global.get $global_))
|
||||
(local.set $p (global.get $global__1))
|
||||
(local.set $q (global.get $global__2))
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
(func $multireturn
|
||||
(param $a i32)
|
||||
(param $b i64)
|
||||
(param $c i64)
|
||||
(param $d i32)
|
||||
(result i64)
|
||||
(local $x i64)
|
||||
(local $y i32)
|
||||
(local $z i32)
|
||||
(local $w i64)
|
||||
(block $label__3
|
||||
(local.set $x (local.get $b))
|
||||
(local.set $w (local.get $c))
|
||||
(local.set $y (local.get $a))
|
||||
(local.set $z (local.get $d))
|
||||
|
||||
)
|
||||
(global.set $global_ (local.get $y))
|
||||
(global.set $global__1 (local.get $z))
|
||||
(global.set $global__2 (local.get $w))
|
||||
(local.get $x)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--yul --yul-dialect ewasm --machine ewasm
|
||||
@@ -1,8 +0,0 @@
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
i64.store8(0x01:i32, 42:i64)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
======= wasm_to_wasm_memory_instructions_alignment/input.yul (Ewasm) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "object" {
|
||||
code {
|
||||
function main()
|
||||
{ i64.store8(0x01:i32, 42) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0e010c0002404101422a3c00000b0b
|
||||
|
||||
Text representation:
|
||||
(module
|
||||
(memory $memory (export "memory") 1)
|
||||
(export "main" (func $main))
|
||||
|
||||
(func $main
|
||||
(block $label_
|
||||
(i64.store8 (i32.const 1) (i64.const 42))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
--strict-assembly --yul-dialect evm --machine ewasm --optimize --ewasm-ir
|
||||
@@ -1,4 +0,0 @@
|
||||
/// @use-src 0:"test.sol"
|
||||
object "C" {
|
||||
code { sstore(0,0) }
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
======= yul_to_wasm_source_location_crash/input.yul (Ewasm) =======
|
||||
|
||||
==========================
|
||||
|
||||
Translated source:
|
||||
/// @use-src 0:"test.sol"
|
||||
object "C" {
|
||||
code {
|
||||
function main()
|
||||
{
|
||||
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32)
|
||||
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32)))))
|
||||
i64.store(0:i32, y)
|
||||
i64.store(i32.add(0:i32, 8:i32), y)
|
||||
i64.store(i32.add(0:i32, 16:i32), y)
|
||||
i64.store(i32.add(0:i32, 24:i32), y)
|
||||
i64.store(32:i32, y)
|
||||
i64.store(i32.add(32:i32, 8:i32), y)
|
||||
i64.store(i32.add(32:i32, 16:i32), y)
|
||||
i64.store(i32.add(32:i32, 24:i32), y)
|
||||
eth.storageStore(0:i32, 32:i32)
|
||||
}
|
||||
function bswap16(x:i32) -> y:i32
|
||||
{
|
||||
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:i32) -> y:i32
|
||||
{
|
||||
let hi:i32 := i32.shl(bswap16(x), 16:i32)
|
||||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32)))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user