summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Meißner <AlexanderMeissner@gmx.net>2016-06-06 19:03:32 +0200
committerAlon Zakai <alonzakai@gmail.com>2016-06-06 10:03:32 -0700
commit1a4c50e562cf5ed1e18e2bbbf6eec839cf4d28f2 (patch)
treee25b6bd6a0b502f527df16c760fffeb8f3cd141c
parentca46b0772a8e7bb8d2237a27dcf538117842def4 (diff)
downloadbinaryen-1a4c50e562cf5ed1e18e2bbbf6eec839cf4d28f2.tar.gz
binaryen-1a4c50e562cf5ed1e18e2bbbf6eec839cf4d28f2.tar.bz2
binaryen-1a4c50e562cf5ed1e18e2bbbf6eec839cf4d28f2.zip
Fixed missing type assignment of host operations in s2wasm (#572)
-rw-r--r--src/s2wasm.h1
-rw-r--r--test/dot_s/hostFinalize.s9
-rw-r--r--test/dot_s/hostFinalize.wast13
3 files changed, 23 insertions, 0 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index fea40e749..afebd4d9c 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -724,6 +724,7 @@ class S2WasmBuilder {
Name assign = getAssign();
auto curr = allocator->alloc<Host>();
curr->op = op;
+ curr->finalize();
setOutput(curr, assign);
};
auto makeHost1 = [&](HostOp op) {
diff --git a/test/dot_s/hostFinalize.s b/test/dot_s/hostFinalize.s
new file mode 100644
index 000000000..cd9129d12
--- /dev/null
+++ b/test/dot_s/hostFinalize.s
@@ -0,0 +1,9 @@
+ .text
+ .type _main, @function
+_main:
+ current_memory $push0=
+ i32.const $push1=, 1
+ i32.add $push2=, $pop0, $pop1
+ grow_memory $pop2
+ .endfunc
+ .size _main
diff --git a/test/dot_s/hostFinalize.wast b/test/dot_s/hostFinalize.wast
new file mode 100644
index 000000000..8b7f96dc6
--- /dev/null
+++ b/test/dot_s/hostFinalize.wast
@@ -0,0 +1,13 @@
+(module
+ (memory 1)
+ (export "memory" memory)
+ (func $_main
+ (grow_memory
+ (i32.add
+ (current_memory)
+ (i32.const 1)
+ )
+ )
+ )
+)
+;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] }