2019-07-03 07:59:36 +00:00
|
|
|
{"contracts":{"A":{"C":{"ewasm":{"wast":"(module
|
2019-07-09 13:19:50 +00:00
|
|
|
(import \"ethereum\" \"revert\" (func $eth.revert (param i32 i32)))
|
2019-07-03 07:59:36 +00:00
|
|
|
(memory $memory (export \"memory\") 1)
|
|
|
|
(export \"main\" (func $main))
|
|
|
|
|
|
|
|
(func $main
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $_1 i64)
|
|
|
|
(local $pos i64)
|
|
|
|
(local $_2 i64)
|
|
|
|
(local $hi i64)
|
2019-08-15 12:42:56 +00:00
|
|
|
(local $y i64)
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $hi_1 i64)
|
|
|
|
(set_local $_1 (i64.const 0))
|
|
|
|
(set_local $pos (call $u256_to_i32 (get_local $_1) (get_local $_1) (get_local $_1) (i64.const 64)))
|
2019-08-15 12:42:56 +00:00
|
|
|
(set_local $_2 (i64.const 65280))
|
|
|
|
(set_local $hi (i64.shl (i64.or (i64.shl (i64.or (i64.and (i64.shl (get_local $_1) (i64.const 8)) (get_local $_2)) (i64.and (i64.shr_u (get_local $_1) (i64.const 8)) (i64.const 255))) (i64.const 16)) (call $endian_swap_16 (i64.shr_u (get_local $_1) (i64.const 16)))) (i64.const 32)))
|
|
|
|
(set_local $y (i64.or (get_local $hi) (call $endian_swap_32 (i64.shr_u (get_local $_1) (i64.const 32)))))
|
|
|
|
(i64.store (get_local $pos) (get_local $y)) (i64.store (i64.add (get_local $pos) (i64.const 8)) (get_local $y)) (i64.store (i64.add (get_local $pos) (i64.const 16)) (get_local $y)) (set_local $hi_1 (i64.shl (i64.or (i64.shl (i64.or (i64.and (i64.shl (i64.const 64) (i64.const 8)) (get_local $_2)) (i64.and (i64.shr_u (i64.const 64) (i64.const 8)) (i64.const 255))) (i64.const 16)) (call $endian_swap_16 (i64.shr_u (i64.const 64) (i64.const 16)))) (i64.const 32)))
|
|
|
|
(i64.store (i64.add (get_local $pos) (i64.const 24)) (i64.or (get_local $hi_1) (call $endian_swap_32 (i64.shr_u (i64.const 64) (i64.const 32))))) (call $eth.revert (call $u256_to_i32 (get_local $_1) (get_local $_1) (get_local $_1) (get_local $_1)) (call $u256_to_i32 (get_local $_1) (get_local $_1) (get_local $_1) (get_local $_1)))
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $u256_to_i32
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
|
|
|
(result i64)
|
|
|
|
(local $v i64)
|
|
|
|
(if (i64.ne (i64.const 0) (i64.or (i64.or (get_local $x1) (get_local $x2)) (get_local $x3))) (then
|
2019-07-11 15:02:53 +00:00
|
|
|
(unreachable)))
|
2019-07-09 13:19:50 +00:00
|
|
|
(if (i64.ne (i64.const 0) (i64.shr_u (get_local $x4) (i64.const 32))) (then
|
2019-07-11 15:02:53 +00:00
|
|
|
(unreachable)))
|
2019-07-09 13:19:50 +00:00
|
|
|
(set_local $v (get_local $x4))
|
|
|
|
(get_local $v)
|
|
|
|
)
|
|
|
|
|
|
|
|
(func $endian_swap_16
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(set_local $y (i64.or (i64.and (i64.shl (get_local $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (get_local $x) (i64.const 8)) (i64.const 255))))
|
|
|
|
(get_local $y)
|
|
|
|
)
|
|
|
|
|
|
|
|
(func $endian_swap_32
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(local $hi i64)
|
|
|
|
(set_local $hi (i64.shl (call $endian_swap_16 (get_local $x)) (i64.const 16)))
|
|
|
|
(set_local $y (i64.or (get_local $hi) (call $endian_swap_16 (i64.shr_u (get_local $x) (i64.const 16)))))
|
|
|
|
(get_local $y)
|
2019-07-03 07:59:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
(module
|
2019-07-09 13:19:50 +00:00
|
|
|
(import \"ethereum\" \"codeCopy\" (func $eth.codeCopy (param i32 i32 i32)))
|
|
|
|
(import \"ethereum\" \"finish\" (func $eth.finish (param i32 i32)))
|
2019-07-03 07:59:36 +00:00
|
|
|
(memory $memory (export \"memory\") 1)
|
|
|
|
(export \"main\" (func $main))
|
2019-07-09 13:19:50 +00:00
|
|
|
(global $global_ (mut i64) (i64.const 0))
|
|
|
|
(global $global__1 (mut i64) (i64.const 0))
|
|
|
|
(global $global__2 (mut i64) (i64.const 0))
|
2019-07-03 07:59:36 +00:00
|
|
|
|
|
|
|
(func $main
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $_1 i64)
|
|
|
|
(local $pos i64)
|
|
|
|
(local $hi i64)
|
2019-08-15 12:42:56 +00:00
|
|
|
(local $y i64)
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $hi_1 i64)
|
|
|
|
(local $hi_2 i64)
|
2019-08-15 12:42:56 +00:00
|
|
|
(local $_2 i64)
|
|
|
|
(local $_3 i64)
|
2019-07-09 13:19:50 +00:00
|
|
|
(local $_4 i64)
|
|
|
|
(local $_5 i64)
|
|
|
|
(local $_6 i64)
|
|
|
|
(local $_7 i64)
|
|
|
|
(local $_8 i64)
|
|
|
|
(local $_9 i64)
|
|
|
|
(set_local $_1 (i64.const 0))
|
|
|
|
(set_local $pos (call $u256_to_i32 (get_local $_1) (get_local $_1) (get_local $_1) (i64.const 64)))
|
2019-08-15 12:42:56 +00:00
|
|
|
(set_local $hi (i64.shl (i64.or (i64.shl (i64.or (i64.and (i64.shl (get_local $_1) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (get_local $_1) (i64.const 8)) (i64.const 255))) (i64.const 16)) (call $endian_swap_16 (i64.shr_u (get_local $_1) (i64.const 16)))) (i64.const 32)))
|
|
|
|
(set_local $y (i64.or (get_local $hi) (call $endian_swap_32 (i64.shr_u (get_local $_1) (i64.const 32)))))
|
|
|
|
(i64.store (get_local $pos) (get_local $y)) (i64.store (i64.add (get_local $pos) (i64.const 8)) (get_local $y)) (i64.store (i64.add (get_local $pos) (i64.const 16)) (get_local $y)) (set_local $hi_1 (i64.shl (call $endian_swap_16 (i64.const 64)) (i64.const 16)))
|
|
|
|
(set_local $hi_2 (i64.shl (i64.or (get_local $hi_1) (call $endian_swap_16 (i64.shr_u (i64.const 64) (i64.const 16)))) (i64.const 32)))
|
|
|
|
(i64.store (i64.add (get_local $pos) (i64.const 24)) (i64.or (get_local $hi_2) (call $endian_swap_32 (i64.shr_u (i64.const 64) (i64.const 32))))) (block
|
|
|
|
(set_local $_2 (datasize \"C_2_deployed\"))
|
|
|
|
(set_local $_3 (get_global $global_))
|
|
|
|
(set_local $_4 (get_global $global__1))
|
|
|
|
(set_local $_5 (get_global $global__2))
|
2019-07-11 15:02:53 +00:00
|
|
|
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
(block
|
2019-08-15 12:42:56 +00:00
|
|
|
(set_local $_6 (dataoffset \"C_2_deployed\"))
|
|
|
|
(set_local $_7 (get_global $global_))
|
|
|
|
(set_local $_8 (get_global $global__1))
|
|
|
|
(set_local $_9 (get_global $global__2))
|
2019-07-11 15:02:53 +00:00
|
|
|
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
2019-08-15 12:42:56 +00:00
|
|
|
(call $eth.codeCopy (call $u256_to_i32 (get_local $_1) (get_local $_1) (get_local $_1) (get_local $_1)) (call $u256_to_i32 (get_local $_6) (get_local $_7) (get_local $_8) (get_local $_9)) (call $u256_to_i32 (get_local $_2) (get_local $_3) (get_local $_4) (get_local $_5))) (call $eth.finish (call $u256_to_i32 (get_local $_1) (get_local $_1) (get_local $_1) (get_local $_1)) (call $u256_to_i32 (get_local $_2) (get_local $_3) (get_local $_4) (get_local $_5)))
|
2019-07-09 13:19:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
(func $u256_to_i32
|
|
|
|
(param $x1 i64)
|
|
|
|
(param $x2 i64)
|
|
|
|
(param $x3 i64)
|
|
|
|
(param $x4 i64)
|
|
|
|
(result i64)
|
|
|
|
(local $v i64)
|
|
|
|
(if (i64.ne (i64.const 0) (i64.or (i64.or (get_local $x1) (get_local $x2)) (get_local $x3))) (then
|
2019-07-11 15:02:53 +00:00
|
|
|
(unreachable)))
|
2019-07-09 13:19:50 +00:00
|
|
|
(if (i64.ne (i64.const 0) (i64.shr_u (get_local $x4) (i64.const 32))) (then
|
2019-07-11 15:02:53 +00:00
|
|
|
(unreachable)))
|
2019-07-09 13:19:50 +00:00
|
|
|
(set_local $v (get_local $x4))
|
|
|
|
(get_local $v)
|
|
|
|
)
|
|
|
|
|
|
|
|
(func $endian_swap_16
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(set_local $y (i64.or (i64.and (i64.shl (get_local $x) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (get_local $x) (i64.const 8)) (i64.const 255))))
|
|
|
|
(get_local $y)
|
|
|
|
)
|
|
|
|
|
|
|
|
(func $endian_swap_32
|
|
|
|
(param $x i64)
|
|
|
|
(result i64)
|
|
|
|
(local $y i64)
|
|
|
|
(local $hi i64)
|
|
|
|
(set_local $hi (i64.shl (call $endian_swap_16 (get_local $x)) (i64.const 16)))
|
|
|
|
(set_local $y (i64.or (get_local $hi) (call $endian_swap_16 (i64.shr_u (get_local $x) (i64.const 16)))))
|
|
|
|
(get_local $y)
|
|
|
|
)
|
|
|
|
|
2019-07-03 07:59:36 +00:00
|
|
|
)
|
|
|
|
"}}}},"errors":[{"component":"general","formattedMessage":"Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.
|
|
|
|
","message":"The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.","severity":"warning","type":"Warning"}],"sources":{"A":{"id":0}}}
|