forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhash.untouched.wat
More file actions
375 lines (375 loc) Β· 8.44 KB
/
hash.untouched.wat
File metadata and controls
375 lines (375 loc) Β· 8.44 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
(module
(type $ii (func (param i32) (result i32)))
(type $Ii (func (param i64) (result i32)))
(type $v (func))
(memory $0 1)
(data (i32.const 8) "\00\00\00\00")
(data (i32.const 16) "\01\00\00\00a\00")
(data (i32.const 24) "\02\00\00\00a\00b\00")
(data (i32.const 32) "\03\00\00\00a\00b\00c\00")
(table $0 1 anyfunc)
(elem (i32.const 0) $null)
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
(global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824))
(global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8))
(global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816))
(global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4))
(global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910))
(global $~lib/internal/hash/FNV_OFFSET i32 (i32.const -2128831035))
(global $~lib/internal/hash/FNV_PRIME i32 (i32.const 16777619))
(global $Infinity f64 (f64.const inf))
(global $NaN f64 (f64.const nan:0x8000000000000))
(global $HEAP_BASE i32 (i32.const 44))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $~lib/internal/hash/hashStr (; 0 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
get_global $~lib/internal/hash/FNV_OFFSET
set_local $1
block $break|0
block
i32.const 0
set_local $2
get_local $0
i32.load
i32.const 1
i32.shl
set_local $3
end
loop $repeat|0
get_local $2
get_local $3
i32.lt_u
i32.eqz
br_if $break|0
get_local $1
get_local $0
get_local $2
i32.add
i32.load8_u offset=4
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $1
get_local $2
i32.const 1
i32.add
set_local $2
br $repeat|0
unreachable
end
unreachable
end
get_local $1
)
(func $std/hash/check (; 1 ;) (type $ii) (param $0 i32) (result i32)
i32.const 1
)
(func $~lib/internal/hash/hash32 (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
get_global $~lib/internal/hash/FNV_OFFSET
set_local $1
get_local $1
get_local $0
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $1
get_local $1
get_local $0
i32.const 8
i32.shr_u
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $1
get_local $1
get_local $0
i32.const 16
i32.shr_u
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $1
get_local $1
get_local $0
i32.const 24
i32.shr_u
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $1
get_local $1
)
(func $~lib/internal/hash/hash64 (; 3 ;) (type $Ii) (param $0 i64) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
get_local $0
i32.wrap/i64
set_local $1
get_local $0
i64.const 32
i64.shr_u
i32.wrap/i64
set_local $2
get_global $~lib/internal/hash/FNV_OFFSET
set_local $3
get_local $3
get_local $1
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $1
i32.const 8
i32.shr_u
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $1
i32.const 16
i32.shr_u
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $1
i32.const 24
i32.shr_u
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $2
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $2
i32.const 8
i32.shr_u
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $2
i32.const 16
i32.shr_u
i32.const 255
i32.and
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
get_local $2
i32.const 24
i32.shr_u
i32.xor
get_global $~lib/internal/hash/FNV_PRIME
i32.mul
set_local $3
get_local $3
)
(func $start (; 4 ;) (type $v)
(local $0 i32)
(local $1 f32)
(local $2 f64)
block $~lib/internal/hash/HASH<String>|inlined.0 (result i32)
i32.const 0
set_local $0
get_local $0
call $~lib/internal/hash/hashStr
br $~lib/internal/hash/HASH<String>|inlined.0
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<String>|inlined.1 (result i32)
i32.const 8
set_local $0
get_local $0
call $~lib/internal/hash/hashStr
br $~lib/internal/hash/HASH<String>|inlined.1
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<String>|inlined.2 (result i32)
i32.const 16
set_local $0
get_local $0
call $~lib/internal/hash/hashStr
br $~lib/internal/hash/HASH<String>|inlined.2
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<String>|inlined.3 (result i32)
i32.const 24
set_local $0
get_local $0
call $~lib/internal/hash/hashStr
br $~lib/internal/hash/HASH<String>|inlined.3
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<String>|inlined.4 (result i32)
i32.const 32
set_local $0
get_local $0
call $~lib/internal/hash/hashStr
br $~lib/internal/hash/HASH<String>|inlined.4
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f32>|inlined.0 (result i32)
f32.const 0
set_local $1
get_local $1
i32.reinterpret/f32
call $~lib/internal/hash/hash32
br $~lib/internal/hash/HASH<f32>|inlined.0
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f32>|inlined.1 (result i32)
f32.const 1
set_local $1
get_local $1
i32.reinterpret/f32
call $~lib/internal/hash/hash32
br $~lib/internal/hash/HASH<f32>|inlined.1
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f32>|inlined.2 (result i32)
f32.const 1.100000023841858
set_local $1
get_local $1
i32.reinterpret/f32
call $~lib/internal/hash/hash32
br $~lib/internal/hash/HASH<f32>|inlined.2
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f32>|inlined.3 (result i32)
f32.const 0
set_local $1
get_local $1
i32.reinterpret/f32
call $~lib/internal/hash/hash32
br $~lib/internal/hash/HASH<f32>|inlined.3
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f32>|inlined.4 (result i32)
f32.const inf
set_local $1
get_local $1
i32.reinterpret/f32
call $~lib/internal/hash/hash32
br $~lib/internal/hash/HASH<f32>|inlined.4
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f32>|inlined.5 (result i32)
f32.const nan:0x400000
set_local $1
get_local $1
i32.reinterpret/f32
call $~lib/internal/hash/hash32
br $~lib/internal/hash/HASH<f32>|inlined.5
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f64>|inlined.0 (result i32)
f64.const 0
set_local $2
get_local $2
i64.reinterpret/f64
call $~lib/internal/hash/hash64
br $~lib/internal/hash/HASH<f64>|inlined.0
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f64>|inlined.1 (result i32)
f64.const 1
set_local $2
get_local $2
i64.reinterpret/f64
call $~lib/internal/hash/hash64
br $~lib/internal/hash/HASH<f64>|inlined.1
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f64>|inlined.2 (result i32)
f64.const 1.1
set_local $2
get_local $2
i64.reinterpret/f64
call $~lib/internal/hash/hash64
br $~lib/internal/hash/HASH<f64>|inlined.2
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f64>|inlined.3 (result i32)
f64.const 0
set_local $2
get_local $2
i64.reinterpret/f64
call $~lib/internal/hash/hash64
br $~lib/internal/hash/HASH<f64>|inlined.3
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f64>|inlined.4 (result i32)
f64.const inf
set_local $2
get_local $2
i64.reinterpret/f64
call $~lib/internal/hash/hash64
br $~lib/internal/hash/HASH<f64>|inlined.4
end
call $std/hash/check
drop
block $~lib/internal/hash/HASH<f64>|inlined.5 (result i32)
f64.const nan:0x8000000000000
set_local $2
get_local $2
i64.reinterpret/f64
call $~lib/internal/hash/hash64
br $~lib/internal/hash/HASH<f64>|inlined.5
end
call $std/hash/check
drop
)
(func $null (; 5 ;) (type $v)
)
)