forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction-types.untouched.wat
More file actions
237 lines (237 loc) Β· 5.23 KB
/
function-types.untouched.wat
File metadata and controls
237 lines (237 loc) Β· 5.23 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
(module
(type $i (func (result i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $III (func (param i64 i64) (result i64)))
(type $FFF (func (param f64 f64) (result f64)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\11\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s\00")
(table $0 5 anyfunc)
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|1 $function-types/makeAdder<i64>~anonymous|2 $function-types/makeAdder<f64>~anonymous|3 $function-types/addI32)
(global $function-types/i32Adder (mut i32) (i32.const 0))
(global $~argc (mut i32) (i32.const 0))
(global $function-types/i64Adder (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 48))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $function-types/makeAdder<i32>~anonymous|1 (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
get_local $0
get_local $1
i32.add
)
(func $function-types/makeAdder<i32> (; 2 ;) (type $i) (result i32)
i32.const 1
)
(func $function-types/makeAdder<i64>~anonymous|2 (; 3 ;) (type $III) (param $0 i64) (param $1 i64) (result i64)
get_local $0
get_local $1
i64.add
)
(func $function-types/makeAdder<i64> (; 4 ;) (type $i) (result i32)
i32.const 2
)
(func $function-types/makeAdder<f64>~anonymous|3 (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64)
get_local $0
get_local $1
f64.add
)
(func $function-types/makeAdder<f64> (; 6 ;) (type $i) (result i32)
i32.const 3
)
(func $function-types/doAddWithFn<i32> (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
i32.const 2
set_global $~argc
get_local $0
get_local $1
get_local $2
call_indirect (type $iii)
)
(func $function-types/doAdd<i32> (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
i32.const 2
set_global $~argc
get_local $0
get_local $1
call $function-types/makeAdder<i32>
call_indirect (type $iii)
)
(func $function-types/addI32 (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
get_local $0
get_local $1
i32.add
)
(func $function-types/makeAndAdd<i32> (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
i32.const 2
set_global $~argc
get_local $0
get_local $1
get_local $2
call_indirect (type $iii)
)
(func $function-types/makeAndAdd<i32>|trampoline (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
block $1of1
block $0of1
block $outOfRange
get_global $~argc
i32.const 2
i32.sub
br_table $0of1 $1of1 $outOfRange
end
unreachable
end
call $function-types/makeAdder<i32>
set_local $2
end
get_local $0
get_local $1
get_local $2
call $function-types/makeAndAdd<i32>
)
(func $start (; 12 ;) (type $v)
nop
call $function-types/makeAdder<i32>
set_global $function-types/i32Adder
block (result i32)
i32.const 2
set_global $~argc
i32.const 1
i32.const 2
get_global $function-types/i32Adder
call_indirect (type $iii)
end
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 11
i32.const 0
call $~lib/env/abort
unreachable
end
call $function-types/makeAdder<i64>
set_global $function-types/i64Adder
block (result i64)
i32.const 2
set_global $~argc
i64.const 10
i64.const 20
get_global $function-types/i64Adder
call_indirect (type $III)
end
i64.const 30
i64.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 15
i32.const 0
call $~lib/env/abort
unreachable
end
block (result f64)
i32.const 2
set_global $~argc
f64.const 1.5
f64.const 2.5
call $function-types/makeAdder<f64>
call_indirect (type $FFF)
end
f64.const 4
f64.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 17
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 2
i32.const 3
get_global $function-types/i32Adder
call $function-types/doAddWithFn<i32>
i32.const 5
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 23
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 3
i32.const 4
call $function-types/doAdd<i32>
i32.const 7
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 29
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 4
i32.const 5
i32.const 4
call $function-types/doAddWithFn<i32>
i32.const 9
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 35
i32.const 0
call $~lib/env/abort
unreachable
end
block (result i32)
i32.const 2
set_global $~argc
i32.const 1
i32.const 2
i32.const 0
call $function-types/makeAndAdd<i32>|trampoline
end
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 41
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 1
i32.const 2
call $function-types/makeAdder<i32>
call $function-types/makeAndAdd<i32>
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 42
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $null (; 13 ;) (type $v)
)
)