summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/memory.js
blob: 648a5c125d7de6bd84e513442310b03004fd4e43 (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
const RuntimeError = WebAssembly.RuntimeError;

function loadModuleSrc(type, ext, offset, align, drop = false) {
    let maybeResult = drop ? '' : `(result ${type})`;
    let maybeDrop = drop ? 'drop' : '';
    return `(module
       (memory 1)
       (data (i32.const 0) "\\00\\01\\02\\03\\04\\05\\06\\07\\08\\09\\0a\\0b\\0c\\0d\\0e\\0f")
       (data (i32.const 16) "\\f0\\f1\\f2\\f3\\f4\\f5\\f6\\f7\\f8\\f9\\fa\\fb\\fc\\fd\\fe\\ff")
       (func $load (param i32) ${maybeResult}
         (${type}.load${ext}
          offset=${offset}
          ${align != 0 ? 'align=' + align : ''}
          (local.get 0)
         )
         ${maybeDrop}
       ) (export "" (func 0)))`;
}
function loadModule(type, ext, offset, align, drop = false) {
    return wasmEvalText(loadModuleSrc(type, ext, offset, align, drop)).exports[""];
}

function storeModuleSrc(type, ext, offset, align) {
    var load_ext = ext === '' ? '' : ext + '_s';
    return `(module
       (memory 1)
       (data (i32.const 0) "\\00\\01\\02\\03\\04\\05\\06\\07\\08\\09\\0a\\0b\\0c\\0d\\0e\\0f")
       (data (i32.const 16) "\\f0\\f1\\f2\\f3\\f4\\f5\\f6\\f7\\f8\\f9\\fa\\fb\\fc\\fd\\fe\\ff")
       (func $store (param i32) (param ${type})
         (${type}.store${ext}
          offset=${offset}
          ${align != 0 ? 'align=' + align : ''}
          (local.get 0)
          (local.get 1)
         )
       ) (export "store" (func 0))
       (func $load (param i32) (result ${type})
        (${type}.load${load_ext}
         offset=${offset}
         ${align != 0 ? 'align=' + align : ''}
         (local.get 0)
        )
       ) (export "load" (func 1)))`;
}
function storeModule(type, ext, offset, align) {
    return wasmEvalText(storeModuleSrc(type, ext, offset, align)).exports;
}

function storeModuleCstSrc(type, ext, offset, align, value) {
    var load_ext = ext === '' ? '' : ext + '_s';
    return `(module
       (memory 1)
       (data (i32.const 0) "\\00\\01\\02\\03\\04\\05\\06\\07\\08\\09\\0a\\0b\\0c\\0d\\0e\\0f")
       (data (i32.const 16) "\\f0\\f1\\f2\\f3\\f4\\f5\\f6\\f7\\f8\\f9\\fa\\fb\\fc\\fd\\fe\\ff")
       (func $store (param i32)
         (${type}.store${ext}
          offset=${offset}
          ${align != 0 ? 'align=' + align : ''}
          (local.get 0)
          (${type}.const ${value})
         )
       ) (export "store" (func 0))
       (func $load (param i32) (result ${type})
        (${type}.load${load_ext}
         offset=${offset}
         ${align != 0 ? 'align=' + align : ''}
         (local.get 0)
        )
       ) (export "load" (func 1)))`;
}
function storeModuleCst(type, ext, offset, align, value) {
    return wasmEvalText(storeModuleCstSrc(type, ext, offset, align, value)).exports;
}

function testLoad(type, ext, base, offset, align, expect) {
    if (type === 'i64') {
        wasmAssert(loadModuleSrc(type, ext, offset, align), [{
            type,
            func: '$load',
            expected: expect,
            args: [`i32.const ${base}`]
        }]);
    }
    else {
        assertEq(loadModule(type, ext, offset, align)(base), expect);
    }
}

function testLoadOOB(type, ext, base, offset, align) {
    assertErrorMessage(() => loadModule(type, ext, offset, align, /*drop*/ true)(base), RuntimeError, /index out of bounds/);
}

function testStore(type, ext, base, offset, align, value) {
    if (type === 'i64') {
        wasmAssert(storeModuleSrc(type, ext, offset, align), [
            {type, func: '$store', args: [`i32.const ${base}`, `i64.const ${value}`]},
            {type, func: '$load', args: [`i32.const ${base}`], expected: value},
        ]);
        wasmAssert(storeModuleCstSrc(type, ext, offset, align, value), [
            {type, func: '$store', args: [`i32.const ${base}`]},
            {type, func: '$load', args: [`i32.const ${base}`], expected: value},
        ]);
    } else {
        let module = storeModule(type, ext, offset, align);
        let moduleCst = storeModuleCst(type, ext, offset, align, value);
        module.store(base, value);
        assertEq(module.load(base), value);
        moduleCst.store(base);
        assertEq(moduleCst.load(base), value);
    }
}

function testStoreOOB(type, ext, base, offset, align, value) {
    if (type === 'i64') {
        assertErrorMessage(() => wasmAssert(
            storeModuleSrc(type, ext, offset, align),
            [{type, func: '$store', args: [`i32.const ${base}`, `i64.const ${value}`]}]
        ), RuntimeError, /index out of bounds/);
    } else {
        assertErrorMessage(() => storeModule(type, ext, offset, align).store(base, value), RuntimeError, /index out of bounds/);
    }
}

function badLoadModule(type, ext) {
    wasmFailValidateText( `(module (func (param i32) (${type}.load${ext} (local.get 0))) (export "" (func 0)))`, /memory index/);
}

function badStoreModule(type, ext) {
    wasmFailValidateText(`(module (func (param i32) (${type}.store${ext} (local.get 0) (${type}.const 0))) (export "" (func 0)))`, /memory index/);
}

// Can't touch memory.
for (let [type, ext] of [
    ['i32', ''],
    ['i32', '8_s'],
    ['i32', '8_u'],
    ['i32', '16_s'],
    ['i32', '16_u'],
    ['i64', ''],
    ['i64', '8_s'],
    ['i64', '8_u'],
    ['i64', '16_s'],
    ['i64', '16_u'],
    ['i64', '32_s'],
    ['i64', '32_u'],
    ['f32', ''],
    ['f64', ''],
])
{
    badLoadModule(type, ext);
}

for (let [type, ext] of [
    ['i32', ''],
    ['i32', '8'],
    ['i32', '16'],
    ['i64', ''],
    ['i64', '8'],
    ['i64', '16'],
    ['i64', '32'],
    ['f32', ''],
    ['f64', ''],
])
{
    badStoreModule(type, ext);
}

assertEq(getJitCompilerOptions()['wasm.fold-offsets'], 1);

for (var foldOffsets = 0; foldOffsets <= 1; foldOffsets++) {
    setJitCompilerOption('wasm.fold-offsets', foldOffsets | 0);

    testLoad('i32', '', 0, 0, 0, 0x03020100);
    testLoad('i32', '', 1, 0, 1, 0x04030201);
    testLoad('i32', '', 0, 4, 0, 0x07060504);
    testLoad('i32', '', 1, 3, 4, 0x07060504);
    testLoad('f32', '', 0, 0, 0, 3.820471434542632e-37);
    testLoad('f32', '', 1, 0, 1, 1.539989614439558e-36);
    testLoad('f32', '', 0, 4, 0, 1.0082513512365273e-34);
    testLoad('f32', '', 1, 3, 4, 1.0082513512365273e-34);
    testLoad('f64', '', 0, 0, 0, 7.949928895127363e-275);
    testLoad('f64', '', 1, 0, 1, 5.447603722011605e-270);
    testLoad('f64', '', 0, 8, 0, 3.6919162048650923e-236);
    testLoad('f64', '', 1, 7, 8, 3.6919162048650923e-236);

    testLoad('i32', '8_s', 16, 0, 0, -0x10);
    testLoad('i32', '8_u', 16, 0, 0, 0xf0);
    testLoad('i32', '16_s', 16, 0, 0, -0xe10);
    testLoad('i32', '16_u', 16, 0, 0, 0xf1f0);

    testStore('i32', '', 0, 0, 0, -0x3f3e2c2c);
    testStore('i32', '', 1, 0, 1, -0x3f3e2c2c);
    testStore('i32', '', 0, 1, 1, -0x3f3e2c2c);
    testStore('i32', '', 1, 1, 4, -0x3f3e2c2c);

    testStore('f32', '', 0, 0, 0, 0.01234566979110241);
    testStore('f32', '', 1, 0, 1, 0.01234566979110241);
    testStore('f32', '', 0, 4, 0, 0.01234566979110241);
    testStore('f32', '', 1, 3, 4, 0.01234566979110241);
    testStore('f64', '', 0, 0, 0, 0.89012345);
    testStore('f64', '', 1, 0, 1, 0.89012345);
    testStore('f64', '', 0, 8, 0, 0.89012345);
    testStore('f64', '', 1, 7, 8, 0.89012345);

    testStore('i32', '8', 0, 0, 0, 0x23);
    testStore('i32', '16', 0, 0, 0, 0x2345);

    wasmFailValidateText('(module (memory 2 1))', /maximum length 1 is less than initial length 2/);

    // Test bounds checks and edge cases.

    for (let align of [0,1,2,4]) {

        for (let offset of [0, 1, 2, 3, 4, 8, 16, 41, 0xfff8]) {
            // Accesses of 1 byte.
            let lastValidIndex = 0x10000 - 1 - offset;

            if (align < 2) {
                testLoad('i32', '8_s', lastValidIndex, offset, align, 0);
                testLoadOOB('i32', '8_s', lastValidIndex + 1, offset, align);

                testLoad('i32', '8_u', lastValidIndex, offset, align, 0);
                testLoadOOB('i32', '8_u', lastValidIndex + 1, offset, align);

                testStore('i32', '8', lastValidIndex, offset, align, -42);
                testStoreOOB('i32', '8', lastValidIndex + 1, offset, align, -42);
            }

            // Accesses of 2 bytes.
            lastValidIndex = 0x10000 - 2 - offset;

            if (align < 4) {
                testLoad('i32', '16_s', lastValidIndex, offset, align, 0);
                testLoadOOB('i32', '16_s', lastValidIndex + 1, offset, align);

                testLoad('i32', '16_u', lastValidIndex, offset, align, 0);
                testLoadOOB('i32', '16_u', lastValidIndex + 1, offset, align);

                testStore('i32', '16', lastValidIndex, offset, align, -32768);
                testStoreOOB('i32', '16', lastValidIndex + 1, offset, align, -32768);
            }

            // Accesses of 4 bytes.
            lastValidIndex = 0x10000 - 4 - offset;

            testLoad('i32', '', lastValidIndex, offset, align, 0);
            testLoadOOB('i32', '', lastValidIndex + 1, offset, align);

            testLoad('f32', '', lastValidIndex, offset, align, 0);
            testLoadOOB('f32', '', lastValidIndex + 1, offset, align);

            testStore('i32', '', lastValidIndex, offset, align, 1337);
            testStoreOOB('i32', '', lastValidIndex + 1, offset, align, 1337);

            testStore('f32', '', lastValidIndex, offset, align, Math.fround(13.37));
            testStoreOOB('f32', '', lastValidIndex + 1, offset, align, Math.fround(13.37));

            // Accesses of 8 bytes.
            lastValidIndex = 0x10000 - 8 - offset;

            testLoad('f64', '', lastValidIndex, offset, align, 0);
            testLoadOOB('f64', '', lastValidIndex + 1, offset, align);

            testStore('f64', '', lastValidIndex, offset, align, 1.23456789);
            testStoreOOB('f64', '', lastValidIndex + 1, offset, align, 1.23456789);
        }

        // Ensure wrapping doesn't apply.
        offset = 0x7fffffff;
        for (let index of [0, 1, 2, 3, 0x7fffffff, 0x80000000, 0x80000001]) {
            if (align < 2) {
                testLoadOOB('i32', '8_s', index, offset, align);
            }
            if (align < 4) {
                testLoadOOB('i32', '16_s', index, offset, align);
            }
            testLoadOOB('i32', '', index, offset, align);
            testLoadOOB('f32', '', index, offset, align);
            testLoadOOB('f64', '', index, offset, align);
        }

        // Ensure out of bounds when the offset is greater than the immediate range.
        index = 0;
        for (let offset of [0x80000000, 0xfffffffe, 0xffffffff]) {
            testLoadOOB('i32', '8_s', index, offset, 1);
            testLoadOOB('i32', '16_s', index, offset, 1);
            testLoadOOB('i32', '16_s', index, offset, 2);
            testLoadOOB('i32', '', index, offset, 1);
            testLoadOOB('i32', '', index, offset, 4);
            testLoadOOB('f32', '', index, offset, 1);
            testLoadOOB('f32', '', index, offset, 4);
            testLoadOOB('f64', '', index, offset, 1);
            testLoadOOB('f64', '', index, offset, 8);
        }

        wasmFailValidateText('(module (memory 1) (func (f64.store offset=0 (i32.const 0) (i32.const 0))))', mismatchError("i32", "f64"));
        wasmFailValidateText('(module (memory 1) (func (f64.store offset=0 (i32.const 0) (f32.const 0))))', mismatchError("f32", "f64"));

        wasmFailValidateText('(module (memory 1) (func (f32.store offset=0 (i32.const 0) (i32.const 0))))', mismatchError("i32", "f32"));
        wasmFailValidateText('(module (memory 1) (func (f32.store offset=0 (i32.const 0) (f64.const 0))))', mismatchError("f64", "f32"));

        wasmFailValidateText('(module (memory 1) (func (i32.store offset=0 (i32.const 0) (f32.const 0))))', mismatchError("f32", "i32"));
        wasmFailValidateText('(module (memory 1) (func (i32.store offset=0 (i32.const 0) (f64.const 0))))', mismatchError("f64", "i32"));

        // Test high number of registers.
        function testRegisters() {
            assertEq(wasmEvalText(
                `(module
              (memory 1)
              (data (i32.const 0) "\\00\\01\\02\\03\\04\\05\\06\\07\\08\\09\\0a\\0b\\0c\\0d\\0e\\0f")
              (data (i32.const 16) "\\f0\\f1\\f2\\f3\\f4\\f5\\f6\\f7\\f8\\f9\\fa\\fb\\fc\\fd\\fe\\ff")
              (func (param i32) (result i32) (local i32 i32 i32 i32 f32 f64)
               (local.set 1 (i32.load8_s offset=4 (local.get 0)))
               (local.set 2 (i32.load16_s (local.get 1)))
               (i32.store8 offset=4 (local.get 0) (local.get 1))
               (local.set 3 (i32.load16_u (local.get 2)))
               (i32.store16 (local.get 1) (local.get 2))
               (local.set 4 (i32.load (local.get 2)))
               (i32.store (local.get 1) (local.get 2))
               (local.set 5 (f32.load (local.get 4)))
               (f32.store (local.get 4) (local.get 5))
               (local.set 6 (f64.load (local.get 4)))
               (f64.store (local.get 4) (local.get 6))
               (i32.add
                (i32.add
                 (local.get 0)
                 (local.get 1)
                )
                (i32.add
                 (i32.add
                  (local.get 2)
                  (local.get 3)
                 )
                 (i32.add
                  (local.get 4)
                  (i32.reinterpret_f32 (local.get 5))
                 )
                )
               )
              ) (export "" (func 0)))`
            ).exports[""](1), 50464523);
        }

        testRegisters();

        testLoad('i64', '', 0, 0, 0, '0x0706050403020100');
        testLoad('i64', '', 1, 0, 0, '0x0807060504030201');
        testLoad('i64', '', 0, 1, 0, '0x0807060504030201');
        testLoad('i64', '', 1, 1, 4, '0x0908070605040302');

        testLoad('i64', '8_s', 16, 0, 0, -0x10);
        testLoad('i64', '8_u', 16, 0, 0, 0xf0);
        testLoad('i64', '16_s', 16, 0, 0, -0xe10);
        testLoad('i64', '16_u', 16, 0, 0, 0xf1f0);
        testLoad('i64', '32_s', 16, 0, 0, 0xf3f2f1f0 | 0);
        testLoad('i64', '32_u', 16, 0, 0, '0xf3f2f1f0');

        testStore('i64', '', 0, 0, 0, '0xc0c1d3d4e6e7090a');
        testStore('i64', '', 1, 0, 0, '0xc0c1d3d4e6e7090a');
        testStore('i64', '', 0, 1, 0, '0xc0c1d3d4e6e7090a');
        testStore('i64', '', 1, 1, 4, '0xc0c1d3d4e6e7090a');
        testStore('i64', '8', 0, 0, 0, 0x23);
        testStore('i64', '16', 0, 0, 0, 0x23);
        testStore('i64', '32', 0, 0, 0, 0x23);

        for (let offset of [0, 1, 2, 3, 4, 8, 16, 41, 0xfff8]) {
            // Accesses of 1 byte.
            let lastValidIndex = 0x10000 - 1 - offset;

            if (align < 2) {
                testLoad('i64', '8_s', lastValidIndex, offset, align, 0);
                testLoadOOB('i64', '8_s', lastValidIndex + 1, offset, align);

                testLoad('i64', '8_u', lastValidIndex, offset, align, 0);
                testLoadOOB('i64', '8_u', lastValidIndex + 1, offset, align);

                testStore('i64', '8', lastValidIndex, offset, align, -42);
                testStoreOOB('i64', '8', lastValidIndex + 1, offset, align, -42);
            }

            // Accesses of 2 bytes.
            lastValidIndex = 0x10000 - 2 - offset;

            if (align < 4) {
                testLoad('i64', '16_s', lastValidIndex, offset, align, 0);
                testLoadOOB('i64', '16_s', lastValidIndex + 1, offset, align);

                testLoad('i64', '16_u', lastValidIndex, offset, align, 0);
                testLoadOOB('i64', '16_u', lastValidIndex + 1, offset, align);

                testStore('i64', '16', lastValidIndex, offset, align, -32768);
                testStoreOOB('i64', '16', lastValidIndex + 1, offset, align, -32768);
            }

            // Accesses of 4 bytes.
            lastValidIndex = 0x10000 - 4 - offset;

            testLoad('i64', '32_s', lastValidIndex, offset, align, 0);
            testLoadOOB('i64', '32_s', lastValidIndex + 1, offset, align);

            testLoad('i64', '32_u', lastValidIndex, offset, align, 0);
            testLoadOOB('i64', '32_u', lastValidIndex + 1, offset, align);

            testStore('i64', '32', lastValidIndex, offset, align, 0xf1231337 | 0);
            testStoreOOB('i64', '32', lastValidIndex + 1, offset, align, 0xf1231337 | 0);

            // Accesses of 8 bytes.
            lastValidIndex = 0x10000 - 8 - offset;

            testLoad('i64', '', lastValidIndex, offset, align, 0);
            testLoadOOB('i64', '', lastValidIndex + 1, offset, align);

            testStore('i64', '', lastValidIndex, offset, align, '0x1234567887654321');
            testStoreOOB('i64', '', lastValidIndex + 1, offset, align, '0x1234567887654321');
        }
    }
}

setJitCompilerOption('wasm.fold-offsets', 1);

// Test active segments with a memory index.

{
    function makeIt(flag, memindex) {
        return new Uint8Array([0x00, 0x61, 0x73, 0x6d,
                               0x01, 0x00, 0x00, 0x00,
                               0x05,                   // Memory section
                               0x03,                   // Section size
                               0x01,                   // One memory
                               0x00,                   // Unshared, min only
                               0x01,                   // Min
                               0x0b,                   // Data section
                               0x0a,                   // Section size
                               0x01,                   // One data segment
                               flag,                   // Flag should be 2, or > 2 if invalid
                               memindex,               // Memory index should be 0, or > 0 if invalid
                               0x41,                   // Init expr: i32.const
                               0x00,                   // Init expr: zero (payload)
                               0x0b,                   // Init expr: end
                               0x03,                   // Three bytes, because why not?
                               0x01,
                               0x02,
                               0x03]);
    }

    // Should succeed because this is what an active segment with index looks like
    new WebAssembly.Module(makeIt(0x02, 0x00));

    // Should fail because the kind is unknown
    assertErrorMessage(() => new WebAssembly.Module(makeIt(0x03, 0x00)),
                       WebAssembly.CompileError,
                       /invalid data initializer-kind/);

    // Should fail because the memory index is bad
    assertErrorMessage(() => new WebAssembly.Module(makeIt(0x02, 0x01)),
                       WebAssembly.CompileError,
                       /invalid memory index/);
}

// Misc syntax for data.

// When memory index is present it must be zero, and the offset must be present too;
// but it's OK for there to be neither
new WebAssembly.Module(wasmTextToBinary(`(module (memory 1) (data 0 (i32.const 0) ""))`));
new WebAssembly.Module(wasmTextToBinary(`(module (memory 1) (data 0 (offset (i32.const 0)) ""))`));
new WebAssembly.Module(wasmTextToBinary(`(module (memory 1) (data ""))`));
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`(module (memory 1) (data 0 ""))`)),
                   SyntaxError,
                   /wasm text error/);
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`(module (memory 1) (data 1 (i32.const 0) ""))`)),
                   WebAssembly.CompileError,
                   /invalid memory index/);


// Make sure we handle memory instructions without memory

var nomem = /memory index out of range/;

assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`(module (func (result i32) memory.size))`)),
                   WebAssembly.CompileError,
                   nomem);

assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`(module (func (result i32) (memory.grow (i32.const 1))))`)),
                   WebAssembly.CompileError,
                   nomem);

assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`
(module (func (param i32 i32 i32)
  (memory.copy (local.get 0) (local.get 1) (local.get 2))))`)),
                   WebAssembly.CompileError,
                   nomem);

assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`
(module (func (param i32 i32 i32)
  (memory.fill (local.get 0) (local.get 1) (local.get 2))))`)),
                   WebAssembly.CompileError,
                   nomem);

assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(`
(module
  (data $d "01234")
  (func (param i32 i32)
    (memory.init $d (local.get 0) (local.get 1))))`)),
                   WebAssembly.CompileError,
                   nomem);