summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lld/em_asm.wast2
-rw-r--r--test/lld/em_asm_shared.cpp8
-rw-r--r--test/lld/em_asm_shared.wast211
-rw-r--r--test/lld/em_asm_shared.wast.out268
-rw-r--r--test/lld/hello_world.wast2
-rw-r--r--test/lld/init.wast2
-rw-r--r--test/lld/recursive.wast2
-rw-r--r--test/lld/reserved_func_ptr.wast2
-rw-r--r--test/lld/shared.c2
-rw-r--r--test/lld/shared.wast33
-rw-r--r--test/lld/shared.wast.out52
11 files changed, 556 insertions, 28 deletions
diff --git a/test/lld/em_asm.wast b/test/lld/em_asm.wast
index 681f75db2..83aa63582 100644
--- a/test/lld/em_asm.wast
+++ b/test/lld/em_asm.wast
@@ -188,6 +188,6 @@
(func $main (; 7 ;) (type $6) (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
- ;; custom section "producers", size 125
+ ;; custom section "producers", size 111
)
diff --git a/test/lld/em_asm_shared.cpp b/test/lld/em_asm_shared.cpp
new file mode 100644
index 000000000..ed89783f8
--- /dev/null
+++ b/test/lld/em_asm_shared.cpp
@@ -0,0 +1,8 @@
+#include <emscripten/em_asm.h>
+
+int main() {
+ EM_ASM({ Module.print("Hello world"); });
+ int x = EM_ASM_INT({ return $0 + $1; }, 13, 27);
+ EM_ASM_({ Module.print("Got " + $0); }, x);
+ return 0;
+}
diff --git a/test/lld/em_asm_shared.wast b/test/lld/em_asm_shared.wast
new file mode 100644
index 000000000..811fb189d
--- /dev/null
+++ b/test/lld/em_asm_shared.wast
@@ -0,0 +1,211 @@
+(module
+ (type $0 (func (param i32 i32 i32) (result i32)))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (type $3 (func (param i32 i32 i32)))
+ (type $4 (func (param i32 i32)))
+ (type $5 (func (param i32) (result i32)))
+ (type $6 (func (param i32 i32) (result i32)))
+ (import "env" "memory" (memory $0 0))
+ (data (global.get $gimport$3) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
+ (import "env" "__indirect_function_table" (table $timport$1 0 funcref))
+ (import "env" "__stack_pointer" (global $gimport$2 (mut i32)))
+ (import "env" "__memory_base" (global $gimport$3 i32))
+ (import "env" "__table_base" (global $gimport$4 i32))
+ (import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
+ (export "__wasm_call_ctors" (func $__wasm_call_ctors))
+ (export "__original_main" (func $__original_main))
+ (export "_ZN20__em_asm_sig_builder12__em_asm_sigIJEEEKNS_5innerIJDpT_EEES3_" (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29))
+ (export "_ZN20__em_asm_sig_builder12__em_asm_sigIJiiEEEKNS_5innerIJDpT_EEES3_" (func $__em_asm_sig_builder::inner<int\2c\20int>\20const\20__em_asm_sig_builder::__em_asm_sig<int\2c\20int>\28int\2c\20int\29))
+ (export "_ZN20__em_asm_sig_builder12__em_asm_sigIJiEEEKNS_5innerIJDpT_EEES3_" (func $__em_asm_sig_builder::inner<int>\20const\20__em_asm_sig_builder::__em_asm_sig<int>\28int\29))
+ (export "_ZN20__em_asm_sig_builder8sig_charEi" (func $__em_asm_sig_builder::sig_char\28int\29))
+ (export "main" (func $main))
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ (call $__wasm_apply_relocs)
+ )
+ (func $__wasm_apply_relocs (; 2 ;) (type $1)
+ )
+ (func $__original_main (; 3 ;) (type $2) (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (global.set $gimport$2
+ (local.tee $0
+ (i32.sub
+ (global.get $gimport$2)
+ (i32.const 32)
+ )
+ )
+ )
+ (i32.store8 offset=24
+ (local.get $0)
+ (call $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29)
+ )
+ (drop
+ (call $emscripten_asm_const_int
+ (i32.add
+ (local.tee $1
+ (global.get $gimport$3)
+ )
+ (i32.const 0)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.const 0)
+ )
+ )
+ (call $__em_asm_sig_builder::inner<int\2c\20int>\20const\20__em_asm_sig_builder::__em_asm_sig<int\2c\20int>\28int\2c\20int\29
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.const 13)
+ (i32.const 27)
+ )
+ (i64.store offset=16
+ (local.get $0)
+ (i64.const 115964117005)
+ )
+ (call $__em_asm_sig_builder::inner<int>\20const\20__em_asm_sig_builder::__em_asm_sig<int>\28int\29
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (local.tee $2
+ (call $emscripten_asm_const_int
+ (i32.add
+ (local.get $1)
+ (i32.const 33)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 16)
+ )
+ )
+ )
+ )
+ (i32.store
+ (local.get $0)
+ (local.get $2)
+ )
+ (drop
+ (call $emscripten_asm_const_int
+ (i32.add
+ (local.get $1)
+ (i32.const 53)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (local.get $0)
+ )
+ )
+ (global.set $gimport$2
+ (i32.add
+ (local.get $0)
+ (i32.const 32)
+ )
+ )
+ (i32.const 0)
+ )
+ (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29 (; 4 ;) (type $2) (result i32)
+ (i32.const 0)
+ )
+ (func $__em_asm_sig_builder::inner<int\2c\20int>\20const\20__em_asm_sig_builder::__em_asm_sig<int\2c\20int>\28int\2c\20int\29 (; 5 ;) (type $3) (param $0 i32) (param $1 i32) (param $2 i32)
+ (local $3 i32)
+ (global.set $gimport$2
+ (local.tee $3
+ (i32.sub
+ (global.get $gimport$2)
+ (i32.const 16)
+ )
+ )
+ )
+ (i32.store8 offset=13
+ (local.get $3)
+ (call $__em_asm_sig_builder::sig_char\28int\29
+ (local.get $1)
+ )
+ )
+ (local.set $2
+ (call $__em_asm_sig_builder::sig_char\28int\29
+ (local.get $2)
+ )
+ )
+ (i32.store8
+ (i32.add
+ (local.get $0)
+ (i32.const 2)
+ )
+ (i32.const 0)
+ )
+ (i32.store8 offset=14
+ (local.get $3)
+ (local.get $2)
+ )
+ (i32.store16 align=1
+ (local.get $0)
+ (i32.load16_u offset=13 align=1
+ (local.get $3)
+ )
+ )
+ (global.set $gimport$2
+ (i32.add
+ (local.get $3)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::inner<int>\20const\20__em_asm_sig_builder::__em_asm_sig<int>\28int\29 (; 6 ;) (type $4) (param $0 i32) (param $1 i32)
+ (local $2 i32)
+ (global.set $gimport$2
+ (local.tee $2
+ (i32.sub
+ (global.get $gimport$2)
+ (i32.const 16)
+ )
+ )
+ )
+ (local.set $1
+ (call $__em_asm_sig_builder::sig_char\28int\29
+ (local.get $1)
+ )
+ )
+ (i32.store8 offset=15
+ (local.get $2)
+ (i32.const 0)
+ )
+ (i32.store8 offset=14
+ (local.get $2)
+ (local.get $1)
+ )
+ (i32.store16 align=1
+ (local.get $0)
+ (i32.load16_u offset=14
+ (local.get $2)
+ )
+ )
+ (global.set $gimport$2
+ (i32.add
+ (local.get $2)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::sig_char\28int\29 (; 7 ;) (type $5) (param $0 i32) (result i32)
+ (i32.const 105)
+ )
+ (func $main (; 8 ;) (type $6) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
+ )
+ ;; custom section "dylink", size 5
+ ;; custom section "producers", size 111
+)
+
diff --git a/test/lld/em_asm_shared.wast.out b/test/lld/em_asm_shared.wast.out
new file mode 100644
index 000000000..725ef618d
--- /dev/null
+++ b/test/lld/em_asm_shared.wast.out
@@ -0,0 +1,268 @@
+(module
+ (type $0 (func (param i32 i32 i32) (result i32)))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (type $3 (func (param i32 i32 i32)))
+ (type $4 (func (param i32 i32)))
+ (type $5 (func (param i32) (result i32)))
+ (type $6 (func (param i32 i32) (result i32)))
+ (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$vi (func (param i32)))
+ (import "env" "memory" (memory $0 0))
+ (data (global.get $gimport$3) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
+ (import "env" "table" (table $0 0 funcref))
+ (import "env" "__memory_base" (global $gimport$3 i32))
+ (import "env" "__table_base" (global $gimport$4 i32))
+ (import "env" "stackSave" (func $stackSave (result i32)))
+ (import "env" "stackRestore" (func $stackRestore (param i32)))
+ (import "env" "emscripten_asm_const_iii" (func $emscripten_asm_const_iii (param i32 i32 i32) (result i32)))
+ (export "__original_main" (func $__original_main))
+ (export "_ZN20__em_asm_sig_builder12__em_asm_sigIJEEEKNS_5innerIJDpT_EEES3_" (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29))
+ (export "_ZN20__em_asm_sig_builder12__em_asm_sigIJiiEEEKNS_5innerIJDpT_EEES3_" (func $__em_asm_sig_builder::inner<int\2c\20int>\20const\20__em_asm_sig_builder::__em_asm_sig<int\2c\20int>\28int\2c\20int\29))
+ (export "_ZN20__em_asm_sig_builder12__em_asm_sigIJiEEEKNS_5innerIJDpT_EEES3_" (func $__em_asm_sig_builder::inner<int>\20const\20__em_asm_sig_builder::__em_asm_sig<int>\28int\29))
+ (export "_ZN20__em_asm_sig_builder8sig_charEi" (func $__em_asm_sig_builder::sig_char\28int\29))
+ (export "main" (func $main))
+ (export "__post_instantiate" (func $__post_instantiate))
+ (func $__wasm_call_ctors (; 3 ;) (type $1)
+ (call $__wasm_apply_relocs)
+ )
+ (func $__wasm_apply_relocs (; 4 ;) (type $1)
+ (nop)
+ )
+ (func $__original_main (; 5 ;) (type $2) (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (call $stackRestore
+ (local.tee $0
+ (i32.sub
+ (call $stackSave)
+ (i32.const 32)
+ )
+ )
+ )
+ (i32.store8 offset=24
+ (local.get $0)
+ (call $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29)
+ )
+ (drop
+ (call $emscripten_asm_const_iii
+ (i32.add
+ (local.tee $1
+ (global.get $gimport$3)
+ )
+ (i32.const 0)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.const 0)
+ )
+ )
+ (call $__em_asm_sig_builder::inner<int\2c\20int>\20const\20__em_asm_sig_builder::__em_asm_sig<int\2c\20int>\28int\2c\20int\29
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.const 13)
+ (i32.const 27)
+ )
+ (i64.store offset=16
+ (local.get $0)
+ (i64.const 115964117005)
+ )
+ (call $__em_asm_sig_builder::inner<int>\20const\20__em_asm_sig_builder::__em_asm_sig<int>\28int\29
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (local.tee $2
+ (call $emscripten_asm_const_iii
+ (i32.add
+ (local.get $1)
+ (i32.const 1)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 16)
+ )
+ )
+ )
+ )
+ (i32.store
+ (local.get $0)
+ (local.get $2)
+ )
+ (drop
+ (call $emscripten_asm_const_iii
+ (i32.add
+ (local.get $1)
+ (i32.const 2)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (local.get $0)
+ )
+ )
+ (call $stackRestore
+ (i32.add
+ (local.get $0)
+ (i32.const 32)
+ )
+ )
+ (i32.const 0)
+ )
+ (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29 (; 6 ;) (type $2) (result i32)
+ (i32.const 0)
+ )
+ (func $__em_asm_sig_builder::inner<int\2c\20int>\20const\20__em_asm_sig_builder::__em_asm_sig<int\2c\20int>\28int\2c\20int\29 (; 7 ;) (type $3) (param $0 i32) (param $1 i32) (param $2 i32)
+ (local $3 i32)
+ (call $stackRestore
+ (local.tee $3
+ (i32.sub
+ (call $stackSave)
+ (i32.const 16)
+ )
+ )
+ )
+ (i32.store8 offset=13
+ (local.get $3)
+ (call $__em_asm_sig_builder::sig_char\28int\29
+ (local.get $1)
+ )
+ )
+ (local.set $2
+ (call $__em_asm_sig_builder::sig_char\28int\29
+ (local.get $2)
+ )
+ )
+ (i32.store8
+ (i32.add
+ (local.get $0)
+ (i32.const 2)
+ )
+ (i32.const 0)
+ )
+ (i32.store8 offset=14
+ (local.get $3)
+ (local.get $2)
+ )
+ (i32.store16 align=1
+ (local.get $0)
+ (i32.load16_u offset=13 align=1
+ (local.get $3)
+ )
+ )
+ (call $stackRestore
+ (i32.add
+ (local.get $3)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::inner<int>\20const\20__em_asm_sig_builder::__em_asm_sig<int>\28int\29 (; 8 ;) (type $4) (param $0 i32) (param $1 i32)
+ (local $2 i32)
+ (call $stackRestore
+ (local.tee $2
+ (i32.sub
+ (call $stackSave)
+ (i32.const 16)
+ )
+ )
+ )
+ (local.set $1
+ (call $__em_asm_sig_builder::sig_char\28int\29
+ (local.get $1)
+ )
+ )
+ (i32.store8 offset=15
+ (local.get $2)
+ (i32.const 0)
+ )
+ (i32.store8 offset=14
+ (local.get $2)
+ (local.get $1)
+ )
+ (i32.store16 align=1
+ (local.get $0)
+ (i32.load16_u offset=14
+ (local.get $2)
+ )
+ )
+ (call $stackRestore
+ (i32.add
+ (local.get $2)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::sig_char\28int\29 (; 9 ;) (type $5) (param $0 i32) (result i32)
+ (i32.const 105)
+ )
+ (func $main (; 10 ;) (type $6) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
+ )
+ (func $__post_instantiate (; 11 ;)
+ (call $__wasm_call_ctors)
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "asmConsts": {
+ "2": ["{ Module.print(\"Got \" + $0); }", ["iii"], [""]],
+ "0": ["{ Module.print(\"Hello world\"); }", ["iii"], [""]],
+ "1": ["{ return $0 + $1; }", ["iii"], [""]]
+ },
+ "staticBump": 0,
+ "tableSize": 0,
+ "declares": [
+ "stackSave",
+ "stackRestore"
+ ],
+ "externs": [
+ "___memory_base",
+ "___table_base"
+ ],
+ "implementedFunctions": [
+ "___original_main",
+ "__ZN20__em_asm_sig_builder12__em_asm_sigIJEEEKNS_5innerIJDpT_EEES3_",
+ "__ZN20__em_asm_sig_builder12__em_asm_sigIJiiEEEKNS_5innerIJDpT_EEES3_",
+ "__ZN20__em_asm_sig_builder12__em_asm_sigIJiEEEKNS_5innerIJDpT_EEES3_",
+ "__ZN20__em_asm_sig_builder8sig_charEi",
+ "_main",
+ "___post_instantiate"
+ ],
+ "exports": [
+ "__original_main",
+ "_ZN20__em_asm_sig_builder12__em_asm_sigIJEEEKNS_5innerIJDpT_EEES3_",
+ "_ZN20__em_asm_sig_builder12__em_asm_sigIJiiEEEKNS_5innerIJDpT_EEES3_",
+ "_ZN20__em_asm_sig_builder12__em_asm_sigIJiEEEKNS_5innerIJDpT_EEES3_",
+ "_ZN20__em_asm_sig_builder8sig_charEi",
+ "main",
+ "__post_instantiate"
+ ],
+ "namedGlobals": {
+ },
+ "invokeFuncs": [
+ ],
+ "features": [
+ "--mvp-features",
+ "--enable-threads",
+ "--enable-mutable-globals",
+ "--enable-nontrapping-float-to-int",
+ "--enable-simd",
+ "--enable-bulk-memory",
+ "--enable-sign-ext"
+ ]
+}
+-- END METADATA --
+;)
diff --git a/test/lld/hello_world.wast b/test/lld/hello_world.wast
index b4abff002..fed975e51 100644
--- a/test/lld/hello_world.wast
+++ b/test/lld/hello_world.wast
@@ -28,6 +28,6 @@
(func $main (; 3 ;) (type $3) (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
- ;; custom section "producers", size 125
+ ;; custom section "producers", size 111
)
diff --git a/test/lld/init.wast b/test/lld/init.wast
index 9c7f45243..2f06799c9 100644
--- a/test/lld/init.wast
+++ b/test/lld/init.wast
@@ -42,6 +42,6 @@
(func $main (; 4 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
- ;; custom section "producers", size 125
+ ;; custom section "producers", size 111
)
diff --git a/test/lld/recursive.wast b/test/lld/recursive.wast
index 93f251ff4..67f7f3914 100644
--- a/test/lld/recursive.wast
+++ b/test/lld/recursive.wast
@@ -85,6 +85,6 @@
(func $main (; 4 ;) (type $0) (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
- ;; custom section "producers", size 125
+ ;; custom section "producers", size 111
)
diff --git a/test/lld/reserved_func_ptr.wast b/test/lld/reserved_func_ptr.wast
index c5fc559df..a57f0d3af 100644
--- a/test/lld/reserved_func_ptr.wast
+++ b/test/lld/reserved_func_ptr.wast
@@ -108,6 +108,6 @@
)
(i32.const 0)
)
- ;; custom section "producers", size 125
+ ;; custom section "producers", size 111
)
diff --git a/test/lld/shared.c b/test/lld/shared.c
index 1d98b068b..fb5b93756 100644
--- a/test/lld/shared.c
+++ b/test/lld/shared.c
@@ -1,6 +1,8 @@
int puts(const char* str);
extern int external_var;
+void* ptr = &puts;
+
int print_message() {
puts("Hello, world");
return external_var;
diff --git a/test/lld/shared.wast b/test/lld/shared.wast
index f8b0a746c..b55584a9a 100644
--- a/test/lld/shared.wast
+++ b/test/lld/shared.wast
@@ -3,32 +3,47 @@
(type $1 (func))
(type $2 (func (result i32)))
(import "env" "memory" (memory $0 0))
- (data (global.get $gimport$2) "Hello, world\00")
- (import "env" "__indirect_function_table" (table $timport$1 0 funcref))
+ (data (global.get $gimport$2) "\00\00\00\00Hello, world\00")
+ (import "env" "__indirect_function_table" (table $timport$1 1 funcref))
+ (elem (global.get $gimport$3) $puts)
(import "env" "__memory_base" (global $gimport$2 i32))
(import "env" "__table_base" (global $gimport$3 i32))
- (import "GOT.func" "puts" (global $gimport$5 (mut i32)))
- (import "GOT.mem" "external_var" (global $gimport$6 (mut i32)))
+ (import "GOT.mem" "external_var" (global $gimport$5 (mut i32)))
+ (import "GOT.func" "puts" (global $gimport$6 (mut i32)))
(import "env" "puts" (func $puts (param i32) (result i32)))
+ (global $global$0 i32 (i32.const 0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "print_message" (func $print_message))
+ (export "ptr" (global $global$0))
(func $__wasm_call_ctors (; 1 ;) (type $1)
+ (call $__wasm_apply_relocs)
)
- (func $print_message (; 2 ;) (type $2) (result i32)
- (drop
+ (func $__wasm_apply_relocs (; 2 ;) (type $1)
+ (i32.store
(i32.add
(global.get $gimport$2)
(i32.const 0)
)
+ (i32.add
+ (global.get $gimport$3)
+ (i32.const 0)
+ )
)
+ )
+ (func $print_message (; 3 ;) (type $2) (result i32)
(drop
- (call $print_message)
+ (call $puts
+ (i32.add
+ (global.get $gimport$2)
+ (i32.const 4)
+ )
+ )
)
(i32.load
- (global.get $gimport$6)
+ (global.get $gimport$5)
)
)
;; custom section "dylink", size 5
- ;; custom section "producers", size 125
+ ;; custom section "producers", size 111
)
diff --git a/test/lld/shared.wast.out b/test/lld/shared.wast.out
index 965ba326b..076a91aab 100644
--- a/test/lld/shared.wast.out
+++ b/test/lld/shared.wast.out
@@ -5,8 +5,9 @@
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$i (func (result i32)))
(import "env" "memory" (memory $0 0))
- (data (global.get $gimport$2) "Hello, world\00")
- (import "env" "table" (table $0 0 funcref))
+ (data (global.get $gimport$2) "\00\00\00\00Hello, world\00")
+ (import "env" "table" (table $0 1 funcref))
+ (elem (global.get $gimport$3) $puts)
(import "env" "__memory_base" (global $gimport$2 i32))
(import "env" "__table_base" (global $gimport$3 i32))
(import "env" "puts" (func $puts (param i32) (result i32)))
@@ -14,43 +15,63 @@
(import "env" "fp$puts$ii" (func $fp$puts$ii (result i32)))
(global $gimport$5 (mut i32) (i32.const 0))
(global $gimport$6 (mut i32) (i32.const 0))
+ (global $global$0 i32 (i32.const 0))
(export "print_message" (func $print_message))
+ (export "ptr" (global $global$0))
(export "__post_instantiate" (func $__post_instantiate))
+ (export "dynCall_ii" (func $dynCall_ii))
(func $__wasm_call_ctors (; 3 ;) (type $1)
- (nop)
+ (call $__wasm_apply_relocs)
)
- (func $print_message (; 4 ;) (type $2) (result i32)
- (drop
+ (func $__wasm_apply_relocs (; 4 ;) (type $1)
+ (i32.store
(i32.add
(global.get $gimport$2)
(i32.const 0)
)
+ (i32.add
+ (global.get $gimport$3)
+ (i32.const 0)
+ )
)
+ )
+ (func $print_message (; 5 ;) (type $2) (result i32)
(drop
- (call $print_message)
+ (call $puts
+ (i32.add
+ (global.get $gimport$2)
+ (i32.const 4)
+ )
+ )
)
(i32.load
- (global.get $gimport$6)
+ (global.get $gimport$5)
)
)
- (func $__post_instantiate (; 5 ;)
+ (func $__post_instantiate (; 6 ;)
(call $__assign_got_enties)
(call $__wasm_call_ctors)
)
- (func $__assign_got_enties (; 6 ;)
- (global.set $gimport$6
+ (func $__assign_got_enties (; 7 ;)
+ (global.set $gimport$5
(call $g$external_var)
)
- (global.set $gimport$5
+ (global.set $gimport$6
(call $fp$puts$ii)
)
)
+ (func $dynCall_ii (; 8 ;) (param $fptr i32) (param $0 i32) (result i32)
+ (call_indirect (type $FUNCSIG$ii)
+ (local.get $0)
+ (local.get $fptr)
+ )
+ )
)
(;
--BEGIN METADATA --
{
"staticBump": 0,
- "tableSize": 0,
+ "tableSize": 1,
"declares": [
"puts",
"g$external_var",
@@ -62,13 +83,16 @@
],
"implementedFunctions": [
"_print_message",
- "___post_instantiate"
+ "___post_instantiate",
+ "_dynCall_ii"
],
"exports": [
"print_message",
- "__post_instantiate"
+ "__post_instantiate",
+ "dynCall_ii"
],
"namedGlobals": {
+ "ptr" : "0"
},
"invokeFuncs": [
],