summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/spec/spec/call.wast.js
blob: 4595cf4df0d82e593f71cc6b132d27dc54dff836 (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
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
/* Copyright 2021 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// ./test/core/call.wast

// ./test/core/call.wast:3
let $0 = instantiate(`(module
  ;; Auxiliary definitions
  (func $$const-i32 (result i32) (i32.const 0x132))
  (func $$const-i64 (result i64) (i64.const 0x164))
  (func $$const-f32 (result f32) (f32.const 0xf32))
  (func $$const-f64 (result f64) (f64.const 0xf64))
  (func $$const-i32-i64 (result i32 i64) (i32.const 0x132) (i64.const 0x164))

  (func $$id-i32 (param i32) (result i32) (local.get 0))
  (func $$id-i64 (param i64) (result i64) (local.get 0))
  (func $$id-f32 (param f32) (result f32) (local.get 0))
  (func $$id-f64 (param f64) (result f64) (local.get 0))
  (func $$id-i32-f64 (param i32 f64) (result i32 f64)
    (local.get 0) (local.get 1)
  )

  (func $$swap-i32-i32 (param i32 i32) (result i32 i32)
    (local.get 1) (local.get 0)
  )
  (func $$swap-f32-f64 (param f32 f64) (result f64 f32)
    (local.get 1) (local.get 0)
  )
  (func $$swap-f64-i32 (param f64 i32) (result i32 f64)
    (local.get 1) (local.get 0)
  )

  (func $$f32-i32 (param f32 i32) (result i32) (local.get 1))
  (func $$i32-i64 (param i32 i64) (result i64) (local.get 1))
  (func $$f64-f32 (param f64 f32) (result f32) (local.get 1))
  (func $$i64-f64 (param i64 f64) (result f64) (local.get 1))

  ;; Typing

  (func (export "type-i32") (result i32) (call $$const-i32))
  (func (export "type-i64") (result i64) (call $$const-i64))
  (func (export "type-f32") (result f32) (call $$const-f32))
  (func (export "type-f64") (result f64) (call $$const-f64))
  (func (export "type-i32-i64") (result i32 i64) (call $$const-i32-i64))

  (func (export "type-first-i32") (result i32) (call $$id-i32 (i32.const 32)))
  (func (export "type-first-i64") (result i64) (call $$id-i64 (i64.const 64)))
  (func (export "type-first-f32") (result f32) (call $$id-f32 (f32.const 1.32)))
  (func (export "type-first-f64") (result f64) (call $$id-f64 (f64.const 1.64)))

  (func (export "type-second-i32") (result i32)
    (call $$f32-i32 (f32.const 32.1) (i32.const 32))
  )
  (func (export "type-second-i64") (result i64)
    (call $$i32-i64 (i32.const 32) (i64.const 64))
  )
  (func (export "type-second-f32") (result f32)
    (call $$f64-f32 (f64.const 64) (f32.const 32))
  )
  (func (export "type-second-f64") (result f64)
    (call $$i64-f64 (i64.const 64) (f64.const 64.1))
  )

  (func (export "type-all-i32-f64") (result i32 f64)
    (call $$id-i32-f64 (i32.const 32) (f64.const 1.64))
  )
  (func (export "type-all-i32-i32") (result i32 i32)
    (call $$swap-i32-i32 (i32.const 1) (i32.const 2))
  )
  (func (export "type-all-f32-f64") (result f64 f32)
    (call $$swap-f32-f64 (f32.const 1) (f64.const 2))
  )
  (func (export "type-all-f64-i32") (result i32 f64)
    (call $$swap-f64-i32 (f64.const 1) (i32.const 2))
  )

  ;; Composition

  (func (export "as-binary-all-operands") (result i32)
    (i32.add (call $$swap-i32-i32 (i32.const 3) (i32.const 4)))
  )

  (func (export "as-mixed-operands") (result i32)
    (call $$swap-i32-i32 (i32.const 3) (i32.const 4))
    (i32.const 5)
    (i32.add)
    (i32.mul)
  )

  (func (export "as-call-all-operands") (result i32 i32)
    (call $$swap-i32-i32 (call $$swap-i32-i32 (i32.const 3) (i32.const 4)))
  )

  ;; Recursion

  (func $$fac (export "fac") (param i64) (result i64)
    (if (result i64) (i64.eqz (local.get 0))
      (then (i64.const 1))
      (else
        (i64.mul
          (local.get 0)
          (call $$fac (i64.sub (local.get 0) (i64.const 1)))
        )
      )
    )
  )

  (func $$fac-acc (export "fac-acc") (param i64 i64) (result i64)
    (if (result i64) (i64.eqz (local.get 0))
      (then (local.get 1))
      (else
        (call $$fac-acc
          (i64.sub (local.get 0) (i64.const 1))
          (i64.mul (local.get 0) (local.get 1))
        )
      )
    )
  )

  (func $$fib (export "fib") (param i64) (result i64)
    (if (result i64) (i64.le_u (local.get 0) (i64.const 1))
      (then (i64.const 1))
      (else
        (i64.add
          (call $$fib (i64.sub (local.get 0) (i64.const 2)))
          (call $$fib (i64.sub (local.get 0) (i64.const 1)))
        )
      )
    )
  )

  (func $$even (export "even") (param i64) (result i32)
    (if (result i32) (i64.eqz (local.get 0))
      (then (i32.const 44))
      (else (call $$odd (i64.sub (local.get 0) (i64.const 1))))
    )
  )
  (func $$odd (export "odd") (param i64) (result i32)
    (if (result i32) (i64.eqz (local.get 0))
      (then (i32.const 99))
      (else (call $$even (i64.sub (local.get 0) (i64.const 1))))
    )
  )

  ;; Stack exhaustion

  ;; Implementations are required to have every call consume some abstract
  ;; resource towards exhausting some abstract finite limit, such that
  ;; infinitely recursive test cases reliably trap in finite time. This is
  ;; because otherwise applications could come to depend on it on those
  ;; implementations and be incompatible with implementations that don't do
  ;; it (or don't do it under the same circumstances).

  (func $$runaway (export "runaway") (call $$runaway))

  (func $$mutual-runaway1 (export "mutual-runaway") (call $$mutual-runaway2))
  (func $$mutual-runaway2 (call $$mutual-runaway1))

  ;; As parameter of control constructs and instructions

  (memory 1)

  (func (export "as-select-first") (result i32)
    (select (call $$const-i32) (i32.const 2) (i32.const 3))
  )
  (func (export "as-select-mid") (result i32)
    (select (i32.const 2) (call $$const-i32) (i32.const 3))
  )
  (func (export "as-select-last") (result i32)
    (select (i32.const 2) (i32.const 3) (call $$const-i32))
  )

  (func (export "as-if-condition") (result i32)
    (if (result i32) (call $$const-i32) (then (i32.const 1)) (else (i32.const 2)))
  )

  (func (export "as-br_if-first") (result i32)
    (block (result i32) (br_if 0 (call $$const-i32) (i32.const 2)))
  )
  (func (export "as-br_if-last") (result i32)
    (block (result i32) (br_if 0 (i32.const 2) (call $$const-i32)))
  )

  (func (export "as-br_table-first") (result i32)
    (block (result i32) (call $$const-i32) (i32.const 2) (br_table 0 0))
  )
  (func (export "as-br_table-last") (result i32)
    (block (result i32) (i32.const 2) (call $$const-i32) (br_table 0 0))
  )

  (func $$func (param i32 i32) (result i32) (local.get 0))
  (type $$check (func (param i32 i32) (result i32)))
  (table funcref (elem $$func))
  (func (export "as-call_indirect-first") (result i32)
    (block (result i32)
      (call_indirect (type $$check)
        (call $$const-i32) (i32.const 2) (i32.const 0)
      )
    )
  )
  (func (export "as-call_indirect-mid") (result i32)
    (block (result i32)
      (call_indirect (type $$check)
        (i32.const 2) (call $$const-i32) (i32.const 0)
      )
    )
  )
  (func (export "as-call_indirect-last") (result i32)
    (block (result i32)
      (call_indirect (type $$check)
        (i32.const 1) (i32.const 2) (call $$const-i32)
      )
    )
  )

  (func (export "as-store-first")
    (call $$const-i32) (i32.const 1) (i32.store)
  )
  (func (export "as-store-last")
    (i32.const 10) (call $$const-i32) (i32.store)
  )

  (func (export "as-memory.grow-value") (result i32)
    (memory.grow (call $$const-i32))
  )
  (func (export "as-return-value") (result i32)
    (call $$const-i32) (return)
  )
  (func (export "as-drop-operand")
    (call $$const-i32) (drop)
  )
  (func (export "as-br-value") (result i32)
    (block (result i32) (br 0 (call $$const-i32)))
  )
  (func (export "as-local.set-value") (result i32)
    (local i32) (local.set 0 (call $$const-i32)) (local.get 0)
  )
  (func (export "as-local.tee-value") (result i32)
    (local i32) (local.tee 0 (call $$const-i32))
  )
  (global $$a (mut i32) (i32.const 10))
  (func (export "as-global.set-value") (result i32)
    (global.set $$a (call $$const-i32))
    (global.get $$a)
  )
  (func (export "as-load-operand") (result i32)
    (i32.load (call $$const-i32))
  )

  (func $$dummy (param i32) (result i32) (local.get 0))
  (func $$du (param f32) (result f32) (local.get 0))
  (func (export "as-unary-operand") (result f32)
    (block (result f32) (f32.sqrt (call $$du (f32.const 0x0p+0))))
  )

  (func (export "as-binary-left") (result i32)
    (block (result i32) (i32.add (call $$dummy (i32.const 1)) (i32.const 10)))
  )
  (func (export "as-binary-right") (result i32)
    (block (result i32) (i32.sub (i32.const 10) (call $$dummy (i32.const 1))))
  )

  (func (export "as-test-operand") (result i32)
    (block (result i32) (i32.eqz (call $$dummy (i32.const 1))))
  )

  (func (export "as-compare-left") (result i32)
    (block (result i32) (i32.le_u (call $$dummy (i32.const 1)) (i32.const 10)))
  )
  (func (export "as-compare-right") (result i32)
    (block (result i32) (i32.ne (i32.const 10) (call $$dummy (i32.const 1))))
  )

  (func (export "as-convert-operand") (result i64)
    (block (result i64) (i64.extend_i32_s (call $$dummy (i32.const 1))))
  )

  ;; Test correct argument passing

  (func $$return-from-long-argument-list-helper (param f32 i32 i32 f64 f32 f32 f32 f64 f32 i32 i32 f32 f64 i64 i64 i32 i64 i64 f32 i64 i64 i64 i32 f32 f32 f32 f64 f32 i32 i64 f32 f64 f64 f32 i32 f32 f32 f64 i64 f64 i32 i64 f32 f64 i32 i32 i32 i64 f64 i32 i64 i64 f64 f64 f64 f64 f64 f64 i32 f32 f64 f64 i32 i64 f32 f32 f32 i32 f64 f64 f64 f64 f64 f32 i64 i64 i32 i32 i32 f32 f64 i32 i64 f32 f32 f32 i32 i32 f32 f64 i64 f32 f64 f32 f32 f32 i32 f32 i64 i32) (result i32)
    (local.get 99)
  )

  (func (export "return-from-long-argument-list") (param i32) (result i32)
    (call $$return-from-long-argument-list-helper (f32.const 0) (i32.const 0) (i32.const 0) (f64.const 0) (f32.const 0) (f32.const 0) (f32.const 0) (f64.const 0) (f32.const 0) (i32.const 0) (i32.const 0) (f32.const 0) (f64.const 0) (i64.const 0) (i64.const 0) (i32.const 0) (i64.const 0) (i64.const 0) (f32.const 0) (i64.const 0) (i64.const 0) (i64.const 0) (i32.const 0) (f32.const 0) (f32.const 0) (f32.const 0) (f64.const 0) (f32.const 0) (i32.const 0) (i64.const 0) (f32.const 0) (f64.const 0) (f64.const 0) (f32.const 0) (i32.const 0) (f32.const 0) (f32.const 0) (f64.const 0) (i64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (f32.const 0) (f64.const 0) (i32.const 0) (i32.const 0) (i32.const 0) (i64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (i64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (i32.const 0) (f32.const 0) (f64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (f32.const 0) (f32.const 0) (f32.const 0) (i32.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f64.const 0) (f32.const 0) (i64.const 0) (i64.const 0) (i32.const 0) (i32.const 0) (i32.const 0) (f32.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (f32.const 0) (f32.const 0) (f32.const 0) (i32.const 0) (i32.const 0) (f32.const 0) (f64.const 0) (i64.const 0) (f32.const 0) (f64.const 0) (f32.const 0) (f32.const 0) (f32.const 0) (i32.const 0) (f32.const 0) (i64.const 0) (local.get 0))
  )
)`);

// ./test/core/call.wast:285
assert_return(() => invoke($0, `type-i32`, []), [value("i32", 306)]);

// ./test/core/call.wast:286
assert_return(() => invoke($0, `type-i64`, []), [value("i64", 356n)]);

// ./test/core/call.wast:287
assert_return(() => invoke($0, `type-f32`, []), [value("f32", 3890)]);

// ./test/core/call.wast:288
assert_return(() => invoke($0, `type-f64`, []), [value("f64", 3940)]);

// ./test/core/call.wast:289
assert_return(() => invoke($0, `type-i32-i64`, []), [value("i32", 306), value("i64", 356n)]);

// ./test/core/call.wast:291
assert_return(() => invoke($0, `type-first-i32`, []), [value("i32", 32)]);

// ./test/core/call.wast:292
assert_return(() => invoke($0, `type-first-i64`, []), [value("i64", 64n)]);

// ./test/core/call.wast:293
assert_return(() => invoke($0, `type-first-f32`, []), [value("f32", 1.32)]);

// ./test/core/call.wast:294
assert_return(() => invoke($0, `type-first-f64`, []), [value("f64", 1.64)]);

// ./test/core/call.wast:296
assert_return(() => invoke($0, `type-second-i32`, []), [value("i32", 32)]);

// ./test/core/call.wast:297
assert_return(() => invoke($0, `type-second-i64`, []), [value("i64", 64n)]);

// ./test/core/call.wast:298
assert_return(() => invoke($0, `type-second-f32`, []), [value("f32", 32)]);

// ./test/core/call.wast:299
assert_return(() => invoke($0, `type-second-f64`, []), [value("f64", 64.1)]);

// ./test/core/call.wast:301
assert_return(() => invoke($0, `type-all-i32-f64`, []), [value("i32", 32), value("f64", 1.64)]);

// ./test/core/call.wast:302
assert_return(() => invoke($0, `type-all-i32-i32`, []), [value("i32", 2), value("i32", 1)]);

// ./test/core/call.wast:303
assert_return(() => invoke($0, `type-all-f32-f64`, []), [value("f64", 2), value("f32", 1)]);

// ./test/core/call.wast:304
assert_return(() => invoke($0, `type-all-f64-i32`, []), [value("i32", 2), value("f64", 1)]);

// ./test/core/call.wast:306
assert_return(() => invoke($0, `as-binary-all-operands`, []), [value("i32", 7)]);

// ./test/core/call.wast:307
assert_return(() => invoke($0, `as-mixed-operands`, []), [value("i32", 32)]);

// ./test/core/call.wast:308
assert_return(() => invoke($0, `as-call-all-operands`, []), [value("i32", 3), value("i32", 4)]);

// ./test/core/call.wast:310
assert_return(() => invoke($0, `fac`, [0n]), [value("i64", 1n)]);

// ./test/core/call.wast:311
assert_return(() => invoke($0, `fac`, [1n]), [value("i64", 1n)]);

// ./test/core/call.wast:312
assert_return(() => invoke($0, `fac`, [5n]), [value("i64", 120n)]);

// ./test/core/call.wast:313
assert_return(() => invoke($0, `fac`, [25n]), [value("i64", 7034535277573963776n)]);

// ./test/core/call.wast:314
assert_return(() => invoke($0, `fac-acc`, [0n, 1n]), [value("i64", 1n)]);

// ./test/core/call.wast:315
assert_return(() => invoke($0, `fac-acc`, [1n, 1n]), [value("i64", 1n)]);

// ./test/core/call.wast:316
assert_return(() => invoke($0, `fac-acc`, [5n, 1n]), [value("i64", 120n)]);

// ./test/core/call.wast:317
assert_return(() => invoke($0, `fac-acc`, [25n, 1n]), [value("i64", 7034535277573963776n)]);

// ./test/core/call.wast:322
assert_return(() => invoke($0, `fib`, [0n]), [value("i64", 1n)]);

// ./test/core/call.wast:323
assert_return(() => invoke($0, `fib`, [1n]), [value("i64", 1n)]);

// ./test/core/call.wast:324
assert_return(() => invoke($0, `fib`, [2n]), [value("i64", 2n)]);

// ./test/core/call.wast:325
assert_return(() => invoke($0, `fib`, [5n]), [value("i64", 8n)]);

// ./test/core/call.wast:326
assert_return(() => invoke($0, `fib`, [20n]), [value("i64", 10946n)]);

// ./test/core/call.wast:328
assert_return(() => invoke($0, `even`, [0n]), [value("i32", 44)]);

// ./test/core/call.wast:329
assert_return(() => invoke($0, `even`, [1n]), [value("i32", 99)]);

// ./test/core/call.wast:330
assert_return(() => invoke($0, `even`, [100n]), [value("i32", 44)]);

// ./test/core/call.wast:331
assert_return(() => invoke($0, `even`, [77n]), [value("i32", 99)]);

// ./test/core/call.wast:332
assert_return(() => invoke($0, `odd`, [0n]), [value("i32", 99)]);

// ./test/core/call.wast:333
assert_return(() => invoke($0, `odd`, [1n]), [value("i32", 44)]);

// ./test/core/call.wast:334
assert_return(() => invoke($0, `odd`, [200n]), [value("i32", 99)]);

// ./test/core/call.wast:335
assert_return(() => invoke($0, `odd`, [77n]), [value("i32", 44)]);

// ./test/core/call.wast:337
assert_exhaustion(() => invoke($0, `runaway`, []), `call stack exhausted`);

// ./test/core/call.wast:338
assert_exhaustion(() => invoke($0, `mutual-runaway`, []), `call stack exhausted`);

// ./test/core/call.wast:340
assert_return(() => invoke($0, `as-select-first`, []), [value("i32", 306)]);

// ./test/core/call.wast:341
assert_return(() => invoke($0, `as-select-mid`, []), [value("i32", 2)]);

// ./test/core/call.wast:342
assert_return(() => invoke($0, `as-select-last`, []), [value("i32", 2)]);

// ./test/core/call.wast:344
assert_return(() => invoke($0, `as-if-condition`, []), [value("i32", 1)]);

// ./test/core/call.wast:346
assert_return(() => invoke($0, `as-br_if-first`, []), [value("i32", 306)]);

// ./test/core/call.wast:347
assert_return(() => invoke($0, `as-br_if-last`, []), [value("i32", 2)]);

// ./test/core/call.wast:349
assert_return(() => invoke($0, `as-br_table-first`, []), [value("i32", 306)]);

// ./test/core/call.wast:350
assert_return(() => invoke($0, `as-br_table-last`, []), [value("i32", 2)]);

// ./test/core/call.wast:352
assert_return(() => invoke($0, `as-call_indirect-first`, []), [value("i32", 306)]);

// ./test/core/call.wast:353
assert_return(() => invoke($0, `as-call_indirect-mid`, []), [value("i32", 2)]);

// ./test/core/call.wast:354
assert_trap(() => invoke($0, `as-call_indirect-last`, []), `undefined element`);

// ./test/core/call.wast:356
assert_return(() => invoke($0, `as-store-first`, []), []);

// ./test/core/call.wast:357
assert_return(() => invoke($0, `as-store-last`, []), []);

// ./test/core/call.wast:359
assert_return(() => invoke($0, `as-memory.grow-value`, []), [value("i32", 1)]);

// ./test/core/call.wast:360
assert_return(() => invoke($0, `as-return-value`, []), [value("i32", 306)]);

// ./test/core/call.wast:361
assert_return(() => invoke($0, `as-drop-operand`, []), []);

// ./test/core/call.wast:362
assert_return(() => invoke($0, `as-br-value`, []), [value("i32", 306)]);

// ./test/core/call.wast:363
assert_return(() => invoke($0, `as-local.set-value`, []), [value("i32", 306)]);

// ./test/core/call.wast:364
assert_return(() => invoke($0, `as-local.tee-value`, []), [value("i32", 306)]);

// ./test/core/call.wast:365
assert_return(() => invoke($0, `as-global.set-value`, []), [value("i32", 306)]);

// ./test/core/call.wast:366
assert_return(() => invoke($0, `as-load-operand`, []), [value("i32", 1)]);

// ./test/core/call.wast:368
assert_return(() => invoke($0, `as-unary-operand`, []), [value("f32", 0)]);

// ./test/core/call.wast:369
assert_return(() => invoke($0, `as-binary-left`, []), [value("i32", 11)]);

// ./test/core/call.wast:370
assert_return(() => invoke($0, `as-binary-right`, []), [value("i32", 9)]);

// ./test/core/call.wast:371
assert_return(() => invoke($0, `as-test-operand`, []), [value("i32", 0)]);

// ./test/core/call.wast:372
assert_return(() => invoke($0, `as-compare-left`, []), [value("i32", 1)]);

// ./test/core/call.wast:373
assert_return(() => invoke($0, `as-compare-right`, []), [value("i32", 1)]);

// ./test/core/call.wast:374
assert_return(() => invoke($0, `as-convert-operand`, []), [value("i64", 1n)]);

// ./test/core/call.wast:376
assert_return(() => invoke($0, `return-from-long-argument-list`, [42]), [value("i32", 42)]);

// ./test/core/call.wast:380
assert_invalid(
  () => instantiate(`(module
    (func $$type-void-vs-num (i32.eqz (call 1)))
    (func)
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:387
assert_invalid(
  () => instantiate(`(module
    (func $$type-num-vs-num (i32.eqz (call 1)))
    (func (result i64) (i64.const 1))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:395
assert_invalid(
  () => instantiate(`(module
    (func $$arity-0-vs-1 (call 1))
    (func (param i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:402
assert_invalid(
  () => instantiate(`(module
    (func $$arity-0-vs-2 (call 1))
    (func (param f64 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:409
assert_invalid(
  () => instantiate(`(module
    (func $$arity-1-vs-0 (call 1 (i32.const 1)))
    (func)
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:416
assert_invalid(
  () => instantiate(`(module
    (func $$arity-2-vs-0 (call 1 (f64.const 2) (i32.const 1)))
    (func)
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:424
assert_invalid(
  () => instantiate(`(module
    (func $$type-first-void-vs-num (call 1 (nop) (i32.const 1)))
    (func (param i32 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:431
assert_invalid(
  () => instantiate(`(module
    (func $$type-second-void-vs-num (call 1 (i32.const 1) (nop)))
    (func (param i32 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:438
assert_invalid(
  () => instantiate(`(module
    (func $$type-first-num-vs-num (call 1 (f64.const 1) (i32.const 1)))
    (func (param i32 f64))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:445
assert_invalid(
  () => instantiate(`(module
    (func $$type-second-num-vs-num (call 1 (i32.const 1) (f64.const 1)))
    (func (param f64 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:453
assert_invalid(
  () => instantiate(`(module
    (func $$type-first-empty-in-block
      (block (call 1))
    )
    (func (param i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:462
assert_invalid(
  () => instantiate(`(module
    (func $$type-second-empty-in-block
      (block (call 1 (i32.const 0)))
    )
    (func (param i32 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:471
assert_invalid(
  () => instantiate(`(module
    (func $$type-first-empty-in-loop
      (loop (call 1))
    )
    (func (param i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:480
assert_invalid(
  () => instantiate(`(module
    (func $$type-second-empty-in-loop
      (loop (call 1 (i32.const 0)))
    )
    (func (param i32 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:489
assert_invalid(
  () => instantiate(`(module
    (func $$type-first-empty-in-then
      (if (i32.const 0) (then (call 1)))
    )
    (func (param i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:498
assert_invalid(
  () => instantiate(`(module
    (func $$type-second-empty-in-then
      (if (i32.const 0) (then (call 1 (i32.const 0))))
    )
    (func (param i32 i32))
  )`),
  `type mismatch`,
);

// ./test/core/call.wast:511
assert_invalid(
  () => instantiate(`(module (func $$unbound-func (call 1)))`),
  `unknown function`,
);

// ./test/core/call.wast:515
assert_invalid(
  () => instantiate(`(module (func $$large-func (call 1012321300)))`),
  `unknown function`,
);