Closed helperShang closed 5 years ago
By using optimization level 3, we get a far more straightforward *.wat.
(module
(type $FUNCSIG$vi (func (param i32)))
(import "env" "logi" (func $logi (param i32)))
(table 0 anyfunc)
(memory $0 1)
(data (i32.const 12) "\04\00\00\00")
(export "memory" (memory $0))
(export "main" (func $main))
(func $main (; 1 ;) (result i32)
(call $logi
(i32.const 134)
)
(call $logi
(i32.const 13)
)
(call $logi
(i32.const 52)
)
(i32.const 0)
)
)
If you are using the online compiler https://mbebenita.github.io/WasmExplorer/, note that binaries produced by that compiler (alongside others such as Emscripten) that assumes memory is pre-allocated, and that a stack pointer is specified at offset 4.
Would recommend directly compiling w/ LLVM and clang, or otherwise use an option that we've been testing with which is creating WebAssembly modules in Rust and thereafter compiling them down to *.wasm with cargo.
i64.const 55834574982