summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/lld/em_asm.wast192
-rw-r--r--test/lld/em_asm.wast.mem.out200
-rw-r--r--test/lld/em_asm.wast.out200
-rw-r--r--test/lld/hello_world.wast22
-rw-r--r--test/lld/hello_world.wast.mem.out26
-rw-r--r--test/lld/hello_world.wast.out26
-rw-r--r--test/lld/init.wast26
-rw-r--r--test/lld/init.wast.out28
-rw-r--r--test/lld/recursive.wast53
-rw-r--r--test/lld/recursive.wast.out57
-rw-r--r--test/lld/reserved_func_ptr.wast72
-rw-r--r--test/lld/reserved_func_ptr.wast.out70
12 files changed, 722 insertions, 250 deletions
diff --git a/test/lld/em_asm.wast b/test/lld/em_asm.wast
index 5a171fb5b..681f75db2 100644
--- a/test/lld/em_asm.wast
+++ b/test/lld/em_asm.wast
@@ -1,43 +1,193 @@
(module
- (type $0 (func (param i32) (result i32)))
- (type $1 (func (param i32 i32 i32) (result i32)))
- (type $2 (func (param i32 i32) (result i32)))
- (type $3 (func (result i32)))
- (type $4 (func))
- (import "env" "_Z24emscripten_asm_const_intIJEEiPKcDpT_" (func $_Z24emscripten_asm_const_intIJEEiPKcDpT_ (param i32) (result i32)))
- (import "env" "_Z24emscripten_asm_const_intIJiiEEiPKcDpT_" (func $_Z24emscripten_asm_const_intIJiiEEiPKcDpT_ (param i32 i32 i32) (result i32)))
- (import "env" "_Z24emscripten_asm_const_intIJiEEiPKcDpT_" (func $_Z24emscripten_asm_const_intIJiEEiPKcDpT_ (param i32 i32) (result i32)))
+ (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" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
+ (memory $0 2)
+ (data (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
+ (table $0 1 1 funcref)
(global $global$0 (mut i32) (i32.const 66192))
(global $global$1 i32 (i32.const 66192))
(global $global$2 i32 (i32.const 652))
- (table 1 1 funcref)
- (memory $0 2)
- (data (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
- (func $main (; 3 ;) (type $3) (result i32)
+ (export "main" (func $main))
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ )
+ (func $__original_main (; 2 ;) (type $2) (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (global.set $global$0
+ (local.tee $0
+ (i32.sub
+ (global.get $global$0)
+ (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 $_Z24emscripten_asm_const_intIJEEiPKcDpT_
+ (call $emscripten_asm_const_int
(i32.const 568)
+ (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 $1
+ (call $emscripten_asm_const_int
+ (i32.const 601)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 16)
+ )
+ )
+ )
+ )
+ (i32.store
+ (local.get $0)
+ (local.get $1)
)
(drop
- (call $_Z24emscripten_asm_const_intIJiEEiPKcDpT_
+ (call $emscripten_asm_const_int
(i32.const 621)
- (call $_Z24emscripten_asm_const_intIJiiEEiPKcDpT_
- (i32.const 601)
- (i32.const 13)
- (i32.const 27)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
)
+ (local.get $0)
+ )
+ )
+ (global.set $global$0
+ (i32.add
+ (local.get $0)
+ (i32.const 32)
)
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 4 ;) (type $4)
+ (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29 (; 3 ;) (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 (; 4 ;) (type $3) (param $0 i32) (param $1 i32) (param $2 i32)
+ (local $3 i32)
+ (global.set $global$0
+ (local.tee $3
+ (i32.sub
+ (global.get $global$0)
+ (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 $global$0
+ (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 (; 5 ;) (type $4) (param $0 i32) (param $1 i32)
+ (local $2 i32)
+ (global.set $global$0
+ (local.tee $2
+ (i32.sub
+ (global.get $global$0)
+ (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 $global$0
+ (i32.add
+ (local.get $2)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::sig_char\28int\29 (; 6 ;) (type $5) (param $0 i32) (result i32)
+ (i32.const 105)
+ )
+ (func $main (; 7 ;) (type $6) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- ;; custom section "linking", size 3
+ ;; custom section "producers", size 125
)
diff --git a/test/lld/em_asm.wast.mem.out b/test/lld/em_asm.wast.mem.out
index e7c680764..c1cd18ae5 100644
--- a/test/lld/em_asm.wast.mem.out
+++ b/test/lld/em_asm.wast.mem.out
@@ -1,15 +1,13 @@
(module
- (type $0 (func (param i32) (result i32)))
- (type $1 (func (param i32 i32 i32) (result i32)))
- (type $2 (func (param i32 i32) (result i32)))
- (type $3 (func (result i32)))
- (type $4 (func))
- (type $FUNCSIG$ii (func (param i32) (result i32)))
+ (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$iii (func (param i32 i32) (result i32)))
- (import "env" "emscripten_asm_const_i" (func $emscripten_asm_const_i (param i32) (result i32)))
(import "env" "emscripten_asm_const_iii" (func $emscripten_asm_const_iii (param i32 i32 i32) (result i32)))
- (import "env" "emscripten_asm_const_ii" (func $emscripten_asm_const_ii (param i32 i32) (result i32)))
(memory $0 2)
(table $0 1 1 funcref)
(global $global$0 (mut i32) (i32.const 16384))
@@ -17,38 +15,188 @@
(global $global$2 i32 (i32.const 652))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
- (func $main (; 3 ;) (type $3) (result i32)
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ (nop)
+ )
+ (func $__original_main (; 2 ;) (type $2) (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (global.set $global$0
+ (local.tee $0
+ (i32.sub
+ (global.get $global$0)
+ (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_i
+ (call $emscripten_asm_const_iii
+ (i32.const 0)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
(i32.const 0)
)
)
- (drop
- (call $emscripten_asm_const_ii
- (i32.const 2)
+ (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 $1
(call $emscripten_asm_const_iii
(i32.const 1)
- (i32.const 13)
- (i32.const 27)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 16)
+ )
)
)
)
+ (i32.store
+ (local.get $0)
+ (local.get $1)
+ )
+ (drop
+ (call $emscripten_asm_const_iii
+ (i32.const 2)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (local.get $0)
+ )
+ )
+ (global.set $global$0
+ (i32.add
+ (local.get $0)
+ (i32.const 32)
+ )
+ )
(i32.const 0)
)
- (func $__wasm_call_ctors (; 4 ;) (type $4)
- (nop)
+ (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29 (; 3 ;) (type $2) (result i32)
+ (i32.const 0)
)
- (func $stackSave (; 5 ;) (result i32)
+ (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 (; 4 ;) (type $3) (param $0 i32) (param $1 i32) (param $2 i32)
+ (local $3 i32)
+ (global.set $global$0
+ (local.tee $3
+ (i32.sub
+ (global.get $global$0)
+ (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 $global$0
+ (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 (; 5 ;) (type $4) (param $0 i32) (param $1 i32)
+ (local $2 i32)
+ (global.set $global$0
+ (local.tee $2
+ (i32.sub
+ (global.get $global$0)
+ (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 $global$0
+ (i32.add
+ (local.get $2)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::sig_char\28int\29 (; 6 ;) (type $5) (param $0 i32) (result i32)
+ (i32.const 105)
+ )
+ (func $main (; 7 ;) (type $6) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
+ )
+ (func $stackSave (; 8 ;) (result i32)
(global.get $global$0)
)
- (func $stackAlloc (; 6 ;) (param $0 i32) (result i32)
+ (func $stackAlloc (; 9 ;) (param $0 i32) (result i32)
(local $1 i32)
(global.set $global$0
(local.tee $1
@@ -63,12 +211,12 @@
)
(local.get $1)
)
- (func $stackRestore (; 7 ;) (param $0 i32)
+ (func $stackRestore (; 10 ;) (param $0 i32)
(global.set $global$0
(local.get $0)
)
)
- (func $__growWasmMemory (; 8 ;) (param $newSize i32) (result i32)
+ (func $__growWasmMemory (; 11 ;) (param $newSize i32) (result i32)
(grow_memory
(local.get $newSize)
)
@@ -78,8 +226,8 @@
--BEGIN METADATA --
{
"asmConsts": {
- "2": ["{ Module.print(\"Got \" + $0); }", ["ii"], [""]],
- "0": ["{ Module.print(\"Hello world\"); }", ["i"], [""]],
+ "2": ["{ Module.print(\"Got \" + $0); }", ["iii"], [""]],
+ "0": ["{ Module.print(\"Hello world\"); }", ["iii"], [""]],
"1": ["{ return $0 + $1; }", ["iii"], [""]]
},
"staticBump": 84,
@@ -102,9 +250,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",
diff --git a/test/lld/em_asm.wast.out b/test/lld/em_asm.wast.out
index 92b1ea76f..b9e95d3ec 100644
--- a/test/lld/em_asm.wast.out
+++ b/test/lld/em_asm.wast.out
@@ -1,15 +1,13 @@
(module
- (type $0 (func (param i32) (result i32)))
- (type $1 (func (param i32 i32 i32) (result i32)))
- (type $2 (func (param i32 i32) (result i32)))
- (type $3 (func (result i32)))
- (type $4 (func))
- (type $FUNCSIG$ii (func (param i32) (result i32)))
+ (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$iii (func (param i32 i32) (result i32)))
- (import "env" "emscripten_asm_const_i" (func $emscripten_asm_const_i (param i32) (result i32)))
(import "env" "emscripten_asm_const_iii" (func $emscripten_asm_const_iii (param i32 i32 i32) (result i32)))
- (import "env" "emscripten_asm_const_ii" (func $emscripten_asm_const_ii (param i32 i32) (result i32)))
(memory $0 2)
(data (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
(table $0 1 1 funcref)
@@ -18,38 +16,188 @@
(global $global$2 i32 (i32.const 652))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
- (func $main (; 3 ;) (type $3) (result i32)
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ (nop)
+ )
+ (func $__original_main (; 2 ;) (type $2) (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (global.set $global$0
+ (local.tee $0
+ (i32.sub
+ (global.get $global$0)
+ (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_i
+ (call $emscripten_asm_const_iii
+ (i32.const 0)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
(i32.const 0)
)
)
- (drop
- (call $emscripten_asm_const_ii
- (i32.const 2)
+ (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 $1
(call $emscripten_asm_const_iii
(i32.const 1)
- (i32.const 13)
- (i32.const 27)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (i32.add
+ (local.get $0)
+ (i32.const 16)
+ )
)
)
)
+ (i32.store
+ (local.get $0)
+ (local.get $1)
+ )
+ (drop
+ (call $emscripten_asm_const_iii
+ (i32.const 2)
+ (i32.add
+ (local.get $0)
+ (i32.const 24)
+ )
+ (local.get $0)
+ )
+ )
+ (global.set $global$0
+ (i32.add
+ (local.get $0)
+ (i32.const 32)
+ )
+ )
(i32.const 0)
)
- (func $__wasm_call_ctors (; 4 ;) (type $4)
- (nop)
+ (func $__em_asm_sig_builder::inner<>\20const\20__em_asm_sig_builder::__em_asm_sig<>\28\29 (; 3 ;) (type $2) (result i32)
+ (i32.const 0)
)
- (func $stackSave (; 5 ;) (result i32)
+ (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 (; 4 ;) (type $3) (param $0 i32) (param $1 i32) (param $2 i32)
+ (local $3 i32)
+ (global.set $global$0
+ (local.tee $3
+ (i32.sub
+ (global.get $global$0)
+ (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 $global$0
+ (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 (; 5 ;) (type $4) (param $0 i32) (param $1 i32)
+ (local $2 i32)
+ (global.set $global$0
+ (local.tee $2
+ (i32.sub
+ (global.get $global$0)
+ (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 $global$0
+ (i32.add
+ (local.get $2)
+ (i32.const 16)
+ )
+ )
+ )
+ (func $__em_asm_sig_builder::sig_char\28int\29 (; 6 ;) (type $5) (param $0 i32) (result i32)
+ (i32.const 105)
+ )
+ (func $main (; 7 ;) (type $6) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
+ )
+ (func $stackSave (; 8 ;) (result i32)
(global.get $global$0)
)
- (func $stackAlloc (; 6 ;) (param $0 i32) (result i32)
+ (func $stackAlloc (; 9 ;) (param $0 i32) (result i32)
(local $1 i32)
(global.set $global$0
(local.tee $1
@@ -64,12 +212,12 @@
)
(local.get $1)
)
- (func $stackRestore (; 7 ;) (param $0 i32)
+ (func $stackRestore (; 10 ;) (param $0 i32)
(global.set $global$0
(local.get $0)
)
)
- (func $__growWasmMemory (; 8 ;) (param $newSize i32) (result i32)
+ (func $__growWasmMemory (; 11 ;) (param $newSize i32) (result i32)
(grow_memory
(local.get $newSize)
)
@@ -79,8 +227,8 @@
--BEGIN METADATA --
{
"asmConsts": {
- "2": ["{ Module.print(\"Got \" + $0); }", ["ii"], [""]],
- "0": ["{ Module.print(\"Hello world\"); }", ["i"], [""]],
+ "2": ["{ Module.print(\"Got \" + $0); }", ["iii"], [""]],
+ "0": ["{ Module.print(\"Hello world\"); }", ["iii"], [""]],
"1": ["{ return $0 + $1; }", ["iii"], [""]]
},
"staticBump": 84,
@@ -103,9 +251,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",
diff --git a/test/lld/hello_world.wast b/test/lld/hello_world.wast
index 5cebc06c8..b4abff002 100644
--- a/test/lld/hello_world.wast
+++ b/test/lld/hello_world.wast
@@ -1,20 +1,23 @@
(module
(type $0 (func (param i32) (result i32)))
- (type $1 (func (result i32)))
- (type $2 (func))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (type $3 (func (param i32 i32) (result i32)))
(import "env" "puts" (func $puts (param i32) (result i32)))
+ (memory $0 2)
+ (data (i32.const 568) "Hello, world\00")
+ (table $0 1 1 funcref)
(global $global$0 (mut i32) (i32.const 66128))
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 581))
- (table 1 1 funcref)
- (memory $0 2)
- (data (i32.const 568) "Hello, world\00")
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
- (func $main (; 1 ;) (type $1) (result i32)
+ (export "main" (func $main))
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ )
+ (func $__original_main (; 2 ;) (type $2) (result i32)
(drop
(call $puts
(i32.const 568)
@@ -22,8 +25,9 @@
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 2 ;) (type $2)
+ (func $main (; 3 ;) (type $3) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- ;; custom section "linking", size 3
+ ;; custom section "producers", size 125
)
diff --git a/test/lld/hello_world.wast.mem.out b/test/lld/hello_world.wast.mem.out
index 66dafd460..dce3de59c 100644
--- a/test/lld/hello_world.wast.mem.out
+++ b/test/lld/hello_world.wast.mem.out
@@ -1,7 +1,8 @@
(module
(type $0 (func (param i32) (result i32)))
- (type $1 (func (result i32)))
- (type $2 (func))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (type $3 (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(import "env" "puts" (func $puts (param i32) (result i32)))
(memory $0 2)
@@ -11,14 +12,17 @@
(global $global$2 i32 (i32.const 581))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
- (func $main (; 1 ;) (type $1) (result i32)
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ (nop)
+ )
+ (func $__original_main (; 2 ;) (type $2) (result i32)
(drop
(call $puts
(i32.const 568)
@@ -26,13 +30,13 @@
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 2 ;) (type $2)
- (nop)
+ (func $main (; 3 ;) (type $3) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- (func $stackSave (; 3 ;) (result i32)
+ (func $stackSave (; 4 ;) (result i32)
(global.get $global$0)
)
- (func $stackAlloc (; 4 ;) (param $0 i32) (result i32)
+ (func $stackAlloc (; 5 ;) (param $0 i32) (result i32)
(local $1 i32)
(global.set $global$0
(local.tee $1
@@ -47,12 +51,12 @@
)
(local.get $1)
)
- (func $stackRestore (; 5 ;) (param $0 i32)
+ (func $stackRestore (; 6 ;) (param $0 i32)
(global.set $global$0
(local.get $0)
)
)
- (func $__growWasmMemory (; 6 ;) (param $newSize i32) (result i32)
+ (func $__growWasmMemory (; 7 ;) (param $newSize i32) (result i32)
(grow_memory
(local.get $newSize)
)
@@ -82,9 +86,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",
diff --git a/test/lld/hello_world.wast.out b/test/lld/hello_world.wast.out
index 1b1e199cb..a06e7b287 100644
--- a/test/lld/hello_world.wast.out
+++ b/test/lld/hello_world.wast.out
@@ -1,7 +1,8 @@
(module
(type $0 (func (param i32) (result i32)))
- (type $1 (func (result i32)))
- (type $2 (func))
+ (type $1 (func))
+ (type $2 (func (result i32)))
+ (type $3 (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(import "env" "puts" (func $puts (param i32) (result i32)))
(memory $0 2)
@@ -12,14 +13,17 @@
(global $global$2 i32 (i32.const 581))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
- (func $main (; 1 ;) (type $1) (result i32)
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ (nop)
+ )
+ (func $__original_main (; 2 ;) (type $2) (result i32)
(drop
(call $puts
(i32.const 568)
@@ -27,13 +31,13 @@
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 2 ;) (type $2)
- (nop)
+ (func $main (; 3 ;) (type $3) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- (func $stackSave (; 3 ;) (result i32)
+ (func $stackSave (; 4 ;) (result i32)
(global.get $global$0)
)
- (func $stackAlloc (; 4 ;) (param $0 i32) (result i32)
+ (func $stackAlloc (; 5 ;) (param $0 i32) (result i32)
(local $1 i32)
(global.set $global$0
(local.tee $1
@@ -48,12 +52,12 @@
)
(local.get $1)
)
- (func $stackRestore (; 5 ;) (param $0 i32)
+ (func $stackRestore (; 6 ;) (param $0 i32)
(global.set $global$0
(local.get $0)
)
)
- (func $__growWasmMemory (; 6 ;) (param $newSize i32) (result i32)
+ (func $__growWasmMemory (; 7 ;) (param $newSize i32) (result i32)
(grow_memory
(local.get $newSize)
)
@@ -83,9 +87,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",
diff --git a/test/lld/init.wast b/test/lld/init.wast
index 15bf65e7c..9c7f45243 100644
--- a/test/lld/init.wast
+++ b/test/lld/init.wast
@@ -1,30 +1,35 @@
(module
(type $0 (func))
(type $1 (func (result i32)))
+ (type $2 (func (param i32 i32) (result i32)))
+ (memory $0 2)
+ (data (i32.const 568) "\00\00\00\00\00\00\00\00")
+ (table $0 1 1 funcref)
(global $global$0 (mut i32) (i32.const 66112))
(global $global$1 i32 (i32.const 66112))
(global $global$2 i32 (i32.const 576))
- (table 1 1 funcref)
- (memory $0 2)
- (data (i32.const 568) "\00\00\00\00\00\00\00\00")
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
- (func $init_x (; 0 ;) (type $0)
+ (export "main" (func $main))
+ (func $__wasm_call_ctors (; 0 ;) (type $0)
+ (call $init_x)
+ (call $init_y)
+ )
+ (func $init_x (; 1 ;) (type $0)
(i32.store offset=568
(i32.const 0)
(i32.const 14)
)
)
- (func $init_y (; 1 ;) (type $0)
+ (func $init_y (; 2 ;) (type $0)
(i32.store offset=572
(i32.const 0)
(i32.const 144)
)
)
- (func $main (; 2 ;) (type $1) (result i32)
+ (func $__original_main (; 3 ;) (type $1) (result i32)
(i32.add
(i32.load offset=568
(i32.const 0)
@@ -34,10 +39,9 @@
)
)
)
- (func $__wasm_call_ctors (; 3 ;) (type $0)
- (call $init_x)
- (call $init_y)
+ (func $main (; 4 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- ;; custom section "linking", size 3
+ ;; custom section "producers", size 125
)
diff --git a/test/lld/init.wast.out b/test/lld/init.wast.out
index dfff8d5eb..35fda658b 100644
--- a/test/lld/init.wast.out
+++ b/test/lld/init.wast.out
@@ -1,6 +1,7 @@
(module
(type $0 (func))
(type $1 (func (result i32)))
+ (type $2 (func (param i32 i32) (result i32)))
(memory $0 2)
(data (i32.const 568) "\00\00\00\00\00\00\00\00")
(table $0 1 1 funcref)
@@ -9,26 +10,30 @@
(global $global$2 i32 (i32.const 576))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
- (func $init_x (; 0 ;) (type $0)
+ (func $__wasm_call_ctors (; 0 ;) (type $0)
+ (call $init_x)
+ (call $init_y)
+ )
+ (func $init_x (; 1 ;) (type $0)
(i32.store offset=568
(i32.const 0)
(i32.const 14)
)
)
- (func $init_y (; 1 ;) (type $0)
+ (func $init_y (; 2 ;) (type $0)
(i32.store offset=572
(i32.const 0)
(i32.const 144)
)
)
- (func $main (; 2 ;) (type $1) (result i32)
+ (func $__original_main (; 3 ;) (type $1) (result i32)
(i32.add
(i32.load offset=568
(i32.const 0)
@@ -38,14 +43,13 @@
)
)
)
- (func $__wasm_call_ctors (; 3 ;) (type $0)
- (call $init_x)
- (call $init_y)
+ (func $main (; 4 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- (func $stackSave (; 4 ;) (result i32)
+ (func $stackSave (; 5 ;) (result i32)
(global.get $global$0)
)
- (func $stackAlloc (; 5 ;) (param $0 i32) (result i32)
+ (func $stackAlloc (; 6 ;) (param $0 i32) (result i32)
(local $1 i32)
(global.set $global$0
(local.tee $1
@@ -60,12 +64,12 @@
)
(local.get $1)
)
- (func $stackRestore (; 6 ;) (param $0 i32)
+ (func $stackRestore (; 7 ;) (param $0 i32)
(global.set $global$0
(local.get $0)
)
)
- (func $__growWasmMemory (; 7 ;) (param $newSize i32) (result i32)
+ (func $__growWasmMemory (; 8 ;) (param $newSize i32) (result i32)
(grow_memory
(local.get $newSize)
)
@@ -94,9 +98,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",
diff --git a/test/lld/recursive.wast b/test/lld/recursive.wast
index f3501b39b..93f251ff4 100644
--- a/test/lld/recursive.wast
+++ b/test/lld/recursive.wast
@@ -1,23 +1,25 @@
(module
(type $0 (func (param i32 i32) (result i32)))
- (type $1 (func (result i32)))
- (type $2 (func))
+ (type $1 (func))
+ (type $2 (func (result i32)))
(import "env" "printf" (func $printf (param i32 i32) (result i32)))
+ (memory $0 2)
+ (data (i32.const 568) "%d:%d\n\00Result: %d\n\00")
+ (table $0 1 1 funcref)
(global $global$0 (mut i32) (i32.const 66128))
(global $global$1 i32 (i32.const 66128))
(global $global$2 i32 (i32.const 587))
- (table 1 1 funcref)
- (memory $0 2)
- (data (i32.const 568) "%d:%d\n\00Result: %d\n\00")
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
- (func $foo (; 1 ;) (type $0) (param $var$0 i32) (param $var$1 i32) (result i32)
- (local $var$2 i32)
+ (export "main" (func $main))
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ )
+ (func $foo (; 2 ;) (type $0) (param $0 i32) (param $1 i32) (result i32)
+ (local $2 i32)
(global.set $global$0
- (local.tee $var$2
+ (local.tee $2
(i32.sub
(global.get $global$0)
(i32.const 16)
@@ -25,34 +27,34 @@
)
)
(i32.store offset=4
- (local.get $var$2)
- (local.get $var$1)
+ (local.get $2)
+ (local.get $1)
)
(i32.store
- (local.get $var$2)
- (local.get $var$0)
+ (local.get $2)
+ (local.get $0)
)
(drop
(call $printf
(i32.const 568)
- (local.get $var$2)
+ (local.get $2)
)
)
(global.set $global$0
(i32.add
- (local.get $var$2)
+ (local.get $2)
(i32.const 16)
)
)
(i32.add
- (local.get $var$1)
- (local.get $var$0)
+ (local.get $1)
+ (local.get $0)
)
)
- (func $main (; 2 ;) (type $1) (result i32)
- (local $var$0 i32)
+ (func $__original_main (; 3 ;) (type $2) (result i32)
+ (local $0 i32)
(global.set $global$0
- (local.tee $var$0
+ (local.tee $0
(i32.sub
(global.get $global$0)
(i32.const 16)
@@ -60,7 +62,7 @@
)
)
(i32.store
- (local.get $var$0)
+ (local.get $0)
(call $foo
(i32.const 1)
(i32.const 2)
@@ -69,19 +71,20 @@
(drop
(call $printf
(i32.const 575)
- (local.get $var$0)
+ (local.get $0)
)
)
(global.set $global$0
(i32.add
- (local.get $var$0)
+ (local.get $0)
(i32.const 16)
)
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 3 ;) (type $2)
+ (func $main (; 4 ;) (type $0) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- ;; custom section "linking", size 3
+ ;; custom section "producers", size 125
)
diff --git a/test/lld/recursive.wast.out b/test/lld/recursive.wast.out
index e8f32d99c..fcb6c1333 100644
--- a/test/lld/recursive.wast.out
+++ b/test/lld/recursive.wast.out
@@ -1,7 +1,7 @@
(module
(type $0 (func (param i32 i32) (result i32)))
- (type $1 (func (result i32)))
- (type $2 (func))
+ (type $1 (func))
+ (type $2 (func (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(import "env" "printf" (func $printf (param i32 i32) (result i32)))
(memory $0 2)
@@ -12,17 +12,20 @@
(global $global$2 i32 (i32.const 587))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
- (func $foo (; 1 ;) (type $0) (param $var$0 i32) (param $var$1 i32) (result i32)
- (local $var$2 i32)
+ (func $__wasm_call_ctors (; 1 ;) (type $1)
+ (nop)
+ )
+ (func $foo (; 2 ;) (type $0) (param $0 i32) (param $1 i32) (result i32)
+ (local $2 i32)
(global.set $global$0
- (local.tee $var$2
+ (local.tee $2
(i32.sub
(global.get $global$0)
(i32.const 16)
@@ -30,34 +33,34 @@
)
)
(i32.store offset=4
- (local.get $var$2)
- (local.get $var$1)
+ (local.get $2)
+ (local.get $1)
)
(i32.store
- (local.get $var$2)
- (local.get $var$0)
+ (local.get $2)
+ (local.get $0)
)
(drop
(call $printf
(i32.const 568)
- (local.get $var$2)
+ (local.get $2)
)
)
(global.set $global$0
(i32.add
- (local.get $var$2)
+ (local.get $2)
(i32.const 16)
)
)
(i32.add
- (local.get $var$1)
- (local.get $var$0)
+ (local.get $1)
+ (local.get $0)
)
)
- (func $main (; 2 ;) (type $1) (result i32)
- (local $var$0 i32)
+ (func $__original_main (; 3 ;) (type $2) (result i32)
+ (local $0 i32)
(global.set $global$0
- (local.tee $var$0
+ (local.tee $0
(i32.sub
(global.get $global$0)
(i32.const 16)
@@ -65,7 +68,7 @@
)
)
(i32.store
- (local.get $var$0)
+ (local.get $0)
(call $foo
(i32.const 1)
(i32.const 2)
@@ -74,24 +77,24 @@
(drop
(call $printf
(i32.const 575)
- (local.get $var$0)
+ (local.get $0)
)
)
(global.set $global$0
(i32.add
- (local.get $var$0)
+ (local.get $0)
(i32.const 16)
)
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 3 ;) (type $2)
- (nop)
+ (func $main (; 4 ;) (type $0) (param $0 i32) (param $1 i32) (result i32)
+ (call $__original_main)
)
- (func $stackSave (; 4 ;) (result i32)
+ (func $stackSave (; 5 ;) (result i32)
(global.get $global$0)
)
- (func $stackAlloc (; 5 ;) (param $0 i32) (result i32)
+ (func $stackAlloc (; 6 ;) (param $0 i32) (result i32)
(local $1 i32)
(global.set $global$0
(local.tee $1
@@ -106,12 +109,12 @@
)
(local.get $1)
)
- (func $stackRestore (; 6 ;) (param $0 i32)
+ (func $stackRestore (; 7 ;) (param $0 i32)
(global.set $global$0
(local.get $0)
)
)
- (func $__growWasmMemory (; 7 ;) (param $newSize i32) (result i32)
+ (func $__growWasmMemory (; 8 ;) (param $newSize i32) (result i32)
(grow_memory
(local.get $newSize)
)
@@ -141,9 +144,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",
diff --git a/test/lld/reserved_func_ptr.wast b/test/lld/reserved_func_ptr.wast
index 426412b77..c5fc559df 100644
--- a/test/lld/reserved_func_ptr.wast
+++ b/test/lld/reserved_func_ptr.wast
@@ -6,74 +6,76 @@
(type $4 (func (param f64 i32) (result f64)))
(type $5 (func (param i32 i32 i32)))
(type $6 (func (param i32) (result i32)))
- (import "env" "_Z4atoiPKc" (func $_Z4atoiPKc (param i32) (result i32)))
+ (import "env" "_Z4atoiPKc" (func $atoi\28char\20const*\29 (param i32) (result i32)))
+ (memory $0 2)
+ (table $0 3 3 funcref)
+ (elem (i32.const 1) $address_taken_func\28int\2c\20int\2c\20int\29 $address_taken_func2\28int\2c\20int\2c\20int\29)
(global $global$0 (mut i32) (i32.const 66112))
(global $global$1 i32 (i32.const 66112))
(global $global$2 i32 (i32.const 568))
- (table 3 3 funcref)
- (elem (i32.const 1) $_Z18address_taken_funciii $_Z19address_taken_func2iii)
- (memory $0 2)
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
- (func $_Z18address_taken_funciii (; 1 ;) (type $5) (param $var$0 i32) (param $var$1 i32) (param $var$2 i32)
+ (export "main" (func $main))
+ (func $__wasm_call_ctors (; 1 ;) (type $0)
+ )
+ (func $address_taken_func\28int\2c\20int\2c\20int\29 (; 2 ;) (type $5) (param $0 i32) (param $1 i32) (param $2 i32)
)
- (func $_Z19address_taken_func2iii (; 2 ;) (type $5) (param $var$0 i32) (param $var$1 i32) (param $var$2 i32)
+ (func $address_taken_func2\28int\2c\20int\2c\20int\29 (; 3 ;) (type $5) (param $0 i32) (param $1 i32) (param $2 i32)
)
- (func $main (; 3 ;) (type $2) (param $var$0 i32) (param $var$1 i32) (result i32)
- (local $var$2 i32)
- (local $var$3 i32)
- (local $var$4 i32)
- (local $var$5 i32)
- (local.set $var$2
- (call $_Z4atoiPKc
+ (func $main (; 4 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
+ (local $2 i32)
+ (local $3 i32)
+ (local $4 i32)
+ (local $5 i32)
+ (local.set $2
+ (call $atoi\28char\20const*\29
(i32.load offset=4
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$3
- (call $_Z4atoiPKc
+ (local.set $3
+ (call $atoi\28char\20const*\29
(i32.load offset=8
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$4
- (call $_Z4atoiPKc
+ (local.set $4
+ (call $atoi\28char\20const*\29
(i32.load offset=12
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$5
- (call $_Z4atoiPKc
+ (local.set $5
+ (call $atoi\28char\20const*\29
(i32.load offset=16
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$1
- (call $_Z4atoiPKc
+ (local.set $1
+ (call $atoi\28char\20const*\29
(i32.load offset=20
- (local.get $var$1)
+ (local.get $1)
)
)
)
(call_indirect (type $0)
- (local.get $var$2)
+ (local.get $2)
)
(call_indirect (type $1)
(i32.const 3)
- (local.get $var$3)
+ (local.get $3)
)
(drop
(call_indirect (type $2)
(i32.const 4)
(i32.const 5)
- (local.get $var$4)
+ (local.get $4)
)
)
(drop
@@ -81,14 +83,14 @@
(f32.const 3.0999999046325684)
(f32.const 4.199999809265137)
(i32.const 5)
- (local.get $var$5)
+ (local.get $5)
)
)
(drop
(call_indirect (type $4)
(f64.const 4.2)
(i32.const 5)
- (local.get $var$1)
+ (local.get $1)
)
)
(call_indirect (type $5)
@@ -99,15 +101,13 @@
(i32.const 1)
(i32.const 2)
(i32.gt_s
- (local.get $var$0)
+ (local.get $0)
(i32.const 3)
)
)
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 4 ;) (type $0)
- )
- ;; custom section "linking", size 3
+ ;; custom section "producers", size 125
)
diff --git a/test/lld/reserved_func_ptr.wast.out b/test/lld/reserved_func_ptr.wast.out
index e0d9ea156..5c8333d09 100644
--- a/test/lld/reserved_func_ptr.wast.out
+++ b/test/lld/reserved_func_ptr.wast.out
@@ -8,81 +8,84 @@
(type $6 (func (param i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viii (func (param i32 i32 i32)))
- (import "env" "_Z4atoiPKc" (func $_Z4atoiPKc (param i32) (result i32)))
+ (import "env" "_Z4atoiPKc" (func $atoi\28char\20const*\29 (param i32) (result i32)))
(memory $0 2)
(table $0 3 3 funcref)
- (elem (i32.const 1) $_Z18address_taken_funciii $_Z19address_taken_func2iii)
+ (elem (i32.const 1) $address_taken_func\28int\2c\20int\2c\20int\29 $address_taken_func2\28int\2c\20int\2c\20int\29)
(global $global$0 (mut i32) (i32.const 16384))
(global $global$1 i32 (i32.const 66112))
(global $global$2 i32 (i32.const 568))
(export "memory" (memory $0))
(export "__post_instantiate" (func $__wasm_call_ctors))
- (export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
+ (export "main" (func $main))
(export "stackSave" (func $stackSave))
(export "stackAlloc" (func $stackAlloc))
(export "stackRestore" (func $stackRestore))
(export "__growWasmMemory" (func $__growWasmMemory))
(export "dynCall_viii" (func $dynCall_viii))
- (func $_Z18address_taken_funciii (; 1 ;) (type $5) (param $var$0 i32) (param $var$1 i32) (param $var$2 i32)
+ (func $__wasm_call_ctors (; 1 ;) (type $0)
(nop)
)
- (func $_Z19address_taken_func2iii (; 2 ;) (type $5) (param $var$0 i32) (param $var$1 i32) (param $var$2 i32)
+ (func $address_taken_func\28int\2c\20int\2c\20int\29 (; 2 ;) (type $5) (param $0 i32) (param $1 i32) (param $2 i32)
(nop)
)
- (func $main (; 3 ;) (type $2) (param $var$0 i32) (param $var$1 i32) (result i32)
- (local $var$2 i32)
- (local $var$3 i32)
- (local $var$4 i32)
- (local $var$5 i32)
- (local.set $var$2
- (call $_Z4atoiPKc
+ (func $address_taken_func2\28int\2c\20int\2c\20int\29 (; 3 ;) (type $5) (param $0 i32) (param $1 i32) (param $2 i32)
+ (nop)
+ )
+ (func $main (; 4 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
+ (local $2 i32)
+ (local $3 i32)
+ (local $4 i32)
+ (local $5 i32)
+ (local.set $2
+ (call $atoi\28char\20const*\29
(i32.load offset=4
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$3
- (call $_Z4atoiPKc
+ (local.set $3
+ (call $atoi\28char\20const*\29
(i32.load offset=8
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$4
- (call $_Z4atoiPKc
+ (local.set $4
+ (call $atoi\28char\20const*\29
(i32.load offset=12
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$5
- (call $_Z4atoiPKc
+ (local.set $5
+ (call $atoi\28char\20const*\29
(i32.load offset=16
- (local.get $var$1)
+ (local.get $1)
)
)
)
- (local.set $var$1
- (call $_Z4atoiPKc
+ (local.set $1
+ (call $atoi\28char\20const*\29
(i32.load offset=20
- (local.get $var$1)
+ (local.get $1)
)
)
)
(call_indirect (type $0)
- (local.get $var$2)
+ (local.get $2)
)
(call_indirect (type $1)
(i32.const 3)
- (local.get $var$3)
+ (local.get $3)
)
(drop
(call_indirect (type $2)
(i32.const 4)
(i32.const 5)
- (local.get $var$4)
+ (local.get $4)
)
)
(drop
@@ -90,14 +93,14 @@
(f32.const 3.0999999046325684)
(f32.const 4.199999809265137)
(i32.const 5)
- (local.get $var$5)
+ (local.get $5)
)
)
(drop
(call_indirect (type $4)
(f64.const 4.2)
(i32.const 5)
- (local.get $var$1)
+ (local.get $1)
)
)
(call_indirect (type $5)
@@ -108,16 +111,13 @@
(i32.const 1)
(i32.const 2)
(i32.gt_s
- (local.get $var$0)
+ (local.get $0)
(i32.const 3)
)
)
)
(i32.const 0)
)
- (func $__wasm_call_ctors (; 4 ;) (type $0)
- (nop)
- )
(func $stackSave (; 5 ;) (result i32)
(global.get $global$0)
)
@@ -180,9 +180,9 @@
"exports": [
"memory",
"__post_instantiate",
- "main",
"__heap_base",
"__data_end",
+ "main",
"stackSave",
"stackAlloc",
"stackRestore",