diff --git a/samples/sample.evm b/samples/sample.evm new file mode 100644 index 00000000..25239b2f Binary files /dev/null and b/samples/sample.evm differ diff --git a/samples/sample.evmhex b/samples/sample.evmhex new file mode 100644 index 00000000..2d945236 --- /dev/null +++ b/samples/sample.evmhex @@ -0,0 +1 @@ +0x60606040526000357c010000000000000000000000000000000000000000000000000000000090048063771602F7146037576035565b005b60546004808035906020019091908035906020019091905050606A565b6040518082815260200191505060405180910390f35b6000818301905080505b9291505056 diff --git a/samples/sample.wasm b/samples/sample.wasm new file mode 100644 index 00000000..f2d1e54b Binary files /dev/null and b/samples/sample.wasm differ diff --git a/samples/sample.wast b/samples/sample.wast new file mode 100644 index 00000000..325fac1c --- /dev/null +++ b/samples/sample.wast @@ -0,0 +1,48 @@ + +(module + (import "ethereum" "useGas" (func $useGas (param i64))) + (global $cb_dest (mut i32) (i32.const 0)) + (global $sp (mut i32) (i32.const -32)) + (global $init (mut i32) (i32.const 0)) + + ;; memory related global + (global $memstart i32 (i32.const 33832)) + ;; the number of 256 words stored in memory + (global $wordCount (mut i64) (i64.const 0)) + ;; what was charged for the last memory allocation + (global $prevMemCost (mut i64) (i64.const 0)) + + ;; TODO: memory should only be 1, but can't resize right now + (memory 500) + (export "memory" (memory 0)) + + + + + (func $main + (export "main") + (local $jump_dest i32) + (set_local $jump_dest (i32.const -1)) + + (block $done + (loop $loop + + (block $0 + (if + (i32.eqz (get_global $init)) + (then + (set_global $init (i32.const 1)) + (br $0)) + (else + ;; the callback dest can never be in the first block + (if (i32.eq (get_global $cb_dest) (i32.const 0)) + (then + (unreachable) + ) + (else + ;; return callback destination and zero out $cb_dest + get_global $cb_dest + (set_global $cb_dest (i32.const 0)) + (br_table $0 ) + )))))(call $useGas (i64.const 0)) ))) +) \ No newline at end of file