blob: d0c8ba0e7e6f10a890ca5e7435a6c28847abc15f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
;;; TOOL: run-wasm-decompile
(module
(import "ns" "fi" (func))
(import "ns" "g3" (global i32))
(import "ns" "tab3" (table 0 12 funcref))
;; (import "ns" "m1" (memory 1)) ;; Can test only 1 at a time :(
(memory (export "m2") 1)
(global $g1 (mut i32) (i32.const 10))
(global (export "g2") (mut i32) (i32.const 11))
(table $tab1 0 10 funcref)
(table (export "tab2") 0 11 funcref)
(data 0 (offset (i32.const 0)) "Hello, World!\n\00")
(func $f (param i32 i32) (result i32) (local i64 f32 f64)
i64.const 8
set_local 2
f32.const 6.0
set_local 3
f64.const 7.0
tee_local 4
f64.const 10.0
f64.lt
if
i32.const 1
i32.const 2
i32.load offset=3
i32.const 5
i32.add
i32.store offset=4
end
get_local 0
get_global $g1
i32.add
i32.const 9
call $f
drop
loop
block
i32.const 0
if (result i32)
i32.const 1
else
i32.const 2
end
br_if 0
br 1
end
i32.const 1
br_if 0
end
i32.const 1
)
;; LLD outputs a name section with de-mangled C++ function signatures as names,
;; so have to make sure special chars get removed.
(func (export "signature-&<>()") (param) (result))
(func (export "signature-&[]()") (param) (result))
(func $not-exported (param) (result))
(export "f" (func $f))
)
(;; STDOUT ;;;
export memory m2(initial: 1, max: 0);
import global ns_g3:int;
global g_b:int = 10;
export global g2:int = 11;
import table ns_tab3:funcref;
table T_b:funcref(min: 0, max: 10);
export table tab2:funcref(min: 0, max: 11);
data d_a(offset: 0) = "Hello, World!\0a\00";
import function ns_fi();
export function f(a:int, b:int):int {
var c:long = 8L;
var d:float = 6f;
var e:double = 7d;
if (e < 10d) { 1[4]:int = (2[3]:int + 5) }
f(a + g_b, 9);
loop L_b {
block B_c {
if (if (0) { 1 } else { 2 }) break B_c;
continue L_b;
}
if (1) continue L_b;
}
return 1;
}
function signature______() {
}
function signature_______1() {
}
function f_e() {
}
;;; STDOUT ;;)
|