Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

[WIP] Better generator for CALL* #299

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/wast-async.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,22 @@ namespace evm2wasm
}
},{
opcodeEnum::CALL, {
.wast = ";; generated by ./wasm/generateInterface.js\n(func $CALL (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -128)))\n (i64.load (i32.add (get_global $sp) (i32.const -120)))\n (i64.load (i32.add (get_global $sp) (i32.const -112)))\n (i64.load (i32.add (get_global $sp) (i32.const -104)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store (i32.add (get_global $sp) (i32.const -192)) (i64.extend_u/i32 (i32.eqz (call $call(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(i32.add (get_global $sp) (i32.const -64))(get_local $offset0)(get_local $length0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -168)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -176)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -184)) (i64.const 0)))",
.wast = ";; generated by ./wasm/generateInterface.js\n(func $CALL (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -128)))\n (i64.load (i32.add (get_global $sp) (i32.const -120)))\n (i64.load (i32.add (get_global $sp) (i32.const -112)))\n (i64.load (i32.add (get_global $sp) (i32.const -104)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store (i32.add (get_global $sp) (i32.const -256)) (i64.extend_u/i32 (i32.eqz (call $call(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(i32.add (get_global $sp) (i32.const -64))(get_local $offset0)(get_local $length0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -232)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -240)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -248)) (i64.const 0)))",
.imports = "(import \"ethereum\" \"call\" (func $call (param i64 i32 i32 i32 i32 i32) (result i32)))"
}
},{
opcodeEnum::CALLCODE, {
.wast = ";; generated by ./wasm/generateInterface.js\n(func $CALLCODE (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -128)))\n (i64.load (i32.add (get_global $sp) (i32.const -120)))\n (i64.load (i32.add (get_global $sp) (i32.const -112)))\n (i64.load (i32.add (get_global $sp) (i32.const -104)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store (i32.add (get_global $sp) (i32.const -192)) (i64.extend_u/i32 (i32.eqz (call $callCode(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(i32.add (get_global $sp) (i32.const -64))(get_local $offset0)(get_local $length0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -168)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -176)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -184)) (i64.const 0)))",
.wast = ";; generated by ./wasm/generateInterface.js\n(func $CALLCODE (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -128)))\n (i64.load (i32.add (get_global $sp) (i32.const -120)))\n (i64.load (i32.add (get_global $sp) (i32.const -112)))\n (i64.load (i32.add (get_global $sp) (i32.const -104)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store (i32.add (get_global $sp) (i32.const -256)) (i64.extend_u/i32 (i32.eqz (call $callCode(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(i32.add (get_global $sp) (i32.const -64))(get_local $offset0)(get_local $length0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -232)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -240)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -248)) (i64.const 0)))",
.imports = "(import \"ethereum\" \"callCode\" (func $callCode (param i64 i32 i32 i32 i32 i32) (result i32)))"
}
},{
opcodeEnum::DELEGATECALL, {
.wast = ";; generated by ./wasm/generateInterface.js\n(func $DELEGATECALL (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -128)))\n (i64.load (i32.add (get_global $sp) (i32.const -120)))\n (i64.load (i32.add (get_global $sp) (i32.const -112)))\n (i64.load (i32.add (get_global $sp) (i32.const -104)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store (i32.add (get_global $sp) (i32.const -192)) (i64.extend_u/i32 (i32.eqz (call $callDelegate(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(i32.add (get_global $sp) (i32.const -64))(get_local $offset0)(get_local $length0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -168)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -176)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -184)) (i64.const 0)))",
.wast = ";; generated by ./wasm/generateInterface.js\n(func $DELEGATECALL (param $callback i32)(local $offset0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72))))) (i64.store (i32.add (get_global $sp) (i32.const -256)) (i64.extend_u/i32 (i32.eqz (call $callDelegate(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(i32.add (get_global $sp) (i32.const -64))(get_local $offset0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -232)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -240)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -248)) (i64.const 0)))",
.imports = "(import \"ethereum\" \"callDelegate\" (func $callDelegate (param i64 i32 i32 i32 i32 i32) (result i32)))"
}
},{
opcodeEnum::STATICCALL, {
.wast = ";; generated by ./wasm/generateInterface.js\n(func $STATICCALL (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -64)))\n (i64.load (i32.add (get_global $sp) (i32.const -56)))\n (i64.load (i32.add (get_global $sp) (i32.const -48)))\n (i64.load (i32.add (get_global $sp) (i32.const -40)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store (i32.add (get_global $sp) (i32.const -160)) (i64.extend_u/i32 (i32.eqz (call $callStatic(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(get_local $offset0)(get_local $length0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -136)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -144)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -152)) (i64.const 0)))",
.wast = ";; generated by ./wasm/generateInterface.js\n(func $STATICCALL (param $callback i32)(local $offset0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -64)))\n (i64.load (i32.add (get_global $sp) (i32.const -56)))\n (i64.load (i32.add (get_global $sp) (i32.const -48)))\n (i64.load (i32.add (get_global $sp) (i32.const -40))))) (i64.store (i32.add (get_global $sp) (i32.const -224)) (i64.extend_u/i32 (i32.eqz (call $callStatic(call $check_overflow_i64\n (i64.load (get_global $sp))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(call $bswap_m160 (i32.add (get_global $sp) (i32.const -32)))(get_local $offset0)(get_local $callback)))))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -200)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -208)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -216)) (i64.const 0)))",
.imports = "(import \"ethereum\" \"callStatic\" (func $callStatic (param i64 i32 i32 i32 i32) (result i32)))"
}
},{
Expand Down
Loading