Debian Codegraph @

js/src/jit-test/tests/wasm/spec/exception-handling/store.wast.js

raw
1 /* Copyright 2021 Mozilla Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 // ./test/core/store.wast
17
18 // ./test/core/store.wast:3
19 let $0 = instantiate(`(module
20 (memory 1)
21
22 (func (export "as-block-value")
23 (block (i32.store (i32.const 0) (i32.const 1)))
24 )
25 (func (export "as-loop-value")
26 (loop (i32.store (i32.const 0) (i32.const 1)))
27 )
28
29 (func (export "as-br-value")
30 (block (br 0 (i32.store (i32.const 0) (i32.const 1))))
31 )
32 (func (export "as-br_if-value")
33 (block
34 (br_if 0 (i32.store (i32.const 0) (i32.const 1)) (i32.const 1))
35 )
36 )
37 (func (export "as-br_if-value-cond")
38 (block
39 (br_if 0 (i32.const 6) (i32.store (i32.const 0) (i32.const 1)))
40 )
41 )
42 (func (export "as-br_table-value")
43 (block
44 (br_table 0 (i32.store (i32.const 0) (i32.const 1)) (i32.const 1))
45 )
46 )
47
48 (func (export "as-return-value")
49 (return (i32.store (i32.const 0) (i32.const 1)))
50 )
51
52 (func (export "as-if-then")
53 (if (i32.const 1) (then (i32.store (i32.const 0) (i32.const 1))))
54 )
55 (func (export "as-if-else")
56 (if (i32.const 0) (then) (else (i32.store (i32.const 0) (i32.const 1))))
57 )
58 )`);
59
60 // ./test/core/store.wast:44
61 assert_return(() => invoke($0, `as-block-value`, []), []);
62
63 // ./test/core/store.wast:45
64 assert_return(() => invoke($0, `as-loop-value`, []), []);
65
66 // ./test/core/store.wast:47
67 assert_return(() => invoke($0, `as-br-value`, []), []);
68
69 // ./test/core/store.wast:48
70 assert_return(() => invoke($0, `as-br_if-value`, []), []);
71
72 // ./test/core/store.wast:49
73 assert_return(() => invoke($0, `as-br_if-value-cond`, []), []);
74
75 // ./test/core/store.wast:50
76 assert_return(() => invoke($0, `as-br_table-value`, []), []);
77
78 // ./test/core/store.wast:52
79 assert_return(() => invoke($0, `as-return-value`, []), []);
80
81 // ./test/core/store.wast:54
82 assert_return(() => invoke($0, `as-if-then`, []), []);
83
84 // ./test/core/store.wast:55
85 assert_return(() => invoke($0, `as-if-else`, []), []);
86
87 // ./test/core/store.wast:57
88 assert_malformed(
89 () => instantiate(`(memory 1) (func (param i32) (i32.store32 (local.get 0) (i32.const 0))) `),
90 `unknown operator`,
91 );
92
93 // ./test/core/store.wast:64
94 assert_malformed(
95 () => instantiate(`(memory 1) (func (param i32) (i32.store64 (local.get 0) (i64.const 0))) `),
96 `unknown operator`,
97 );
98
99 // ./test/core/store.wast:72
100 assert_malformed(
101 () => instantiate(`(memory 1) (func (param i32) (i64.store64 (local.get 0) (i64.const 0))) `),
102 `unknown operator`,
103 );
104
105 // ./test/core/store.wast:80
106 assert_malformed(
107 () => instantiate(`(memory 1) (func (param i32) (f32.store32 (local.get 0) (f32.const 0))) `),
108 `unknown operator`,
109 );
110
111 // ./test/core/store.wast:87
112 assert_malformed(
113 () => instantiate(`(memory 1) (func (param i32) (f32.store64 (local.get 0) (f64.const 0))) `),
114 `unknown operator`,
115 );
116
117 // ./test/core/store.wast:95
118 assert_malformed(
119 () => instantiate(`(memory 1) (func (param i32) (f64.store32 (local.get 0) (f32.const 0))) `),
120 `unknown operator`,
121 );
122
123 // ./test/core/store.wast:102
124 assert_malformed(
125 () => instantiate(`(memory 1) (func (param i32) (f64.store64 (local.get 0) (f64.const 0))) `),
126 `unknown operator`,
127 );
128
129 // ./test/core/store.wast:111
130 assert_invalid(
131 () => instantiate(`(module (memory 1) (func (param i32) (result i32) (i32.store (i32.const 0) (i32.const 1))))`),
132 `type mismatch`,
133 );
134
135 // ./test/core/store.wast:115
136 assert_invalid(
137 () => instantiate(`(module (memory 1) (func (param i64) (result i64) (i64.store (i32.const 0) (i64.const 1))))`),
138 `type mismatch`,
139 );
140
141 // ./test/core/store.wast:119
142 assert_invalid(
143 () => instantiate(`(module (memory 1) (func (param f32) (result f32) (f32.store (i32.const 0) (f32.const 1))))`),
144 `type mismatch`,
145 );
146
147 // ./test/core/store.wast:123
148 assert_invalid(
149 () => instantiate(`(module (memory 1) (func (param f64) (result f64) (f64.store (i32.const 0) (f64.const 1))))`),
150 `type mismatch`,
151 );
152
153 // ./test/core/store.wast:127
154 assert_invalid(
155 () => instantiate(`(module (memory 1) (func (param i32) (result i32) (i32.store8 (i32.const 0) (i32.const 1))))`),
156 `type mismatch`,
157 );
158
159 // ./test/core/store.wast:131
160 assert_invalid(
161 () => instantiate(`(module (memory 1) (func (param i32) (result i32) (i32.store16 (i32.const 0) (i32.const 1))))`),
162 `type mismatch`,
163 );
164
165 // ./test/core/store.wast:135
166 assert_invalid(
167 () => instantiate(`(module (memory 1) (func (param i64) (result i64) (i64.store8 (i32.const 0) (i64.const 1))))`),
168 `type mismatch`,
169 );
170
171 // ./test/core/store.wast:139
172 assert_invalid(
173 () => instantiate(`(module (memory 1) (func (param i64) (result i64) (i64.store16 (i32.const 0) (i64.const 1))))`),
174 `type mismatch`,
175 );
176
177 // ./test/core/store.wast:143
178 assert_invalid(
179 () => instantiate(`(module (memory 1) (func (param i64) (result i64) (i64.store32 (i32.const 0) (i64.const 1))))`),
180 `type mismatch`,
181 );
182
183 // ./test/core/store.wast:149
184 assert_invalid(
185 () => instantiate(`(module
186 (memory 1)
187 (func $$type-address-empty
188 (i32.store)
189 )
190 )`),
191 `type mismatch`,
192 );
193
194 // ./test/core/store.wast:158
195 assert_invalid(
196 () => instantiate(`(module
197 (memory 1)
198 (func $$type-value-empty
199 (i32.const 0) (i32.store)
200 )
201 )`),
202 `type mismatch`,
203 );
204
205 // ./test/core/store.wast:167
206 assert_invalid(
207 () => instantiate(`(module
208 (memory 1)
209 (func $$type-address-empty-in-block
210 (i32.const 0) (i32.const 0)
211 (block (i32.store))
212 )
213 )`),
214 `type mismatch`,
215 );
216
217 // ./test/core/store.wast:177
218 assert_invalid(
219 () => instantiate(`(module
220 (memory 1)
221 (func $$type-value-empty-in-block
222 (i32.const 0)
223 (block (i32.const 0) (i32.store))
224 )
225 )`),
226 `type mismatch`,
227 );
228
229 // ./test/core/store.wast:187
230 assert_invalid(
231 () => instantiate(`(module
232 (memory 1)
233 (func $$type-address-empty-in-loop
234 (i32.const 0) (i32.const 0)
235 (loop (i32.store))
236 )
237 )`),
238 `type mismatch`,
239 );
240
241 // ./test/core/store.wast:197
242 assert_invalid(
243 () => instantiate(`(module
244 (memory 1)
245 (func $$type-value-empty-in-loop
246 (i32.const 0)
247 (loop (i32.const 0) (i32.store))
248 )
249 )`),
250 `type mismatch`,
251 );
252
253 // ./test/core/store.wast:207
254 assert_invalid(
255 () => instantiate(`(module
256 (memory 1)
257 (func $$type-address-empty-in-then
258 (i32.const 0) (i32.const 0)
259 (if (then (i32.store)))
260 )
261 )`),
262 `type mismatch`,
263 );
264
265 // ./test/core/store.wast:217
266 assert_invalid(
267 () => instantiate(`(module
268 (memory 1)
269 (func $$type-value-empty-in-then
270 (i32.const 0)
271 (if (then (i32.const 0) (i32.store)))
272 )
273 )`),
274 `type mismatch`,
275 );
276
277 // ./test/core/store.wast:227
278 assert_invalid(
279 () => instantiate(`(module
280 (memory 1)
281 (func $$type-address-empty-in-else
282 (i32.const 0) (i32.const 0)
283 (if (result i32) (then (i32.const 0)) (else (i32.store)))
284 )
285 )`),
286 `type mismatch`,
287 );
288
289 // ./test/core/store.wast:237
290 assert_invalid(
291 () => instantiate(`(module
292 (memory 1)
293 (func $$type-value-empty-in-else
294 (i32.const 0)
295 (if (result i32) (then (i32.const 0)) (else (i32.const 0) (i32.store)))
296 )
297 )`),
298 `type mismatch`,
299 );
300
301 // ./test/core/store.wast:247
302 assert_invalid(
303 () => instantiate(`(module
304 (memory 1)
305 (func $$type-address-empty-in-br
306 (i32.const 0) (i32.const 0)
307 (block (br 0 (i32.store)))
308 )
309 )`),
310 `type mismatch`,
311 );
312
313 // ./test/core/store.wast:257
314 assert_invalid(
315 () => instantiate(`(module
316 (memory 1)
317 (func $$type-value-empty-in-br
318 (i32.const 0)
319 (block (br 0 (i32.const 0) (i32.store)))
320 )
321 )`),
322 `type mismatch`,
323 );
324
325 // ./test/core/store.wast:267
326 assert_invalid(
327 () => instantiate(`(module
328 (memory 1)
329 (func $$type-address-empty-in-br_if
330 (i32.const 0) (i32.const 0)
331 (block (br_if 0 (i32.store) (i32.const 1)) )
332 )
333 )`),
334 `type mismatch`,
335 );
336
337 // ./test/core/store.wast:277
338 assert_invalid(
339 () => instantiate(`(module
340 (memory 1)
341 (func $$type-value-empty-in-br_if
342 (i32.const 0)
343 (block (br_if 0 (i32.const 0) (i32.store) (i32.const 1)) )
344 )
345 )`),
346 `type mismatch`,
347 );
348
349 // ./test/core/store.wast:287
350 assert_invalid(
351 () => instantiate(`(module
352 (memory 1)
353 (func $$type-address-empty-in-br_table
354 (i32.const 0) (i32.const 0)
355 (block (br_table 0 (i32.store)))
356 )
357 )`),
358 `type mismatch`,
359 );
360
361 // ./test/core/store.wast:297
362 assert_invalid(
363 () => instantiate(`(module
364 (memory 1)
365 (func $$type-value-empty-in-br_table
366 (i32.const 0)
367 (block (br_table 0 (i32.const 0) (i32.store)))
368 )
369 )`),
370 `type mismatch`,
371 );
372
373 // ./test/core/store.wast:307
374 assert_invalid(
375 () => instantiate(`(module
376 (memory 1)
377 (func $$type-address-empty-in-return
378 (return (i32.store))
379 )
380 )`),
381 `type mismatch`,
382 );
383
384 // ./test/core/store.wast:316
385 assert_invalid(
386 () => instantiate(`(module
387 (memory 1)
388 (func $$type-value-empty-in-return
389 (return (i32.const 0) (i32.store))
390 )
391 )`),
392 `type mismatch`,
393 );
394
395 // ./test/core/store.wast:325
396 assert_invalid(
397 () => instantiate(`(module
398 (memory 1)
399 (func $$type-address-empty-in-select
400 (select (i32.store) (i32.const 1) (i32.const 2))
401 )
402 )`),
403 `type mismatch`,
404 );
405
406 // ./test/core/store.wast:334
407 assert_invalid(
408 () => instantiate(`(module
409 (memory 1)
410 (func $$type-value-empty-in-select
411 (select (i32.const 0) (i32.store) (i32.const 1) (i32.const 2))
412 )
413 )`),
414 `type mismatch`,
415 );
416
417 // ./test/core/store.wast:343
418 assert_invalid(
419 () => instantiate(`(module
420 (memory 1)
421 (func $$type-address-empty-in-call
422 (call 1 (i32.store))
423 )
424 (func (param i32) (result i32) (local.get 0))
425 )`),
426 `type mismatch`,
427 );
428
429 // ./test/core/store.wast:353
430 assert_invalid(
431 () => instantiate(`(module
432 (memory 1)
433 (func $$type-value-empty-in-call
434 (call 1 (i32.const 0) (i32.store))
435 )
436 (func (param i32) (result i32) (local.get 0))
437 )`),
438 `type mismatch`,
439 );
440
441 // ./test/core/store.wast:363
442 assert_invalid(
443 () => instantiate(`(module
444 (memory 1)
445 (func $$f (param i32) (result i32) (local.get 0))
446 (type $$sig (func (param i32) (result i32)))
447 (table funcref (elem $$f))
448 (func $$type-address-empty-in-call_indirect
449 (block (result i32)
450 (call_indirect (type $$sig)
451 (i32.store) (i32.const 0)
452 )
453 )
454 )
455 )`),
456 `type mismatch`,
457 );
458
459 // ./test/core/store.wast:379
460 assert_invalid(
461 () => instantiate(`(module
462 (memory 1)
463 (func $$f (param i32) (result i32) (local.get 0))
464 (type $$sig (func (param i32) (result i32)))
465 (table funcref (elem $$f))
466 (func $$type-value-empty-in-call_indirect
467 (block (result i32)
468 (call_indirect (type $$sig)
469 (i32.const 0) (i32.store) (i32.const 0)
470 )
471 )
472 )
473 )`),
474 `type mismatch`,
475 );
476
477 // ./test/core/store.wast:399
478 assert_invalid(
479 () => instantiate(`(module (memory 1) (func (i32.store (f32.const 0) (i32.const 0))))`),
480 `type mismatch`,
481 );
482
483 // ./test/core/store.wast:400
484 assert_invalid(
485 () => instantiate(`(module (memory 1) (func (i32.store8 (f32.const 0) (i32.const 0))))`),
486 `type mismatch`,
487 );
488
489 // ./test/core/store.wast:401
490 assert_invalid(
491 () => instantiate(`(module (memory 1) (func (i32.store16 (f32.const 0) (i32.const 0))))`),
492 `type mismatch`,
493 );
494
495 // ./test/core/store.wast:402
496 assert_invalid(
497 () => instantiate(`(module (memory 1) (func (i64.store (f32.const 0) (i32.const 0))))`),
498 `type mismatch`,
499 );
500
501 // ./test/core/store.wast:403
502 assert_invalid(
503 () => instantiate(`(module (memory 1) (func (i64.store8 (f32.const 0) (i64.const 0))))`),
504 `type mismatch`,
505 );
506
507 // ./test/core/store.wast:404
508 assert_invalid(
509 () => instantiate(`(module (memory 1) (func (i64.store16 (f32.const 0) (i64.const 0))))`),
510 `type mismatch`,
511 );
512
513 // ./test/core/store.wast:405
514 assert_invalid(
515 () => instantiate(`(module (memory 1) (func (i64.store32 (f32.const 0) (i64.const 0))))`),
516 `type mismatch`,
517 );
518
519 // ./test/core/store.wast:406
520 assert_invalid(
521 () => instantiate(`(module (memory 1) (func (f32.store (f32.const 0) (f32.const 0))))`),
522 `type mismatch`,
523 );
524
525 // ./test/core/store.wast:407
526 assert_invalid(
527 () => instantiate(`(module (memory 1) (func (f64.store (f32.const 0) (f64.const 0))))`),
528 `type mismatch`,
529 );
530
531 // ./test/core/store.wast:409
532 assert_invalid(
533 () => instantiate(`(module (memory 1) (func (i32.store (i32.const 0) (f32.const 0))))`),
534 `type mismatch`,
535 );
536
537 // ./test/core/store.wast:410
538 assert_invalid(
539 () => instantiate(`(module (memory 1) (func (i32.store8 (i32.const 0) (f32.const 0))))`),
540 `type mismatch`,
541 );
542
543 // ./test/core/store.wast:411
544 assert_invalid(
545 () => instantiate(`(module (memory 1) (func (i32.store16 (i32.const 0) (f32.const 0))))`),
546 `type mismatch`,
547 );
548
549 // ./test/core/store.wast:412
550 assert_invalid(
551 () => instantiate(`(module (memory 1) (func (i64.store (i32.const 0) (f32.const 0))))`),
552 `type mismatch`,
553 );
554
555 // ./test/core/store.wast:413
556 assert_invalid(
557 () => instantiate(`(module (memory 1) (func (i64.store8 (i32.const 0) (f64.const 0))))`),
558 `type mismatch`,
559 );
560
561 // ./test/core/store.wast:414
562 assert_invalid(
563 () => instantiate(`(module (memory 1) (func (i64.store16 (i32.const 0) (f64.const 0))))`),
564 `type mismatch`,
565 );
566
567 // ./test/core/store.wast:415
568 assert_invalid(
569 () => instantiate(`(module (memory 1) (func (i64.store32 (i32.const 0) (f64.const 0))))`),
570 `type mismatch`,
571 );
572
573 // ./test/core/store.wast:416
574 assert_invalid(
575 () => instantiate(`(module (memory 1) (func (f32.store (i32.const 0) (i32.const 0))))`),
576 `type mismatch`,
577 );
578
579 // ./test/core/store.wast:417
580 assert_invalid(
581 () => instantiate(`(module (memory 1) (func (f64.store (i32.const 0) (i64.const 0))))`),
582 `type mismatch`,
583 );