Bug 1814421: Prepare wasm extended-const for ship. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D169247
This commit is contained in:
@@ -98,13 +98,13 @@
|
||||
|
||||
// clang-format off
|
||||
#define JS_FOR_WASM_FEATURES(DEFAULT, TENTATIVE, EXPERIMENTAL) \
|
||||
EXPERIMENTAL(/* capitalized name */ ExtendedConst, \
|
||||
/* lower case name */ extendedConst, \
|
||||
/* compile predicate */ WASM_EXTENDED_CONST_ENABLED, \
|
||||
/* compiler predicate */ true, \
|
||||
/* flag predicate */ true, \
|
||||
/* shell flag */ "extended-const", \
|
||||
/* preference name */ "extended_const") \
|
||||
TENTATIVE(/* capitalized name */ ExtendedConst, \
|
||||
/* lower case name */ extendedConst, \
|
||||
/* compile predicate */ WASM_EXTENDED_CONST_ENABLED, \
|
||||
/* compiler predicate */ true, \
|
||||
/* flag predicate */ true, \
|
||||
/* shell flag */ "extended-const", \
|
||||
/* preference name */ "extended_const") \
|
||||
TENTATIVE( \
|
||||
/* capitalized name */ Exceptions, \
|
||||
/* lower case name */ exceptions, \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[[repos]]
|
||||
name = 'spec'
|
||||
commit = 'ffb5e3b4'
|
||||
commit = 'b1fbe1a8'
|
||||
|
||||
[[repos]]
|
||||
name = 'threads'
|
||||
@@ -25,3 +25,7 @@ commit = 'c4eef9a8'
|
||||
[[repos]]
|
||||
name = 'relaxed-simd'
|
||||
commit = '0018aeb4'
|
||||
|
||||
[[repos]]
|
||||
name = 'extended-const'
|
||||
commit = 'dd72ab96'
|
||||
|
||||
@@ -27,6 +27,8 @@ excluded_tests = [
|
||||
"table.wast",
|
||||
# fails after a bottom-type has been added to validation
|
||||
"unreached-invalid.wast",
|
||||
# argument is not wasm value
|
||||
"select.wast",
|
||||
]
|
||||
|
||||
[[repos]]
|
||||
@@ -85,14 +87,14 @@ excluded_tests = [
|
||||
"ref_is_null.wast",
|
||||
# cannot expose indexed reference type
|
||||
"ref_null.wast",
|
||||
# argument is not wasm value
|
||||
"select.wast",
|
||||
# parameter subtyping
|
||||
"type-equivalence.wast",
|
||||
# NYI WasmValType.h:259
|
||||
"table-sub.wast",
|
||||
# unrelated
|
||||
"tokens.wast",
|
||||
# irrelevant
|
||||
"simd_lane.wast",
|
||||
]
|
||||
|
||||
[[repos]]
|
||||
@@ -107,3 +109,11 @@ excluded_tests = [
|
||||
# Different results
|
||||
"i32x4_relaxed_trunc.wast",
|
||||
]
|
||||
|
||||
[[repos]]
|
||||
name = "extended-const"
|
||||
url = "https://github.com/WebAssembly/extended-const"
|
||||
branch = "main"
|
||||
parent = "spec"
|
||||
directive = "; --wasm-extended-const; skip-if: !wasmExtendedConstEnabled()"
|
||||
excluded_tests = []
|
||||
|
||||
@@ -45,8 +45,8 @@ testI32('i32.const 1', 1);
|
||||
testI32('i32.const 1 i32.const 2 i32.add', 3);
|
||||
testI32(`i32.const ${MAX_I32} i32.const 1 i32.add`, 0);
|
||||
|
||||
testI32('i32.const 1 i32.const 2 i32.sub', 1);
|
||||
testI32(`i32.const 1 i32.const 0 i32.sub`, -1);
|
||||
testI32('i32.const 1 i32.const 2 i32.sub', -1);
|
||||
testI32(`i32.const 1 i32.const 0 i32.sub`, 1);
|
||||
|
||||
testI32('i32.const 1 i32.const 2 i32.mul', 2);
|
||||
testI32(`i32.const ${I32_SQ_OVERFLOW} i32.const ${I32_SQ_OVERFLOW} i32.mul`, 0);
|
||||
@@ -65,8 +65,8 @@ testI64('i64.const 1', 1n);
|
||||
testI64('i64.const 1 i64.const 2 i64.add', 3n);
|
||||
testI64(`i64.const ${MAX_I64} i64.const 1 i64.add`, 0n);
|
||||
|
||||
testI64('i64.const 1 i64.const 2 i64.sub', 1n);
|
||||
testI64(`i64.const 1 i64.const 0 i64.sub`, -1n);
|
||||
testI64('i64.const 1 i64.const 2 i64.sub', -1n);
|
||||
testI64(`i64.const 1 i64.const 0 i64.sub`, 1n);
|
||||
|
||||
testI64('i64.const 1 i64.const 2 i64.mul', 2n);
|
||||
testI64(`i64.const ${I64_SQ_OVERFLOW} i64.const ${I64_SQ_OVERFLOW} i64.mul`, 0n);
|
||||
@@ -87,9 +87,9 @@ function testGlobalGet(valtype, aExpr, bExpr, cExpr, cResult) {
|
||||
}
|
||||
|
||||
testGlobalGet('i32', 'i32.const 2', 'i32.const 3', 'global.get $a global.get $b i32.add', 5);
|
||||
testGlobalGet('i32', 'i32.const 2', 'i32.const 3', 'global.get $a global.get $b i32.sub', 1);
|
||||
testGlobalGet('i32', 'i32.const 2', 'i32.const 3', 'global.get $a global.get $b i32.sub', -1);
|
||||
testGlobalGet('i32', 'i32.const 2', 'i32.const 3', 'global.get $a global.get $b i32.mul', 6);
|
||||
|
||||
testGlobalGet('i64', 'i64.const 2', 'i64.const 3', 'global.get $a global.get $b i64.add', 5n);
|
||||
testGlobalGet('i64', 'i64.const 2', 'i64.const 3', 'global.get $a global.get $b i64.sub', 1n);
|
||||
testGlobalGet('i64', 'i64.const 2', 'i64.const 3', 'global.get $a global.get $b i64.sub', -1n);
|
||||
testGlobalGet('i64', 'i64.const 2', 'i64.const 3', 'global.get $a global.get $b i64.mul', 6n);
|
||||
|
||||
78
js/src/jit-test/tests/wasm/extended-const/pathological.js
Normal file
78
js/src/jit-test/tests/wasm/extended-const/pathological.js
Normal file
@@ -0,0 +1,78 @@
|
||||
// |jit-test| skip-if: !wasmExtendedConstEnabled()
|
||||
|
||||
// Let's calculate zero in some elaborate ways.
|
||||
function testFancyZeroOffset(fancyZero, memType = 'i32') {
|
||||
try {
|
||||
const { mem } = wasmEvalText(`(module
|
||||
(memory (export "mem") ${memType} 1)
|
||||
(data (offset ${fancyZero}) "hi")
|
||||
)`).exports;
|
||||
const str = String.fromCharCode(...new Uint8Array(mem.buffer).slice(0, 2));
|
||||
assertEq(str, 'hi');
|
||||
} catch (e) {
|
||||
const { getOffset } = wasmEvalText(`(module
|
||||
(func (export "getOffset") (result ${memType})
|
||||
${fancyZero}
|
||||
)
|
||||
)`).exports;
|
||||
console.log('Computed offset:', getOffset());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Do plus one minus one a thousand times
|
||||
testFancyZeroOffset('i32.const 0 ' + (
|
||||
'(i32.add (i32.const 1)) '
|
||||
+ '(i32.sub (i32.const 1)) '
|
||||
).repeat(1000));
|
||||
|
||||
// Do some jank fibonacci
|
||||
{
|
||||
let fib = '(i32.const 1)\n'
|
||||
let a = 1; let b = 1; let next;
|
||||
for (let i = 0; i < 45; i++) {
|
||||
fib += `(i32.const ${a})\n`;
|
||||
fib += '(i32.add)\n';
|
||||
next = a + b;
|
||||
a = b;
|
||||
b = next;
|
||||
}
|
||||
fib += `(i32.sub (i32.const ${next}))\n`;
|
||||
testFancyZeroOffset(fib);
|
||||
}
|
||||
|
||||
// Run the collatz conjecture as long as possible
|
||||
{
|
||||
let val = 837799; // should reach 1 in 524 steps
|
||||
let expr = `(i32.const ${val})\n`;
|
||||
while (val != 1) {
|
||||
if (val % 2 == 0) {
|
||||
expr += `(i32.sub (i32.const ${val / 2}))\n`; // we can't divide in constant expressions lol
|
||||
val /= 2;
|
||||
} else {
|
||||
expr += `(i32.mul (i32.const 3))\n`;
|
||||
expr += `(i32.add (i32.const 1))\n`;
|
||||
val = val * 3 + 1;
|
||||
}
|
||||
}
|
||||
expr += `(i32.sub (i32.const 1))\n`;
|
||||
testFancyZeroOffset(expr);
|
||||
}
|
||||
|
||||
// The collatz conjecture would be even more fun with 64-bit numbers...
|
||||
if (wasmMemory64Enabled()) {
|
||||
let val = 1899148184679; // should reach 1 in 1411 steps
|
||||
let expr = `(i64.const ${val})\n`;
|
||||
while (val != 1) {
|
||||
if (val % 2 == 0) {
|
||||
expr += `(i64.sub (i64.const ${val / 2}))\n`; // we can't divide in constant expressions lol
|
||||
val /= 2;
|
||||
} else {
|
||||
expr += `(i64.mul (i64.const 3))\n`;
|
||||
expr += `(i64.add (i64.const 1))\n`;
|
||||
val = val * 3 + 1;
|
||||
}
|
||||
}
|
||||
expr += `(i64.sub (i64.const 1))\n`;
|
||||
testFancyZeroOffset(expr, 'i64');
|
||||
}
|
||||
@@ -24,17 +24,6 @@ let { release_or_beta } = getBuildConfiguration();
|
||||
let nightly = !release_or_beta;
|
||||
|
||||
let nightlyOnlyFeatures = [
|
||||
[
|
||||
'extended-const',
|
||||
wasmExtendedConstEnabled(),
|
||||
`(module
|
||||
(global i32
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.add
|
||||
)
|
||||
)`
|
||||
],
|
||||
[
|
||||
'function-references',
|
||||
wasmFunctionReferencesEnabled(),
|
||||
@@ -83,6 +72,17 @@ let releasedFeatures = [
|
||||
wasmExceptionsEnabled(),
|
||||
`(module (type (func)) (tag (type 0)))`
|
||||
],
|
||||
[
|
||||
'extended-const',
|
||||
wasmExtendedConstEnabled(),
|
||||
`(module
|
||||
(global i32
|
||||
i32.const 0
|
||||
i32.const 0
|
||||
i32.add
|
||||
)
|
||||
)`
|
||||
],
|
||||
];
|
||||
|
||||
for (let [name, enabled, test] of releasedFeatures) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// |jit-test| test-also=--wasm-extended-const; test-also=--no-wasm-extended-const
|
||||
|
||||
const { Instance, Module, LinkError } = WebAssembly;
|
||||
|
||||
// Locally-defined globals
|
||||
@@ -9,7 +11,6 @@ assertErrorMessage(() => wasmEvalText(`(module (global (mut i32)))`), WebAssembl
|
||||
// Initializer expressions.
|
||||
wasmFailValidateText(`(module (global i32 (f32.const 13.37)))`, /type mismatch/);
|
||||
wasmFailValidateText(`(module (global f64 (f32.const 13.37)))`, /type mismatch/);
|
||||
wasmFailValidateText(`(module (global i32 (i32.add (i32.const 13) (i32.const 37))))`, /unrecognized opcode/);
|
||||
|
||||
wasmFailValidateText(`(module (global i32 (global.get 0)))`, /out of range/);
|
||||
wasmFailValidateText(`(module (global i32 (global.get 1)) (global i32 (i32.const 1)))`, /out of range/);
|
||||
@@ -43,6 +44,70 @@ testInner('i32', 13, 37, x => x|0);
|
||||
testInner('f32', 13.37, 0.1989, Math.fround);
|
||||
testInner('f64', 13.37, 0.1989, x => +x);
|
||||
|
||||
// Extended const stuff
|
||||
if (wasmExtendedConstEnabled()) {
|
||||
// Basic global shenanigans
|
||||
{
|
||||
const module = wasmEvalText(`(module
|
||||
;; -2 * (5 - (-10 + 20)) = 10
|
||||
(global i32 (i32.mul (i32.const -2) (i32.sub (i32.const 5) (i32.add (i32.const -10) (i32.const 20)))))
|
||||
;; ((1 + 2) - (3 * 4)) = -9
|
||||
(global i64 (i64.sub (i64.add (i64.const 1) (i64.const 2)) (i64.mul (i64.const 3) (i64.const 4))))
|
||||
|
||||
(func (export "get0") (result i32) global.get 0)
|
||||
(func (export "get1") (result i64) global.get 1)
|
||||
)`).exports;
|
||||
|
||||
assertEq(module.get0(), 10);
|
||||
assertEq(module.get1(), -9n);
|
||||
}
|
||||
|
||||
// Example use of dynamic linking
|
||||
{
|
||||
// Make a memory for two dynamically-linked modules to share. Each module gets five pages.
|
||||
const mem = new WebAssembly.Memory({ initial: 15, maximum: 15 });
|
||||
|
||||
const mod1 = new WebAssembly.Module(wasmTextToBinary(`(module
|
||||
(memory (import "env" "memory") 15 15)
|
||||
(global $memBase (import "env" "__memory_base") i32)
|
||||
(data (offset (global.get $memBase)) "Hello from module 1.")
|
||||
(data (offset (i32.add (global.get $memBase) (i32.const 65536))) "Goodbye from module 1.")
|
||||
)`));
|
||||
const instance1 = new WebAssembly.Instance(mod1, {
|
||||
env: {
|
||||
memory: mem,
|
||||
__memory_base: 65536 * 5, // this module's memory starts at page 5
|
||||
},
|
||||
});
|
||||
|
||||
const mod2 = new WebAssembly.Module(wasmTextToBinary(`(module
|
||||
(memory (import "env" "memory") 15 15)
|
||||
(global $memBase (import "env" "__memory_base") i32)
|
||||
(data (offset (global.get $memBase)) "Hello from module 2.")
|
||||
(data (offset (i32.add (global.get $memBase) (i32.const 65536))) "Goodbye from module 2.")
|
||||
)`));
|
||||
const instance2 = new WebAssembly.Instance(mod2, {
|
||||
env: {
|
||||
memory: mem,
|
||||
__memory_base: 65536 * 10, // this module's memory starts at page 10
|
||||
},
|
||||
});
|
||||
|
||||
// All four strings should now be present in the memory.
|
||||
|
||||
function assertStringInMem(mem, str, addr) {
|
||||
const bytes = new Uint8Array(mem.buffer).slice(addr, addr + str.length);
|
||||
let memStr = String.fromCharCode(...bytes);
|
||||
assertEq(memStr, str);
|
||||
}
|
||||
|
||||
assertStringInMem(mem, "Hello from module 1.", 65536 * 5);
|
||||
assertStringInMem(mem, "Goodbye from module 1.", 65536 * 6);
|
||||
assertStringInMem(mem, "Hello from module 2.", 65536 * 10);
|
||||
assertStringInMem(mem, "Goodbye from module 2.", 65536 * 11);
|
||||
}
|
||||
}
|
||||
|
||||
// Semantic errors.
|
||||
wasmFailValidateText(`(module (global (mut i32) (i32.const 1337)) (func (global.set 1 (i32.const 0))))`, /(out of range)|(global index out of bounds)/);
|
||||
wasmFailValidateText(`(module (global i32 (i32.const 1337)) (func (global.set 0 (i32.const 0))))`, /(can't write an immutable global)|(global is immutable)/);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -110,7 +110,7 @@ assert_malformed(
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\26\\10" "a custom section" "this is the payload"
|
||||
)`),
|
||||
`length out of bounds`,
|
||||
`unexpected end`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:92
|
||||
@@ -0,0 +1,234 @@
|
||||
/* 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/table_fill.wast
|
||||
|
||||
// ./test/core/table_fill.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
|
||||
(func (export "fill") (param $$i i32) (param $$r externref) (param $$n i32)
|
||||
(table.fill $$t (local.get $$i) (local.get $$r) (local.get $$n))
|
||||
)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref)
|
||||
(table.get $$t (local.get $$i))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_fill.wast:13
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:14
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:15
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:16
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:17
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:19
|
||||
assert_return(() => invoke($0, `fill`, [2, externref(1), 3]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:20
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:21
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:22
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:23
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:24
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:26
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(2), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:27
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:28
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:29
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:30
|
||||
assert_return(() => invoke($0, `get`, [6]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:32
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(3), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:33
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:34
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:35
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:37
|
||||
assert_return(() => invoke($0, `fill`, [8, externref(4), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:38
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:39
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:40
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:42
|
||||
assert_return(() => invoke($0, `fill`, [9, null, 1]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:43
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:44
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:46
|
||||
assert_return(() => invoke($0, `fill`, [10, externref(5), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:47
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:49
|
||||
assert_trap(() => invoke($0, `fill`, [8, externref(6), 3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:53
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:54
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:55
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:57
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:62
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 10]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:70
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-value-length-empty-vs-i32-i32
|
||||
(table.fill $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:79
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32
|
||||
(table.fill $$t (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:88
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-value-empty-vs
|
||||
(table.fill $$t (i32.const 1) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:97
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-length-empty-vs-i32
|
||||
(table.fill $$t (i32.const 1) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:106
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-index-f32-vs-i32
|
||||
(table.fill $$t (f32.const 1) (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:115
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
(func $$type-value-vs-funcref (param $$r externref)
|
||||
(table.fill $$t (i32.const 1) (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:124
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-length-f32-vs-i32
|
||||
(table.fill $$t (i32.const 1) (ref.null extern) (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:134
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 1 funcref)
|
||||
(func $$type-value-externref-vs-funcref-multi (param $$r externref)
|
||||
(table.fill $$t2 (i32.const 0) (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:145
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-empty-vs-num (result i32)
|
||||
(table.fill $$t (i32.const 0) (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,126 @@
|
||||
/* 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/table_get.wast
|
||||
|
||||
// ./test/core/table_get.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t2 2 externref)
|
||||
(table $$t3 3 funcref)
|
||||
(elem (table $$t3) (i32.const 1) func $$dummy)
|
||||
(func $$dummy)
|
||||
|
||||
(func (export "init") (param $$r externref)
|
||||
(table.set $$t2 (i32.const 1) (local.get $$r))
|
||||
(table.set $$t3 (i32.const 2) (table.get $$t3 (i32.const 1)))
|
||||
)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
)
|
||||
|
||||
(func (export "is_null-funcref") (param $$i i32) (result i32)
|
||||
(ref.is_null (call $$f3 (local.get $$i)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_get.wast:24
|
||||
invoke($0, `init`, [externref(1)]);
|
||||
|
||||
// ./test/core/table_get.wast:26
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_get.wast:27
|
||||
assert_return(() => invoke($0, `get-externref`, [1]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_get.wast:29
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_get.wast:30
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_get.wast:31
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [2]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_get.wast:33
|
||||
assert_trap(() => invoke($0, `get-externref`, [2]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:34
|
||||
assert_trap(() => invoke($0, `get-funcref`, [3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:35
|
||||
assert_trap(() => invoke($0, `get-externref`, [-1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:36
|
||||
assert_trap(() => invoke($0, `get-funcref`, [-1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:41
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32 (result externref)
|
||||
(table.get $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:50
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-f32-vs-i32 (result externref)
|
||||
(table.get $$t (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:60
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-externref-vs-empty
|
||||
(table.get $$t (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:69
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-externref-vs-funcref (result funcref)
|
||||
(table.get $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:79
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 funcref)
|
||||
(table $$t2 1 externref)
|
||||
(func $$type-result-externref-vs-funcref-multi (result funcref)
|
||||
(table.get $$t2 (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,268 @@
|
||||
/* 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/table_grow.wast
|
||||
|
||||
// ./test/core/table_grow.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref) (table.get $$t (local.get $$i)))
|
||||
(func (export "set") (param $$i i32) (param $$r externref) (table.set $$t (local.get $$i) (local.get $$r)))
|
||||
|
||||
(func (export "grow") (param $$sz i32) (param $$init externref) (result i32)
|
||||
(table.grow $$t (local.get $$init) (local.get $$sz))
|
||||
)
|
||||
(func (export "size") (result i32) (table.size $$t))
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:13
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:14
|
||||
assert_trap(() => invoke($0, `set`, [0, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:15
|
||||
assert_trap(() => invoke($0, `get`, [0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:17
|
||||
assert_return(() => invoke($0, `grow`, [1, null]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:18
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:19
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:20
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:21
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:22
|
||||
assert_trap(() => invoke($0, `set`, [1, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:23
|
||||
assert_trap(() => invoke($0, `get`, [1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:25
|
||||
assert_return(() => invoke($0, `grow`, [4, externref(3)]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:26
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_grow.wast:27
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:28
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:29
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:30
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:31
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:32
|
||||
assert_return(() => invoke($0, `set`, [4, externref(4)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:33
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_grow.wast:34
|
||||
assert_trap(() => invoke($0, `set`, [5, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:35
|
||||
assert_trap(() => invoke($0, `get`, [5]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:39
|
||||
let $1 = instantiate(`(module
|
||||
(table $$t 0x10 funcref)
|
||||
(elem declare func $$f)
|
||||
(func $$f (export "grow") (result i32)
|
||||
(table.grow $$t (ref.func $$f) (i32.const 0xffff_fff0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:47
|
||||
assert_return(() => invoke($1, `grow`, []), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:50
|
||||
let $2 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null extern) (local.get 0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:57
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:58
|
||||
assert_return(() => invoke($2, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:59
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:60
|
||||
assert_return(() => invoke($2, `grow`, [2]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:61
|
||||
assert_return(() => invoke($2, `grow`, [800]), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_grow.wast:64
|
||||
let $3 = instantiate(`(module
|
||||
(table $$t 0 10 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null extern) (local.get 0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:71
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:72
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:73
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:74
|
||||
assert_return(() => invoke($3, `grow`, [2]), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_grow.wast:75
|
||||
assert_return(() => invoke($3, `grow`, [6]), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_grow.wast:76
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:77
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:78
|
||||
assert_return(() => invoke($3, `grow`, [65536]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:81
|
||||
let $4 = instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null func) (local.get 0))
|
||||
)
|
||||
(elem declare func 1)
|
||||
(func (export "check-table-null") (param i32 i32) (result funcref)
|
||||
(local funcref)
|
||||
(local.set 2 (ref.func 1))
|
||||
(block
|
||||
(loop
|
||||
(local.set 2 (table.get $$t (local.get 0)))
|
||||
(br_if 1 (i32.eqz (ref.is_null (local.get 2))))
|
||||
(br_if 1 (i32.ge_u (local.get 0) (local.get 1)))
|
||||
(local.set 0 (i32.add (local.get 0) (i32.const 1)))
|
||||
(br_if 0 (i32.le_u (local.get 0) (local.get 1)))
|
||||
)
|
||||
)
|
||||
(local.get 2)
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:103
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 9]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:104
|
||||
assert_return(() => invoke($4, `grow`, [10]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:105
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 19]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:110
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-init-size-empty-vs-i32-externref (result i32)
|
||||
(table.grow $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:119
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-size-empty-vs-i32 (result i32)
|
||||
(table.grow $$t (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:128
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-init-empty-vs-externref (result i32)
|
||||
(table.grow $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:137
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-size-f32-vs-i32 (result i32)
|
||||
(table.grow $$t (ref.null extern) (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:146
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
(func $$type-init-externref-vs-funcref (param $$r externref) (result i32)
|
||||
(table.grow $$t (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:156
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-empty
|
||||
(table.grow $$t (ref.null extern) (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:165
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-f32 (result f32)
|
||||
(table.grow $$t (ref.null extern) (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,177 @@
|
||||
/* 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/table_set.wast
|
||||
|
||||
// ./test/core/table_set.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t2 1 externref)
|
||||
(table $$t3 2 funcref)
|
||||
(elem (table $$t3) (i32.const 1) func $$dummy)
|
||||
(func $$dummy)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
)
|
||||
|
||||
(func (export "set-externref") (param $$i i32) (param $$r externref)
|
||||
(table.set $$t2 (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref") (param $$i i32) (param $$r funcref)
|
||||
(table.set $$t3 (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref-from") (param $$i i32) (param $$j i32)
|
||||
(table.set $$t3 (local.get $$i) (table.get $$t3 (local.get $$j)))
|
||||
)
|
||||
|
||||
(func (export "is_null-funcref") (param $$i i32) (result i32)
|
||||
(ref.is_null (call $$f3 (local.get $$i)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_set.wast:29
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:30
|
||||
assert_return(() => invoke($0, `set-externref`, [0, externref(1)]), []);
|
||||
|
||||
// ./test/core/table_set.wast:31
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_set.wast:32
|
||||
assert_return(() => invoke($0, `set-externref`, [0, null]), []);
|
||||
|
||||
// ./test/core/table_set.wast:33
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:35
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:36
|
||||
assert_return(() => invoke($0, `set-funcref-from`, [0, 1]), []);
|
||||
|
||||
// ./test/core/table_set.wast:37
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_set.wast:38
|
||||
assert_return(() => invoke($0, `set-funcref`, [0, null]), []);
|
||||
|
||||
// ./test/core/table_set.wast:39
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:41
|
||||
assert_trap(() => invoke($0, `set-externref`, [2, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:42
|
||||
assert_trap(() => invoke($0, `set-funcref`, [3, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:43
|
||||
assert_trap(() => invoke($0, `set-externref`, [-1, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:44
|
||||
assert_trap(() => invoke($0, `set-funcref`, [-1, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:46
|
||||
assert_trap(() => invoke($0, `set-externref`, [2, externref(0)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:47
|
||||
assert_trap(() => invoke($0, `set-funcref-from`, [3, 1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:48
|
||||
assert_trap(() => invoke($0, `set-externref`, [-1, externref(0)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:49
|
||||
assert_trap(() => invoke($0, `set-funcref-from`, [-1, 1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:54
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-value-empty-vs-i32-externref
|
||||
(table.set $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:63
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32
|
||||
(table.set $$t (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:72
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-value-empty-vs-externref
|
||||
(table.set $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:81
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-size-f32-vs-i32
|
||||
(table.set $$t (f32.const 1) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:90
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func $$type-value-externref-vs-funcref (param $$r externref)
|
||||
(table.set $$t (i32.const 1) (local.get $$r))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:100
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 1 funcref)
|
||||
(func $$type-value-externref-vs-funcref-multi (param $$r externref)
|
||||
(table.set $$t2 (i32.const 0) (local.get $$r))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:111
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-empty-vs-num (result i32)
|
||||
(table.set $$t (i32.const 0) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,172 @@
|
||||
/* 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/table_size.wast
|
||||
|
||||
// ./test/core/table_size.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t0 0 externref)
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 0 2 externref)
|
||||
(table $$t3 3 8 externref)
|
||||
|
||||
(func (export "size-t0") (result i32) (table.size $$t0))
|
||||
(func (export "size-t1") (result i32) (table.size $$t1))
|
||||
(func (export "size-t2") (result i32) (table.size $$t2))
|
||||
(func (export "size-t3") (result i32) (table.size $$t3))
|
||||
|
||||
(func (export "grow-t0") (param $$sz i32)
|
||||
(drop (table.grow $$t0 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t1") (param $$sz i32)
|
||||
(drop (table.grow $$t1 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t2") (param $$sz i32)
|
||||
(drop (table.grow $$t2 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t3") (param $$sz i32)
|
||||
(drop (table.grow $$t3 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_size.wast:26
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:27
|
||||
assert_return(() => invoke($0, `grow-t0`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:28
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:29
|
||||
assert_return(() => invoke($0, `grow-t0`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:30
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_size.wast:31
|
||||
assert_return(() => invoke($0, `grow-t0`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:32
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_size.wast:34
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:35
|
||||
assert_return(() => invoke($0, `grow-t1`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:36
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_size.wast:37
|
||||
assert_return(() => invoke($0, `grow-t1`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:38
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/table_size.wast:39
|
||||
assert_return(() => invoke($0, `grow-t1`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:40
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/table_size.wast:42
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:43
|
||||
assert_return(() => invoke($0, `grow-t2`, [3]), []);
|
||||
|
||||
// ./test/core/table_size.wast:44
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:45
|
||||
assert_return(() => invoke($0, `grow-t2`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:46
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:47
|
||||
assert_return(() => invoke($0, `grow-t2`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:48
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:49
|
||||
assert_return(() => invoke($0, `grow-t2`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:50
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:51
|
||||
assert_return(() => invoke($0, `grow-t2`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:52
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_size.wast:54
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_size.wast:55
|
||||
assert_return(() => invoke($0, `grow-t3`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:56
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_size.wast:57
|
||||
assert_return(() => invoke($0, `grow-t3`, [3]), []);
|
||||
|
||||
// ./test/core/table_size.wast:58
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:59
|
||||
assert_return(() => invoke($0, `grow-t3`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:60
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:61
|
||||
assert_return(() => invoke($0, `grow-t3`, [2]), []);
|
||||
|
||||
// ./test/core/table_size.wast:62
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:63
|
||||
assert_return(() => invoke($0, `grow-t3`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:64
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 8)]);
|
||||
|
||||
// ./test/core/table_size.wast:69
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-empty
|
||||
(table.size $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_size.wast:78
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-f32 (result f32)
|
||||
(table.size $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -83,6 +83,3 @@ let $1 = instantiate(`(module
|
||||
(drop)
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/unreached-valid.wast:63
|
||||
assert_trap(() => invoke($1, `meet-bottom`, []), `unreachable`);
|
||||
@@ -0,0 +1 @@
|
||||
|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-extended-const; skip-if: !wasmExtendedConstEnabled()
|
||||
@@ -32,6 +32,10 @@ let $0 = instantiate(`(module
|
||||
|
||||
(global $$z1 i32 (global.get 0))
|
||||
(global $$z2 i64 (global.get 1))
|
||||
(global $$z3 i32 (i32.add (i32.sub (i32.mul (i32.const 20) (i32.const 2)) (i32.const 2)) (i32.const 4)))
|
||||
(global $$z4 i64 (i64.add (i64.sub (i64.mul (i64.const 20) (i64.const 2)) (i64.const 2)) (i64.const 5)))
|
||||
(global $$z5 i32 (i32.add (global.get 0) (i32.const 42)))
|
||||
(global $$z6 i64 (i64.add (global.get 1) (i64.const 42)))
|
||||
|
||||
(global $$r externref (ref.null extern))
|
||||
(global $$mr (mut externref) (ref.null extern))
|
||||
@@ -45,6 +49,10 @@ let $0 = instantiate(`(module
|
||||
(func (export "get-y") (result i64) (global.get $$y))
|
||||
(func (export "get-z1") (result i32) (global.get $$z1))
|
||||
(func (export "get-z2") (result i64) (global.get $$z2))
|
||||
(func (export "get-z3") (result i32) (global.get $$z3))
|
||||
(func (export "get-z4") (result i64) (global.get $$z4))
|
||||
(func (export "get-z5") (result i32) (global.get $$z5))
|
||||
(func (export "get-z6") (result i64) (global.get $$z6))
|
||||
(func (export "set-x") (param i32) (global.set $$x (local.get 0)))
|
||||
(func (export "set-y") (param i64) (global.set $$y (local.get 0)))
|
||||
(func (export "set-mr") (param externref) (global.set $$mr (local.get 0)))
|
||||
@@ -209,309 +217,321 @@ let $0 = instantiate(`(module
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/global.wast:196
|
||||
// ./test/core/global.wast:204
|
||||
assert_return(() => invoke($0, `get-a`, []), [value("i32", -2)]);
|
||||
|
||||
// ./test/core/global.wast:197
|
||||
// ./test/core/global.wast:205
|
||||
assert_return(() => invoke($0, `get-b`, []), [value("i64", -5n)]);
|
||||
|
||||
// ./test/core/global.wast:198
|
||||
// ./test/core/global.wast:206
|
||||
assert_return(() => invoke($0, `get-r`, []), [value('externref', null)]);
|
||||
|
||||
// ./test/core/global.wast:199
|
||||
// ./test/core/global.wast:207
|
||||
assert_return(() => invoke($0, `get-mr`, []), [value('externref', null)]);
|
||||
|
||||
// ./test/core/global.wast:200
|
||||
// ./test/core/global.wast:208
|
||||
assert_return(() => invoke($0, `get-x`, []), [value("i32", -12)]);
|
||||
|
||||
// ./test/core/global.wast:201
|
||||
// ./test/core/global.wast:209
|
||||
assert_return(() => invoke($0, `get-y`, []), [value("i64", -15n)]);
|
||||
|
||||
// ./test/core/global.wast:202
|
||||
// ./test/core/global.wast:210
|
||||
assert_return(() => invoke($0, `get-z1`, []), [value("i32", 666)]);
|
||||
|
||||
// ./test/core/global.wast:203
|
||||
// ./test/core/global.wast:211
|
||||
assert_return(() => invoke($0, `get-z2`, []), [value("i64", 666n)]);
|
||||
|
||||
// ./test/core/global.wast:205
|
||||
assert_return(() => invoke($0, `get-3`, []), [value("f32", -3)]);
|
||||
|
||||
// ./test/core/global.wast:206
|
||||
assert_return(() => invoke($0, `get-4`, []), [value("f64", -4)]);
|
||||
|
||||
// ./test/core/global.wast:207
|
||||
assert_return(() => invoke($0, `get-7`, []), [value("f32", -13)]);
|
||||
|
||||
// ./test/core/global.wast:208
|
||||
assert_return(() => invoke($0, `get-8`, []), [value("f64", -14)]);
|
||||
|
||||
// ./test/core/global.wast:210
|
||||
assert_return(() => invoke($0, `set-x`, [6]), []);
|
||||
|
||||
// ./test/core/global.wast:211
|
||||
assert_return(() => invoke($0, `set-y`, [7n]), []);
|
||||
// ./test/core/global.wast:212
|
||||
assert_return(() => invoke($0, `get-z3`, []), [value("i32", 42)]);
|
||||
|
||||
// ./test/core/global.wast:213
|
||||
assert_return(() => invoke($0, `set-7`, [value("f32", 8)]), []);
|
||||
assert_return(() => invoke($0, `get-z4`, []), [value("i64", 43n)]);
|
||||
|
||||
// ./test/core/global.wast:214
|
||||
assert_return(() => invoke($0, `set-8`, [value("f64", 9)]), []);
|
||||
assert_return(() => invoke($0, `get-z5`, []), [value("i32", 708)]);
|
||||
|
||||
// ./test/core/global.wast:216
|
||||
assert_return(() => invoke($0, `get-x`, []), [value("i32", 6)]);
|
||||
// ./test/core/global.wast:215
|
||||
assert_return(() => invoke($0, `get-z6`, []), [value("i64", 708n)]);
|
||||
|
||||
// ./test/core/global.wast:217
|
||||
assert_return(() => invoke($0, `get-y`, []), [value("i64", 7n)]);
|
||||
assert_return(() => invoke($0, `get-3`, []), [value("f32", -3)]);
|
||||
|
||||
// ./test/core/global.wast:218
|
||||
assert_return(() => invoke($0, `get-7`, []), [value("f32", 8)]);
|
||||
assert_return(() => invoke($0, `get-4`, []), [value("f64", -4)]);
|
||||
|
||||
// ./test/core/global.wast:219
|
||||
assert_return(() => invoke($0, `get-8`, []), [value("f64", 9)]);
|
||||
assert_return(() => invoke($0, `get-7`, []), [value("f32", -13)]);
|
||||
|
||||
// ./test/core/global.wast:221
|
||||
assert_return(() => invoke($0, `set-7`, [value("f32", 8)]), []);
|
||||
// ./test/core/global.wast:220
|
||||
assert_return(() => invoke($0, `get-8`, []), [value("f64", -14)]);
|
||||
|
||||
// ./test/core/global.wast:222
|
||||
assert_return(() => invoke($0, `set-8`, [value("f64", 9)]), []);
|
||||
assert_return(() => invoke($0, `set-x`, [6]), []);
|
||||
|
||||
// ./test/core/global.wast:223
|
||||
assert_return(() => invoke($0, `set-mr`, [externref(10)]), []);
|
||||
assert_return(() => invoke($0, `set-y`, [7n]), []);
|
||||
|
||||
// ./test/core/global.wast:225
|
||||
assert_return(() => invoke($0, `get-x`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `set-7`, [value("f32", 8)]), []);
|
||||
|
||||
// ./test/core/global.wast:226
|
||||
assert_return(() => invoke($0, `get-y`, []), [value("i64", 7n)]);
|
||||
|
||||
// ./test/core/global.wast:227
|
||||
assert_return(() => invoke($0, `get-7`, []), [value("f32", 8)]);
|
||||
assert_return(() => invoke($0, `set-8`, [value("f64", 9)]), []);
|
||||
|
||||
// ./test/core/global.wast:228
|
||||
assert_return(() => invoke($0, `get-8`, []), [value("f64", 9)]);
|
||||
assert_return(() => invoke($0, `get-x`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:229
|
||||
assert_return(() => invoke($0, `get-mr`, []), [value('externref', externref(10))]);
|
||||
assert_return(() => invoke($0, `get-y`, []), [value("i64", 7n)]);
|
||||
|
||||
// ./test/core/global.wast:230
|
||||
assert_return(() => invoke($0, `get-7`, []), [value("f32", 8)]);
|
||||
|
||||
// ./test/core/global.wast:231
|
||||
assert_return(() => invoke($0, `as-select-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:232
|
||||
assert_return(() => invoke($0, `as-select-mid`, []), [value("i32", 2)]);
|
||||
assert_return(() => invoke($0, `get-8`, []), [value("f64", 9)]);
|
||||
|
||||
// ./test/core/global.wast:233
|
||||
assert_return(() => invoke($0, `as-select-last`, []), [value("i32", 2)]);
|
||||
assert_return(() => invoke($0, `set-7`, [value("f32", 8)]), []);
|
||||
|
||||
// ./test/core/global.wast:234
|
||||
assert_return(() => invoke($0, `set-8`, [value("f64", 9)]), []);
|
||||
|
||||
// ./test/core/global.wast:235
|
||||
assert_return(() => invoke($0, `as-loop-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:236
|
||||
assert_return(() => invoke($0, `as-loop-mid`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `set-mr`, [externref(10)]), []);
|
||||
|
||||
// ./test/core/global.wast:237
|
||||
assert_return(() => invoke($0, `as-loop-last`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `get-x`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:238
|
||||
assert_return(() => invoke($0, `get-y`, []), [value("i64", 7n)]);
|
||||
|
||||
// ./test/core/global.wast:239
|
||||
assert_return(() => invoke($0, `as-if-condition`, []), [value("i32", 2)]);
|
||||
assert_return(() => invoke($0, `get-7`, []), [value("f32", 8)]);
|
||||
|
||||
// ./test/core/global.wast:240
|
||||
assert_return(() => invoke($0, `as-if-then`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `get-8`, []), [value("f64", 9)]);
|
||||
|
||||
// ./test/core/global.wast:241
|
||||
assert_return(() => invoke($0, `as-if-else`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `get-mr`, []), [value('externref', externref(10))]);
|
||||
|
||||
// ./test/core/global.wast:243
|
||||
assert_return(() => invoke($0, `as-br_if-first`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `as-select-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:244
|
||||
assert_return(() => invoke($0, `as-br_if-last`, []), [value("i32", 2)]);
|
||||
assert_return(() => invoke($0, `as-select-mid`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/global.wast:246
|
||||
assert_return(() => invoke($0, `as-br_table-first`, []), [value("i32", 6)]);
|
||||
// ./test/core/global.wast:245
|
||||
assert_return(() => invoke($0, `as-select-last`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/global.wast:247
|
||||
assert_return(() => invoke($0, `as-br_table-last`, []), [value("i32", 2)]);
|
||||
assert_return(() => invoke($0, `as-loop-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:248
|
||||
assert_return(() => invoke($0, `as-loop-mid`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:249
|
||||
assert_return(() => invoke($0, `as-call_indirect-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:250
|
||||
assert_return(() => invoke($0, `as-call_indirect-mid`, []), [value("i32", 2)]);
|
||||
assert_return(() => invoke($0, `as-loop-last`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:251
|
||||
assert_trap(() => invoke($0, `as-call_indirect-last`, []), `undefined element`);
|
||||
assert_return(() => invoke($0, `as-if-condition`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/global.wast:252
|
||||
assert_return(() => invoke($0, `as-if-then`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:253
|
||||
assert_return(() => invoke($0, `as-store-first`, []), []);
|
||||
|
||||
// ./test/core/global.wast:254
|
||||
assert_return(() => invoke($0, `as-store-last`, []), []);
|
||||
assert_return(() => invoke($0, `as-if-else`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:255
|
||||
assert_return(() => invoke($0, `as-load-operand`, []), [value("i32", 1)]);
|
||||
assert_return(() => invoke($0, `as-br_if-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:256
|
||||
assert_return(() => invoke($0, `as-memory.grow-value`, []), [value("i32", 1)]);
|
||||
assert_return(() => invoke($0, `as-br_if-last`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/global.wast:258
|
||||
assert_return(() => invoke($0, `as-call-value`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `as-br_table-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:260
|
||||
assert_return(() => invoke($0, `as-return-value`, []), [value("i32", 6)]);
|
||||
// ./test/core/global.wast:259
|
||||
assert_return(() => invoke($0, `as-br_table-last`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/global.wast:261
|
||||
assert_return(() => invoke($0, `as-drop-operand`, []), []);
|
||||
assert_return(() => invoke($0, `as-call_indirect-first`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:262
|
||||
assert_return(() => invoke($0, `as-br-value`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `as-call_indirect-mid`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/global.wast:264
|
||||
assert_return(() => invoke($0, `as-local.set-value`, [1]), [value("i32", 6)]);
|
||||
// ./test/core/global.wast:263
|
||||
assert_trap(() => invoke($0, `as-call_indirect-last`, []), `undefined element`);
|
||||
|
||||
// ./test/core/global.wast:265
|
||||
assert_return(() => invoke($0, `as-local.tee-value`, [1]), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `as-store-first`, []), []);
|
||||
|
||||
// ./test/core/global.wast:266
|
||||
assert_return(() => invoke($0, `as-global.set-value`, []), [value("i32", 6)]);
|
||||
assert_return(() => invoke($0, `as-store-last`, []), []);
|
||||
|
||||
// ./test/core/global.wast:267
|
||||
assert_return(() => invoke($0, `as-load-operand`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/global.wast:268
|
||||
assert_return(() => invoke($0, `as-unary-operand`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/global.wast:269
|
||||
assert_return(() => invoke($0, `as-binary-operand`, []), [value("i32", 36)]);
|
||||
assert_return(() => invoke($0, `as-memory.grow-value`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/global.wast:270
|
||||
assert_return(() => invoke($0, `as-compare-operand`, []), [value("i32", 1)]);
|
||||
assert_return(() => invoke($0, `as-call-value`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:272
|
||||
assert_return(() => invoke($0, `as-return-value`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:273
|
||||
assert_return(() => invoke($0, `as-drop-operand`, []), []);
|
||||
|
||||
// ./test/core/global.wast:274
|
||||
assert_return(() => invoke($0, `as-br-value`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:276
|
||||
assert_return(() => invoke($0, `as-local.set-value`, [1]), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:277
|
||||
assert_return(() => invoke($0, `as-local.tee-value`, [1]), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:278
|
||||
assert_return(() => invoke($0, `as-global.set-value`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/global.wast:280
|
||||
assert_return(() => invoke($0, `as-unary-operand`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/global.wast:281
|
||||
assert_return(() => invoke($0, `as-binary-operand`, []), [value("i32", 36)]);
|
||||
|
||||
// ./test/core/global.wast:282
|
||||
assert_return(() => invoke($0, `as-compare-operand`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/global.wast:284
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global f32 (f32.const 0)) (func (global.set 0 (f32.const 1))))`),
|
||||
`global is immutable`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:277
|
||||
// ./test/core/global.wast:289
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (import "spectest" "global_i32" (global i32)) (func (global.set 0 (i32.const 1))))`),
|
||||
`global is immutable`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:283
|
||||
// ./test/core/global.wast:295
|
||||
let $1 = instantiate(`(module (global (mut f32) (f32.const 0)) (export "a" (global 0)))`);
|
||||
|
||||
// ./test/core/global.wast:284
|
||||
// ./test/core/global.wast:296
|
||||
let $2 = instantiate(`(module (global (export "a") (mut f32) (f32.const 0)))`);
|
||||
|
||||
// ./test/core/global.wast:286
|
||||
// ./test/core/global.wast:298
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global f32 (f32.neg (f32.const 0))))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:291
|
||||
// ./test/core/global.wast:303
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global f32 (local.get 0)))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:296
|
||||
// ./test/core/global.wast:308
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global f32 (f32.neg (f32.const 1))))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:301
|
||||
// ./test/core/global.wast:313
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (i32.const 0) (nop)))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:306
|
||||
// ./test/core/global.wast:318
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (i32.ctz (i32.const 0))))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:311
|
||||
// ./test/core/global.wast:323
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (nop)))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:316
|
||||
// ./test/core/global.wast:328
|
||||
assert_invalid(() => instantiate(`(module (global i32 (f32.const 0)))`), `type mismatch`);
|
||||
|
||||
// ./test/core/global.wast:321
|
||||
// ./test/core/global.wast:333
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (i32.const 0) (i32.const 0)))`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:326
|
||||
// ./test/core/global.wast:338
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (;empty instruction sequence;)))`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:331
|
||||
// ./test/core/global.wast:343
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "" "") externref) (global funcref (global.get 0)))`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:336
|
||||
// ./test/core/global.wast:348
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "test" "global-i32") i32) (global i32 (global.get 0) (global.get 0)))`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:341
|
||||
// ./test/core/global.wast:353
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "test" "global-i32") i32) (global i32 (i32.const 0) (global.get 0)))`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:346
|
||||
// ./test/core/global.wast:358
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (global.get 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:351
|
||||
// ./test/core/global.wast:363
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (i32.const 0)) (global i32 (global.get 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:355
|
||||
// ./test/core/global.wast:367
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global $$g i32 (i32.const 0)) (global i32 (global.get $$g)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:360
|
||||
// ./test/core/global.wast:372
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (global.get 1)) (global i32 (i32.const 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:365
|
||||
// ./test/core/global.wast:377
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "test" "global-i32") i32) (global i32 (global.get 2)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:370
|
||||
// ./test/core/global.wast:382
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "test" "global-mut-i32") (mut i32)) (global i32 (global.get 0)))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:375
|
||||
// ./test/core/global.wast:387
|
||||
let $3 = instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
)`);
|
||||
|
||||
// ./test/core/global.wast:378
|
||||
// ./test/core/global.wast:390
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -526,7 +546,7 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:391
|
||||
// ./test/core/global.wast:403
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -541,12 +561,12 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:405
|
||||
// ./test/core/global.wast:417
|
||||
let $4 = instantiate(`(module
|
||||
(global i32 (i32.const 0))
|
||||
)`);
|
||||
|
||||
// ./test/core/global.wast:408
|
||||
// ./test/core/global.wast:420
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -560,7 +580,7 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:420
|
||||
// ./test/core/global.wast:432
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -574,13 +594,13 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:434
|
||||
// ./test/core/global.wast:446
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (result i32) (global.get 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:439
|
||||
// ./test/core/global.wast:451
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global i32 (i32.const 0))
|
||||
@@ -589,7 +609,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:447
|
||||
// ./test/core/global.wast:459
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -598,7 +618,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:455
|
||||
// ./test/core/global.wast:467
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -608,13 +628,13 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:465
|
||||
// ./test/core/global.wast:477
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (i32.const 0) (global.set 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:470
|
||||
// ./test/core/global.wast:482
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global i32 (i32.const 0))
|
||||
@@ -623,7 +643,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:478
|
||||
// ./test/core/global.wast:490
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -632,7 +652,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:486
|
||||
// ./test/core/global.wast:498
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -642,7 +662,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:496
|
||||
// ./test/core/global.wast:508
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -653,7 +673,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:505
|
||||
// ./test/core/global.wast:517
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -665,7 +685,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:515
|
||||
// ./test/core/global.wast:527
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -677,7 +697,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:525
|
||||
// ./test/core/global.wast:537
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -689,7 +709,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:535
|
||||
// ./test/core/global.wast:547
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -701,7 +721,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:545
|
||||
// ./test/core/global.wast:557
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -713,7 +733,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:555
|
||||
// ./test/core/global.wast:567
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -725,7 +745,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:565
|
||||
// ./test/core/global.wast:577
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -737,7 +757,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:575
|
||||
// ./test/core/global.wast:587
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -748,7 +768,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:584
|
||||
// ./test/core/global.wast:596
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -759,7 +779,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:593
|
||||
// ./test/core/global.wast:605
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -771,7 +791,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:603
|
||||
// ./test/core/global.wast:615
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -789,19 +809,19 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:622
|
||||
// ./test/core/global.wast:634
|
||||
assert_malformed(
|
||||
() => instantiate(`(global $$foo i32 (i32.const 0)) (global $$foo i32 (i32.const 0)) `),
|
||||
`duplicate global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:626
|
||||
// ./test/core/global.wast:638
|
||||
assert_malformed(
|
||||
() => instantiate(`(import "" "" (global $$foo i32)) (global $$foo i32 (i32.const 0)) `),
|
||||
`duplicate global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:630
|
||||
// ./test/core/global.wast:642
|
||||
assert_malformed(
|
||||
() => instantiate(`(import "" "" (global $$foo i32)) (import "" "" (global $$foo i32)) `),
|
||||
`duplicate global`,
|
||||
@@ -0,0 +1 @@
|
||||
|jit-test| skip-if: true
|
||||
@@ -0,0 +1,360 @@
|
||||
"use strict";
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
if (!wasmIsSupported()) {
|
||||
quit();
|
||||
}
|
||||
|
||||
function bytes(type, bytes) {
|
||||
var typedBuffer = new Uint8Array(bytes);
|
||||
return wasmGlobalFromArrayBuffer(type, typedBuffer.buffer);
|
||||
}
|
||||
function value(type, value) {
|
||||
return new WebAssembly.Global({
|
||||
value: type,
|
||||
mutable: false,
|
||||
}, value);
|
||||
}
|
||||
|
||||
function i8x16(elements) {
|
||||
let typedBuffer = new Uint8Array(elements);
|
||||
return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
|
||||
}
|
||||
function i16x8(elements) {
|
||||
let typedBuffer = new Uint16Array(elements);
|
||||
return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
|
||||
}
|
||||
function i32x4(elements) {
|
||||
let typedBuffer = new Uint32Array(elements);
|
||||
return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
|
||||
}
|
||||
function i64x2(elements) {
|
||||
let typedBuffer = new BigUint64Array(elements);
|
||||
return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
|
||||
}
|
||||
function f32x4(elements) {
|
||||
let typedBuffer = new Float32Array(elements);
|
||||
return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
|
||||
}
|
||||
function f64x2(elements) {
|
||||
let typedBuffer = new Float64Array(elements);
|
||||
return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
|
||||
}
|
||||
|
||||
function either(...arr) {
|
||||
return new EitherVariants(arr);
|
||||
}
|
||||
|
||||
class F32x4Pattern {
|
||||
constructor(x, y, z, w) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
}
|
||||
|
||||
class F64x2Pattern {
|
||||
constructor(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
let externrefs = {};
|
||||
let externsym = Symbol("externref");
|
||||
function externref(s) {
|
||||
if (!(s in externrefs)) externrefs[s] = { [externsym]: s };
|
||||
return externrefs[s];
|
||||
}
|
||||
function is_externref(x) {
|
||||
return (x !== null && externsym in x) ? 1 : 0;
|
||||
}
|
||||
function is_funcref(x) {
|
||||
return typeof x === "function" ? 1 : 0;
|
||||
}
|
||||
function eq_externref(x, y) {
|
||||
return x === y ? 1 : 0;
|
||||
}
|
||||
function eq_funcref(x, y) {
|
||||
return x === y ? 1 : 0;
|
||||
}
|
||||
|
||||
let spectest = {
|
||||
externref: externref,
|
||||
is_externref: is_externref,
|
||||
is_funcref: is_funcref,
|
||||
eq_externref: eq_externref,
|
||||
eq_funcref: eq_funcref,
|
||||
print: console.log.bind(console),
|
||||
print_i32: console.log.bind(console),
|
||||
print_i32_f32: console.log.bind(console),
|
||||
print_f64_f64: console.log.bind(console),
|
||||
print_f32: console.log.bind(console),
|
||||
print_f64: console.log.bind(console),
|
||||
global_i32: 666,
|
||||
global_i64: 666n,
|
||||
global_f32: 666,
|
||||
global_f64: 666,
|
||||
table: new WebAssembly.Table({
|
||||
initial: 10,
|
||||
maximum: 20,
|
||||
element: "anyfunc",
|
||||
}),
|
||||
memory: new WebAssembly.Memory({ initial: 1, maximum: 2 }),
|
||||
};
|
||||
|
||||
let linkage = {
|
||||
spectest,
|
||||
};
|
||||
|
||||
function getInstance(instanceish) {
|
||||
if (typeof instanceish === "string") {
|
||||
assertEq(
|
||||
instanceish in linkage,
|
||||
true,
|
||||
`'${instanceish}'' must be registered`,
|
||||
);
|
||||
return linkage[instanceish];
|
||||
}
|
||||
return instanceish;
|
||||
}
|
||||
|
||||
function instantiate(source) {
|
||||
let bytecode = wasmTextToBinary(source);
|
||||
let module = new WebAssembly.Module(bytecode);
|
||||
let instance = new WebAssembly.Instance(module, linkage);
|
||||
return instance.exports;
|
||||
}
|
||||
|
||||
function register(instanceish, name) {
|
||||
linkage[name] = getInstance(instanceish);
|
||||
}
|
||||
|
||||
function invoke(instanceish, field, params) {
|
||||
let func = getInstance(instanceish)[field];
|
||||
assertEq(func instanceof Function, true, "expected a function");
|
||||
return wasmLosslessInvoke(func, ...params);
|
||||
}
|
||||
|
||||
function get(instanceish, field) {
|
||||
let global = getInstance(instanceish)[field];
|
||||
assertEq(
|
||||
global instanceof WebAssembly.Global,
|
||||
true,
|
||||
"expected a WebAssembly.Global",
|
||||
);
|
||||
return global;
|
||||
}
|
||||
|
||||
function assert_trap(thunk, message) {
|
||||
try {
|
||||
thunk();
|
||||
assertEq("normal return", "trap");
|
||||
} catch (err) {
|
||||
assertEq(
|
||||
err instanceof WebAssembly.RuntimeError,
|
||||
true,
|
||||
"expected trap",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let StackOverflow;
|
||||
try {
|
||||
(function f() {
|
||||
1 + f();
|
||||
})();
|
||||
} catch (e) {
|
||||
StackOverflow = e.constructor;
|
||||
}
|
||||
function assert_exhaustion(thunk, message) {
|
||||
try {
|
||||
thunk();
|
||||
assertEq("normal return", "exhaustion");
|
||||
} catch (err) {
|
||||
assertEq(
|
||||
err instanceof StackOverflow,
|
||||
true,
|
||||
"expected exhaustion",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assert_invalid(thunk, message) {
|
||||
try {
|
||||
thunk();
|
||||
assertEq("valid module", "invalid module");
|
||||
} catch (err) {
|
||||
assertEq(
|
||||
err instanceof WebAssembly.LinkError ||
|
||||
err instanceof WebAssembly.CompileError,
|
||||
true,
|
||||
"expected an invalid module",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assert_unlinkable(thunk, message) {
|
||||
try {
|
||||
thunk();
|
||||
assertEq(true, false, "expected an unlinkable module");
|
||||
} catch (err) {
|
||||
assertEq(
|
||||
err instanceof WebAssembly.LinkError ||
|
||||
err instanceof WebAssembly.CompileError,
|
||||
true,
|
||||
"expected an unlinkable module",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assert_malformed(thunk, message) {
|
||||
try {
|
||||
thunk();
|
||||
assertEq("valid module", "malformed module");
|
||||
} catch (err) {
|
||||
assertEq(
|
||||
err instanceof TypeError ||
|
||||
err instanceof SyntaxError ||
|
||||
err instanceof WebAssembly.CompileError ||
|
||||
err instanceof WebAssembly.LinkError,
|
||||
true,
|
||||
`expected a malformed module`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assert_exception(thunk) {
|
||||
let thrown = false;
|
||||
try {
|
||||
thunk();
|
||||
} catch (err) {
|
||||
thrown = true;
|
||||
}
|
||||
assertEq(thrown, true, "expected an exception to be thrown");
|
||||
}
|
||||
|
||||
function assert_return(thunk, expected) {
|
||||
let results = thunk();
|
||||
|
||||
if (results === undefined) {
|
||||
results = [];
|
||||
} else if (!Array.isArray(results)) {
|
||||
results = [results];
|
||||
}
|
||||
if (!Array.isArray(expected)) {
|
||||
expected = [expected];
|
||||
}
|
||||
|
||||
if (!compareResults(results, expected)) {
|
||||
let got = results.map((x) => formatResult(x)).join(", ");
|
||||
let wanted = expected.map((x) => formatExpected(x)).join(", ");
|
||||
assertEq(
|
||||
`[${got}]`,
|
||||
`[${wanted}]`,
|
||||
);
|
||||
assertEq(true, false, `${got} !== ${wanted}`);
|
||||
}
|
||||
}
|
||||
|
||||
function formatResult(result) {
|
||||
if (typeof (result) === "object") {
|
||||
return wasmGlobalToString(result);
|
||||
} else {
|
||||
return `${result}`;
|
||||
}
|
||||
}
|
||||
|
||||
function formatExpected(expected) {
|
||||
if (
|
||||
expected === `f32_canonical_nan` ||
|
||||
expected === `f32_arithmetic_nan` ||
|
||||
expected === `f64_canonical_nan` ||
|
||||
expected === `f64_arithmetic_nan`
|
||||
) {
|
||||
return expected;
|
||||
} else if (expected instanceof F32x4Pattern) {
|
||||
return `f32x4(${formatExpected(expected.x)}, ${
|
||||
formatExpected(expected.y)
|
||||
}, ${formatExpected(expected.z)}, ${formatExpected(expected.w)})`;
|
||||
} else if (expected instanceof F64x2Pattern) {
|
||||
return `f64x2(${formatExpected(expected.x)}, ${
|
||||
formatExpected(expected.y)
|
||||
})`;
|
||||
} else if (expected instanceof EitherVariants) {
|
||||
return expected.formatExpected();
|
||||
} else if (typeof (expected) === "object") {
|
||||
return wasmGlobalToString(expected);
|
||||
} else {
|
||||
throw new Error("unknown expected result");
|
||||
}
|
||||
}
|
||||
|
||||
class EitherVariants {
|
||||
constructor(arr) {
|
||||
this.arr = arr;
|
||||
}
|
||||
matches(v) {
|
||||
return this.arr.some((e) => compareResult(v, e));
|
||||
}
|
||||
formatExpected() {
|
||||
return `either(${this.arr.map(formatExpected).join(", ")})`;
|
||||
}
|
||||
}
|
||||
|
||||
function compareResults(results, expected) {
|
||||
if (results.length !== expected.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i in results) {
|
||||
if (expected[i] instanceof EitherVariants) {
|
||||
return expected[i].matches(results[i]);
|
||||
}
|
||||
if (!compareResult(results[i], expected[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function compareResult(result, expected) {
|
||||
if (
|
||||
expected === `canonical_nan` ||
|
||||
expected === `arithmetic_nan`
|
||||
) {
|
||||
return wasmGlobalIsNaN(result, expected);
|
||||
} else if (expected instanceof F32x4Pattern) {
|
||||
return compareResult(
|
||||
wasmGlobalExtractLane(result, "f32x4", 0),
|
||||
expected.x,
|
||||
) &&
|
||||
compareResult(wasmGlobalExtractLane(result, "f32x4", 1), expected.y) &&
|
||||
compareResult(wasmGlobalExtractLane(result, "f32x4", 2), expected.z) &&
|
||||
compareResult(wasmGlobalExtractLane(result, "f32x4", 3), expected.w);
|
||||
} else if (expected instanceof F64x2Pattern) {
|
||||
return compareResult(
|
||||
wasmGlobalExtractLane(result, "f64x2", 0),
|
||||
expected.x,
|
||||
) &&
|
||||
compareResult(wasmGlobalExtractLane(result, "f64x2", 1), expected.y);
|
||||
} else if (typeof (expected) === "object") {
|
||||
return wasmGlobalsEqual(result, expected);
|
||||
} else {
|
||||
throw new Error("unknown expected result");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,234 @@
|
||||
/* 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/table_fill.wast
|
||||
|
||||
// ./test/core/table_fill.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
|
||||
(func (export "fill") (param $$i i32) (param $$r externref) (param $$n i32)
|
||||
(table.fill $$t (local.get $$i) (local.get $$r) (local.get $$n))
|
||||
)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref)
|
||||
(table.get $$t (local.get $$i))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_fill.wast:13
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:14
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:15
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:16
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:17
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:19
|
||||
assert_return(() => invoke($0, `fill`, [2, externref(1), 3]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:20
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:21
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:22
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:23
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:24
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:26
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(2), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:27
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:28
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:29
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:30
|
||||
assert_return(() => invoke($0, `get`, [6]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:32
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(3), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:33
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:34
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:35
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:37
|
||||
assert_return(() => invoke($0, `fill`, [8, externref(4), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:38
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:39
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:40
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:42
|
||||
assert_return(() => invoke($0, `fill`, [9, null, 1]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:43
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:44
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:46
|
||||
assert_return(() => invoke($0, `fill`, [10, externref(5), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:47
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:49
|
||||
assert_trap(() => invoke($0, `fill`, [8, externref(6), 3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:53
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:54
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:55
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:57
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:62
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 10]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:70
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-value-length-empty-vs-i32-i32
|
||||
(table.fill $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:79
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32
|
||||
(table.fill $$t (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:88
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-value-empty-vs
|
||||
(table.fill $$t (i32.const 1) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:97
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-length-empty-vs-i32
|
||||
(table.fill $$t (i32.const 1) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:106
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-index-f32-vs-i32
|
||||
(table.fill $$t (f32.const 1) (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:115
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
(func $$type-value-vs-funcref (param $$r externref)
|
||||
(table.fill $$t (i32.const 1) (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:124
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-length-f32-vs-i32
|
||||
(table.fill $$t (i32.const 1) (ref.null extern) (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:134
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 1 funcref)
|
||||
(func $$type-value-externref-vs-funcref-multi (param $$r externref)
|
||||
(table.fill $$t2 (i32.const 0) (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:145
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-empty-vs-num (result i32)
|
||||
(table.fill $$t (i32.const 0) (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,126 @@
|
||||
/* 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/table_get.wast
|
||||
|
||||
// ./test/core/table_get.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t2 2 externref)
|
||||
(table $$t3 3 funcref)
|
||||
(elem (table $$t3) (i32.const 1) func $$dummy)
|
||||
(func $$dummy)
|
||||
|
||||
(func (export "init") (param $$r externref)
|
||||
(table.set $$t2 (i32.const 1) (local.get $$r))
|
||||
(table.set $$t3 (i32.const 2) (table.get $$t3 (i32.const 1)))
|
||||
)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
)
|
||||
|
||||
(func (export "is_null-funcref") (param $$i i32) (result i32)
|
||||
(ref.is_null (call $$f3 (local.get $$i)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_get.wast:24
|
||||
invoke($0, `init`, [externref(1)]);
|
||||
|
||||
// ./test/core/table_get.wast:26
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_get.wast:27
|
||||
assert_return(() => invoke($0, `get-externref`, [1]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_get.wast:29
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_get.wast:30
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_get.wast:31
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [2]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_get.wast:33
|
||||
assert_trap(() => invoke($0, `get-externref`, [2]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:34
|
||||
assert_trap(() => invoke($0, `get-funcref`, [3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:35
|
||||
assert_trap(() => invoke($0, `get-externref`, [-1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:36
|
||||
assert_trap(() => invoke($0, `get-funcref`, [-1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:41
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32 (result externref)
|
||||
(table.get $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:50
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-f32-vs-i32 (result externref)
|
||||
(table.get $$t (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:60
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-externref-vs-empty
|
||||
(table.get $$t (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:69
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-externref-vs-funcref (result funcref)
|
||||
(table.get $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:79
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 funcref)
|
||||
(table $$t2 1 externref)
|
||||
(func $$type-result-externref-vs-funcref-multi (result funcref)
|
||||
(table.get $$t2 (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,268 @@
|
||||
/* 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/table_grow.wast
|
||||
|
||||
// ./test/core/table_grow.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref) (table.get $$t (local.get $$i)))
|
||||
(func (export "set") (param $$i i32) (param $$r externref) (table.set $$t (local.get $$i) (local.get $$r)))
|
||||
|
||||
(func (export "grow") (param $$sz i32) (param $$init externref) (result i32)
|
||||
(table.grow $$t (local.get $$init) (local.get $$sz))
|
||||
)
|
||||
(func (export "size") (result i32) (table.size $$t))
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:13
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:14
|
||||
assert_trap(() => invoke($0, `set`, [0, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:15
|
||||
assert_trap(() => invoke($0, `get`, [0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:17
|
||||
assert_return(() => invoke($0, `grow`, [1, null]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:18
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:19
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:20
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:21
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:22
|
||||
assert_trap(() => invoke($0, `set`, [1, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:23
|
||||
assert_trap(() => invoke($0, `get`, [1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:25
|
||||
assert_return(() => invoke($0, `grow`, [4, externref(3)]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:26
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_grow.wast:27
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:28
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:29
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:30
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:31
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:32
|
||||
assert_return(() => invoke($0, `set`, [4, externref(4)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:33
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_grow.wast:34
|
||||
assert_trap(() => invoke($0, `set`, [5, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:35
|
||||
assert_trap(() => invoke($0, `get`, [5]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:39
|
||||
let $1 = instantiate(`(module
|
||||
(table $$t 0x10 funcref)
|
||||
(elem declare func $$f)
|
||||
(func $$f (export "grow") (result i32)
|
||||
(table.grow $$t (ref.func $$f) (i32.const 0xffff_fff0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:47
|
||||
assert_return(() => invoke($1, `grow`, []), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:50
|
||||
let $2 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null extern) (local.get 0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:57
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:58
|
||||
assert_return(() => invoke($2, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:59
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:60
|
||||
assert_return(() => invoke($2, `grow`, [2]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:61
|
||||
assert_return(() => invoke($2, `grow`, [800]), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_grow.wast:64
|
||||
let $3 = instantiate(`(module
|
||||
(table $$t 0 10 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null extern) (local.get 0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:71
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:72
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:73
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:74
|
||||
assert_return(() => invoke($3, `grow`, [2]), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_grow.wast:75
|
||||
assert_return(() => invoke($3, `grow`, [6]), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_grow.wast:76
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:77
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:78
|
||||
assert_return(() => invoke($3, `grow`, [65536]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:81
|
||||
let $4 = instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null func) (local.get 0))
|
||||
)
|
||||
(elem declare func 1)
|
||||
(func (export "check-table-null") (param i32 i32) (result funcref)
|
||||
(local funcref)
|
||||
(local.set 2 (ref.func 1))
|
||||
(block
|
||||
(loop
|
||||
(local.set 2 (table.get $$t (local.get 0)))
|
||||
(br_if 1 (i32.eqz (ref.is_null (local.get 2))))
|
||||
(br_if 1 (i32.ge_u (local.get 0) (local.get 1)))
|
||||
(local.set 0 (i32.add (local.get 0) (i32.const 1)))
|
||||
(br_if 0 (i32.le_u (local.get 0) (local.get 1)))
|
||||
)
|
||||
)
|
||||
(local.get 2)
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:103
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 9]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:104
|
||||
assert_return(() => invoke($4, `grow`, [10]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:105
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 19]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:110
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-init-size-empty-vs-i32-externref (result i32)
|
||||
(table.grow $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:119
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-size-empty-vs-i32 (result i32)
|
||||
(table.grow $$t (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:128
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-init-empty-vs-externref (result i32)
|
||||
(table.grow $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:137
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-size-f32-vs-i32 (result i32)
|
||||
(table.grow $$t (ref.null extern) (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:146
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
(func $$type-init-externref-vs-funcref (param $$r externref) (result i32)
|
||||
(table.grow $$t (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:156
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-empty
|
||||
(table.grow $$t (ref.null extern) (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:165
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-f32 (result f32)
|
||||
(table.grow $$t (ref.null extern) (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,177 @@
|
||||
/* 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/table_set.wast
|
||||
|
||||
// ./test/core/table_set.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t2 1 externref)
|
||||
(table $$t3 2 funcref)
|
||||
(elem (table $$t3) (i32.const 1) func $$dummy)
|
||||
(func $$dummy)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
)
|
||||
|
||||
(func (export "set-externref") (param $$i i32) (param $$r externref)
|
||||
(table.set $$t2 (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref") (param $$i i32) (param $$r funcref)
|
||||
(table.set $$t3 (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref-from") (param $$i i32) (param $$j i32)
|
||||
(table.set $$t3 (local.get $$i) (table.get $$t3 (local.get $$j)))
|
||||
)
|
||||
|
||||
(func (export "is_null-funcref") (param $$i i32) (result i32)
|
||||
(ref.is_null (call $$f3 (local.get $$i)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_set.wast:29
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:30
|
||||
assert_return(() => invoke($0, `set-externref`, [0, externref(1)]), []);
|
||||
|
||||
// ./test/core/table_set.wast:31
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_set.wast:32
|
||||
assert_return(() => invoke($0, `set-externref`, [0, null]), []);
|
||||
|
||||
// ./test/core/table_set.wast:33
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:35
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:36
|
||||
assert_return(() => invoke($0, `set-funcref-from`, [0, 1]), []);
|
||||
|
||||
// ./test/core/table_set.wast:37
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_set.wast:38
|
||||
assert_return(() => invoke($0, `set-funcref`, [0, null]), []);
|
||||
|
||||
// ./test/core/table_set.wast:39
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:41
|
||||
assert_trap(() => invoke($0, `set-externref`, [2, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:42
|
||||
assert_trap(() => invoke($0, `set-funcref`, [3, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:43
|
||||
assert_trap(() => invoke($0, `set-externref`, [-1, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:44
|
||||
assert_trap(() => invoke($0, `set-funcref`, [-1, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:46
|
||||
assert_trap(() => invoke($0, `set-externref`, [2, externref(0)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:47
|
||||
assert_trap(() => invoke($0, `set-funcref-from`, [3, 1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:48
|
||||
assert_trap(() => invoke($0, `set-externref`, [-1, externref(0)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:49
|
||||
assert_trap(() => invoke($0, `set-funcref-from`, [-1, 1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:54
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-value-empty-vs-i32-externref
|
||||
(table.set $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:63
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32
|
||||
(table.set $$t (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:72
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-value-empty-vs-externref
|
||||
(table.set $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:81
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-size-f32-vs-i32
|
||||
(table.set $$t (f32.const 1) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:90
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func $$type-value-externref-vs-funcref (param $$r externref)
|
||||
(table.set $$t (i32.const 1) (local.get $$r))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:100
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 1 funcref)
|
||||
(func $$type-value-externref-vs-funcref-multi (param $$r externref)
|
||||
(table.set $$t2 (i32.const 0) (local.get $$r))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:111
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-empty-vs-num (result i32)
|
||||
(table.set $$t (i32.const 0) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -0,0 +1,172 @@
|
||||
/* 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/table_size.wast
|
||||
|
||||
// ./test/core/table_size.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t0 0 externref)
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 0 2 externref)
|
||||
(table $$t3 3 8 externref)
|
||||
|
||||
(func (export "size-t0") (result i32) (table.size $$t0))
|
||||
(func (export "size-t1") (result i32) (table.size $$t1))
|
||||
(func (export "size-t2") (result i32) (table.size $$t2))
|
||||
(func (export "size-t3") (result i32) (table.size $$t3))
|
||||
|
||||
(func (export "grow-t0") (param $$sz i32)
|
||||
(drop (table.grow $$t0 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t1") (param $$sz i32)
|
||||
(drop (table.grow $$t1 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t2") (param $$sz i32)
|
||||
(drop (table.grow $$t2 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t3") (param $$sz i32)
|
||||
(drop (table.grow $$t3 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_size.wast:26
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:27
|
||||
assert_return(() => invoke($0, `grow-t0`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:28
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:29
|
||||
assert_return(() => invoke($0, `grow-t0`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:30
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_size.wast:31
|
||||
assert_return(() => invoke($0, `grow-t0`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:32
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_size.wast:34
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:35
|
||||
assert_return(() => invoke($0, `grow-t1`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:36
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_size.wast:37
|
||||
assert_return(() => invoke($0, `grow-t1`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:38
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/table_size.wast:39
|
||||
assert_return(() => invoke($0, `grow-t1`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:40
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/table_size.wast:42
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:43
|
||||
assert_return(() => invoke($0, `grow-t2`, [3]), []);
|
||||
|
||||
// ./test/core/table_size.wast:44
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:45
|
||||
assert_return(() => invoke($0, `grow-t2`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:46
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:47
|
||||
assert_return(() => invoke($0, `grow-t2`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:48
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:49
|
||||
assert_return(() => invoke($0, `grow-t2`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:50
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:51
|
||||
assert_return(() => invoke($0, `grow-t2`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:52
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_size.wast:54
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_size.wast:55
|
||||
assert_return(() => invoke($0, `grow-t3`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:56
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_size.wast:57
|
||||
assert_return(() => invoke($0, `grow-t3`, [3]), []);
|
||||
|
||||
// ./test/core/table_size.wast:58
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:59
|
||||
assert_return(() => invoke($0, `grow-t3`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:60
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:61
|
||||
assert_return(() => invoke($0, `grow-t3`, [2]), []);
|
||||
|
||||
// ./test/core/table_size.wast:62
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:63
|
||||
assert_return(() => invoke($0, `grow-t3`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:64
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 8)]);
|
||||
|
||||
// ./test/core/table_size.wast:69
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-empty
|
||||
(table.size $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_size.wast:78
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-f32 (result f32)
|
||||
(table.size $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
1240
js/src/jit-test/tests/wasm/spec/relaxed-simd/call_indirect.wast.js
Normal file
1240
js/src/jit-test/tests/wasm/spec/relaxed-simd/call_indirect.wast.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,157 +0,0 @@
|
||||
/* 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/custom.wast
|
||||
|
||||
// ./test/core/custom.wast:1
|
||||
let $0 = instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\24\\10" "a custom section" "this is the payload"
|
||||
"\\00\\20\\10" "a custom section" "this is payload"
|
||||
"\\00\\11\\10" "a custom section" ""
|
||||
"\\00\\10\\00" "" "this is payload"
|
||||
"\\00\\01\\00" "" ""
|
||||
"\\00\\24\\10" "\\00\\00custom sectio\\00" "this is the payload"
|
||||
"\\00\\24\\10" "\\ef\\bb\\bfa custom sect" "this is the payload"
|
||||
"\\00\\24\\10" "a custom sect\\e2\\8c\\a3" "this is the payload"
|
||||
"\\00\\1f\\16" "module within a module" "\\00asm" "\\01\\00\\00\\00"
|
||||
)`);
|
||||
|
||||
// ./test/core/custom.wast:14
|
||||
let $1 = instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\01\\01\\00" ;; type section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\02\\01\\00" ;; import section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\03\\01\\00" ;; function section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\04\\01\\00" ;; table section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\05\\01\\00" ;; memory section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\06\\01\\00" ;; global section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\07\\01\\00" ;; export section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\09\\01\\00" ;; element section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\0a\\01\\00" ;; code section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\0b\\01\\00" ;; data section
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
"\\00\\0e\\06" "custom" "payload"
|
||||
)`);
|
||||
|
||||
// ./test/core/custom.wast:50
|
||||
let $2 = instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\01\\07\\01\\60\\02\\7f\\7f\\01\\7f" ;; type section
|
||||
"\\00\\1a\\06" "custom" "this is the payload" ;; custom section
|
||||
"\\03\\02\\01\\00" ;; function section
|
||||
"\\07\\0a\\01\\06\\61\\64\\64\\54\\77\\6f\\00\\00" ;; export section
|
||||
"\\0a\\09\\01\\07\\00\\20\\00\\20\\01\\6a\\0b" ;; code section
|
||||
"\\00\\1b\\07" "custom2" "this is the payload" ;; custom section
|
||||
)`);
|
||||
|
||||
// ./test/core/custom.wast:60
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00"
|
||||
)`),
|
||||
`unexpected end`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:68
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\00"
|
||||
)`),
|
||||
`unexpected end`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:76
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\00\\00\\05\\01\\00\\07\\00\\00"
|
||||
)`),
|
||||
`unexpected end`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:84
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\26\\10" "a custom section" "this is the payload"
|
||||
)`),
|
||||
`length out of bounds`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:92
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\25\\10" "a custom section" "this is the payload"
|
||||
"\\00\\24\\10" "a custom section" "this is the payload"
|
||||
)`),
|
||||
`malformed section id`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:101
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\01\\07\\01\\60\\02\\7f\\7f\\01\\7f" ;; type section
|
||||
"\\00\\25\\10" "a custom section" "this is the payload" ;; wrong length!
|
||||
"\\03\\02\\01\\00" ;; function section
|
||||
"\\0a\\09\\01\\07\\00\\20\\00\\20\\01\\6a\\0b" ;; code section
|
||||
"\\00\\1b\\07" "custom2" "this is the payload" ;; custom section
|
||||
)`),
|
||||
`function and code section have inconsistent lengths`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:114
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm\\01\\00\\00\\00"
|
||||
"\\00asm\\01\\00\\00\\00"
|
||||
)`),
|
||||
`length out of bounds`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:122
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\05\\03\\01\\00\\01" ;; memory section
|
||||
"\\0c\\01\\02" ;; data count section (2 segments)
|
||||
"\\0b\\06\\01\\00\\41\\00\\0b\\00" ;; data section (1 segment)
|
||||
)`),
|
||||
`data count and data section have inconsistent lengths`,
|
||||
);
|
||||
@@ -1,94 +0,0 @@
|
||||
/* 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/relaxed-simd/relaxed_laneselect.wast
|
||||
|
||||
// ./test/core/relaxed-simd/relaxed_laneselect.wast:3
|
||||
let $0 = instantiate(`(module
|
||||
(func (export "i8x16.relaxed_laneselect") (param v128 v128 v128) (result v128) (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
|
||||
(func (export "i16x8.relaxed_laneselect") (param v128 v128 v128) (result v128) (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
|
||||
(func (export "i32x4.relaxed_laneselect") (param v128 v128 v128) (result v128) (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
|
||||
(func (export "i64x2.relaxed_laneselect") (param v128 v128 v128) (result v128) (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
|
||||
)`);
|
||||
|
||||
// ./test/core/relaxed-simd/relaxed_laneselect.wast:10
|
||||
assert_return(
|
||||
() => invoke($0, `i8x16.relaxed_laneselect`, [
|
||||
i8x16([0x0, 0x1, 0x12, 0x12, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
|
||||
i8x16([0x10, 0x11, 0x34, 0x34, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
|
||||
i8x16([0xff, 0x0, 0xf0, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
|
||||
]),
|
||||
[
|
||||
either(
|
||||
i8x16([0x0, 0x11, 0x14, 0x32, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
|
||||
i8x16([0x0, 0x11, 0x12, 0x34, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
// ./test/core/relaxed-simd/relaxed_laneselect.wast:17
|
||||
assert_return(
|
||||
() => invoke($0, `i16x8.relaxed_laneselect`, [
|
||||
i16x8([0x0, 0x1, 0x1234, 0x1234, 0x4, 0x5, 0x6, 0x7]),
|
||||
i16x8([0x8, 0x9, 0x5678, 0x5678, 0xc, 0xd, 0xe, 0xf]),
|
||||
i16x8([0xffff, 0x0, 0xff00, 0xff, 0x0, 0x0, 0x0, 0x0]),
|
||||
]),
|
||||
[
|
||||
either(
|
||||
i16x8([0x0, 0x9, 0x1278, 0x5634, 0xc, 0xd, 0xe, 0xf]),
|
||||
i16x8([0x0, 0x9, 0x1234, 0x5678, 0xc, 0xd, 0xe, 0xf]),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
// ./test/core/relaxed-simd/relaxed_laneselect.wast:24
|
||||
assert_return(
|
||||
() => invoke($0, `i32x4.relaxed_laneselect`, [
|
||||
i32x4([0x0, 0x1, 0x12341234, 0x12341234]),
|
||||
i32x4([0x4, 0x5, 0x56785678, 0x56785678]),
|
||||
i32x4([0xffffffff, 0x0, 0xffff0000, 0xffff]),
|
||||
]),
|
||||
[
|
||||
either(
|
||||
i32x4([0x0, 0x5, 0x12345678, 0x56781234]),
|
||||
i32x4([0x0, 0x5, 0x12341234, 0x56785678]),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
// ./test/core/relaxed-simd/relaxed_laneselect.wast:31
|
||||
assert_return(
|
||||
() => invoke($0, `i64x2.relaxed_laneselect`, [
|
||||
i64x2([0x0n, 0x1n]),
|
||||
i64x2([0x2n, 0x3n]),
|
||||
i64x2([0xffffffffffffffffn, 0x0n]),
|
||||
]),
|
||||
[either(i64x2([0x0n, 0x3n]), i64x2([0x0n, 0x3n]))],
|
||||
);
|
||||
|
||||
// ./test/core/relaxed-simd/relaxed_laneselect.wast:38
|
||||
assert_return(
|
||||
() => invoke($0, `i64x2.relaxed_laneselect`, [
|
||||
i64x2([0x1234123412341234n, 0x1234123412341234n]),
|
||||
i64x2([0x5678567856785678n, 0x5678567856785678n]),
|
||||
i64x2([0xffffffff00000000n, 0xffffffffn]),
|
||||
]),
|
||||
[
|
||||
either(
|
||||
i64x2([0x1234123456785678n, 0x5678567812341234n]),
|
||||
i64x2([0x1234123412341234n, 0x5678567856785678n]),
|
||||
),
|
||||
],
|
||||
);
|
||||
4347
js/src/jit-test/tests/wasm/spec/relaxed-simd/simd_lane.wast.js
Normal file
4347
js/src/jit-test/tests/wasm/spec/relaxed-simd/simd_lane.wast.js
Normal file
File diff suppressed because it is too large
Load Diff
234
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_fill.wast.js
Normal file
234
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_fill.wast.js
Normal file
@@ -0,0 +1,234 @@
|
||||
/* 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/table_fill.wast
|
||||
|
||||
// ./test/core/table_fill.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
|
||||
(func (export "fill") (param $$i i32) (param $$r externref) (param $$n i32)
|
||||
(table.fill $$t (local.get $$i) (local.get $$r) (local.get $$n))
|
||||
)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref)
|
||||
(table.get $$t (local.get $$i))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_fill.wast:13
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:14
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:15
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:16
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:17
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:19
|
||||
assert_return(() => invoke($0, `fill`, [2, externref(1), 3]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:20
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:21
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:22
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:23
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:24
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:26
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(2), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:27
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:28
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:29
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:30
|
||||
assert_return(() => invoke($0, `get`, [6]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:32
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(3), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:33
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:34
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:35
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:37
|
||||
assert_return(() => invoke($0, `fill`, [8, externref(4), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:38
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:39
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:40
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:42
|
||||
assert_return(() => invoke($0, `fill`, [9, null, 1]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:43
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:44
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:46
|
||||
assert_return(() => invoke($0, `fill`, [10, externref(5), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:47
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:49
|
||||
assert_trap(() => invoke($0, `fill`, [8, externref(6), 3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:53
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:54
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:55
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:57
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:62
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 10]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:70
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-value-length-empty-vs-i32-i32
|
||||
(table.fill $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:79
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32
|
||||
(table.fill $$t (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:88
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-value-empty-vs
|
||||
(table.fill $$t (i32.const 1) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:97
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-length-empty-vs-i32
|
||||
(table.fill $$t (i32.const 1) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:106
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-index-f32-vs-i32
|
||||
(table.fill $$t (f32.const 1) (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:115
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
(func $$type-value-vs-funcref (param $$r externref)
|
||||
(table.fill $$t (i32.const 1) (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:124
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-length-f32-vs-i32
|
||||
(table.fill $$t (i32.const 1) (ref.null extern) (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:134
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 1 funcref)
|
||||
(func $$type-value-externref-vs-funcref-multi (param $$r externref)
|
||||
(table.fill $$t2 (i32.const 0) (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:145
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-empty-vs-num (result i32)
|
||||
(table.fill $$t (i32.const 0) (ref.null extern) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
126
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_get.wast.js
Normal file
126
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_get.wast.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/* 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/table_get.wast
|
||||
|
||||
// ./test/core/table_get.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t2 2 externref)
|
||||
(table $$t3 3 funcref)
|
||||
(elem (table $$t3) (i32.const 1) func $$dummy)
|
||||
(func $$dummy)
|
||||
|
||||
(func (export "init") (param $$r externref)
|
||||
(table.set $$t2 (i32.const 1) (local.get $$r))
|
||||
(table.set $$t3 (i32.const 2) (table.get $$t3 (i32.const 1)))
|
||||
)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
)
|
||||
|
||||
(func (export "is_null-funcref") (param $$i i32) (result i32)
|
||||
(ref.is_null (call $$f3 (local.get $$i)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_get.wast:24
|
||||
invoke($0, `init`, [externref(1)]);
|
||||
|
||||
// ./test/core/table_get.wast:26
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_get.wast:27
|
||||
assert_return(() => invoke($0, `get-externref`, [1]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_get.wast:29
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_get.wast:30
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_get.wast:31
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [2]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_get.wast:33
|
||||
assert_trap(() => invoke($0, `get-externref`, [2]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:34
|
||||
assert_trap(() => invoke($0, `get-funcref`, [3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:35
|
||||
assert_trap(() => invoke($0, `get-externref`, [-1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:36
|
||||
assert_trap(() => invoke($0, `get-funcref`, [-1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_get.wast:41
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32 (result externref)
|
||||
(table.get $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:50
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-f32-vs-i32 (result externref)
|
||||
(table.get $$t (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:60
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-externref-vs-empty
|
||||
(table.get $$t (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:69
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-externref-vs-funcref (result funcref)
|
||||
(table.get $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_get.wast:79
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 funcref)
|
||||
(table $$t2 1 externref)
|
||||
(func $$type-result-externref-vs-funcref-multi (result funcref)
|
||||
(table.get $$t2 (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
268
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_grow.wast.js
Normal file
268
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_grow.wast.js
Normal file
@@ -0,0 +1,268 @@
|
||||
/* 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/table_grow.wast
|
||||
|
||||
// ./test/core/table_grow.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref) (table.get $$t (local.get $$i)))
|
||||
(func (export "set") (param $$i i32) (param $$r externref) (table.set $$t (local.get $$i) (local.get $$r)))
|
||||
|
||||
(func (export "grow") (param $$sz i32) (param $$init externref) (result i32)
|
||||
(table.grow $$t (local.get $$init) (local.get $$sz))
|
||||
)
|
||||
(func (export "size") (result i32) (table.size $$t))
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:13
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:14
|
||||
assert_trap(() => invoke($0, `set`, [0, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:15
|
||||
assert_trap(() => invoke($0, `get`, [0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:17
|
||||
assert_return(() => invoke($0, `grow`, [1, null]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:18
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:19
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:20
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:21
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:22
|
||||
assert_trap(() => invoke($0, `set`, [1, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:23
|
||||
assert_trap(() => invoke($0, `get`, [1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:25
|
||||
assert_return(() => invoke($0, `grow`, [4, externref(3)]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:26
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_grow.wast:27
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:28
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:29
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:30
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:31
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:32
|
||||
assert_return(() => invoke($0, `set`, [4, externref(4)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:33
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_grow.wast:34
|
||||
assert_trap(() => invoke($0, `set`, [5, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:35
|
||||
assert_trap(() => invoke($0, `get`, [5]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:39
|
||||
let $1 = instantiate(`(module
|
||||
(table $$t 0x10 funcref)
|
||||
(elem declare func $$f)
|
||||
(func $$f (export "grow") (result i32)
|
||||
(table.grow $$t (ref.func $$f) (i32.const 0xffff_fff0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:47
|
||||
assert_return(() => invoke($1, `grow`, []), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:50
|
||||
let $2 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null extern) (local.get 0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:57
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:58
|
||||
assert_return(() => invoke($2, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:59
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:60
|
||||
assert_return(() => invoke($2, `grow`, [2]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:61
|
||||
assert_return(() => invoke($2, `grow`, [800]), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_grow.wast:64
|
||||
let $3 = instantiate(`(module
|
||||
(table $$t 0 10 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null extern) (local.get 0))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:71
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:72
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:73
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:74
|
||||
assert_return(() => invoke($3, `grow`, [2]), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_grow.wast:75
|
||||
assert_return(() => invoke($3, `grow`, [6]), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_grow.wast:76
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:77
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:78
|
||||
assert_return(() => invoke($3, `grow`, [65536]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:81
|
||||
let $4 = instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
(table.grow $$t (ref.null func) (local.get 0))
|
||||
)
|
||||
(elem declare func 1)
|
||||
(func (export "check-table-null") (param i32 i32) (result funcref)
|
||||
(local funcref)
|
||||
(local.set 2 (ref.func 1))
|
||||
(block
|
||||
(loop
|
||||
(local.set 2 (table.get $$t (local.get 0)))
|
||||
(br_if 1 (i32.eqz (ref.is_null (local.get 2))))
|
||||
(br_if 1 (i32.ge_u (local.get 0) (local.get 1)))
|
||||
(local.set 0 (i32.add (local.get 0) (i32.const 1)))
|
||||
(br_if 0 (i32.le_u (local.get 0) (local.get 1)))
|
||||
)
|
||||
)
|
||||
(local.get 2)
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:103
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 9]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:104
|
||||
assert_return(() => invoke($4, `grow`, [10]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:105
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 19]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:110
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-init-size-empty-vs-i32-externref (result i32)
|
||||
(table.grow $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:119
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-size-empty-vs-i32 (result i32)
|
||||
(table.grow $$t (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:128
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-init-empty-vs-externref (result i32)
|
||||
(table.grow $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:137
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func $$type-size-f32-vs-i32 (result i32)
|
||||
(table.grow $$t (ref.null extern) (f32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:146
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
(func $$type-init-externref-vs-funcref (param $$r externref) (result i32)
|
||||
(table.grow $$t (local.get $$r) (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:156
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-empty
|
||||
(table.grow $$t (ref.null extern) (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:165
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-f32 (result f32)
|
||||
(table.grow $$t (ref.null extern) (i32.const 0))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
177
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_set.wast.js
Normal file
177
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_set.wast.js
Normal file
@@ -0,0 +1,177 @@
|
||||
/* 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/table_set.wast
|
||||
|
||||
// ./test/core/table_set.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t2 1 externref)
|
||||
(table $$t3 2 funcref)
|
||||
(elem (table $$t3) (i32.const 1) func $$dummy)
|
||||
(func $$dummy)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
)
|
||||
|
||||
(func (export "set-externref") (param $$i i32) (param $$r externref)
|
||||
(table.set $$t2 (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref") (param $$i i32) (param $$r funcref)
|
||||
(table.set $$t3 (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref-from") (param $$i i32) (param $$j i32)
|
||||
(table.set $$t3 (local.get $$i) (table.get $$t3 (local.get $$j)))
|
||||
)
|
||||
|
||||
(func (export "is_null-funcref") (param $$i i32) (result i32)
|
||||
(ref.is_null (call $$f3 (local.get $$i)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_set.wast:29
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:30
|
||||
assert_return(() => invoke($0, `set-externref`, [0, externref(1)]), []);
|
||||
|
||||
// ./test/core/table_set.wast:31
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_set.wast:32
|
||||
assert_return(() => invoke($0, `set-externref`, [0, null]), []);
|
||||
|
||||
// ./test/core/table_set.wast:33
|
||||
assert_return(() => invoke($0, `get-externref`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:35
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:36
|
||||
assert_return(() => invoke($0, `set-funcref-from`, [0, 1]), []);
|
||||
|
||||
// ./test/core/table_set.wast:37
|
||||
assert_return(() => invoke($0, `is_null-funcref`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_set.wast:38
|
||||
assert_return(() => invoke($0, `set-funcref`, [0, null]), []);
|
||||
|
||||
// ./test/core/table_set.wast:39
|
||||
assert_return(() => invoke($0, `get-funcref`, [0]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_set.wast:41
|
||||
assert_trap(() => invoke($0, `set-externref`, [2, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:42
|
||||
assert_trap(() => invoke($0, `set-funcref`, [3, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:43
|
||||
assert_trap(() => invoke($0, `set-externref`, [-1, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:44
|
||||
assert_trap(() => invoke($0, `set-funcref`, [-1, null]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:46
|
||||
assert_trap(() => invoke($0, `set-externref`, [2, externref(0)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:47
|
||||
assert_trap(() => invoke($0, `set-funcref-from`, [3, 1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:48
|
||||
assert_trap(() => invoke($0, `set-externref`, [-1, externref(0)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:49
|
||||
assert_trap(() => invoke($0, `set-funcref-from`, [-1, 1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_set.wast:54
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-value-empty-vs-i32-externref
|
||||
(table.set $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:63
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-index-empty-vs-i32
|
||||
(table.set $$t (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:72
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-value-empty-vs-externref
|
||||
(table.set $$t (i32.const 1))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:81
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-size-f32-vs-i32
|
||||
(table.set $$t (f32.const 1) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:90
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func $$type-value-externref-vs-funcref (param $$r externref)
|
||||
(table.set $$t (i32.const 1) (local.get $$r))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:100
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 1 funcref)
|
||||
(func $$type-value-externref-vs-funcref-multi (param $$r externref)
|
||||
(table.set $$t2 (i32.const 0) (local.get $$r))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_set.wast:111
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
(func $$type-result-empty-vs-num (result i32)
|
||||
(table.set $$t (i32.const 0) (ref.null extern))
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
172
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_size.wast.js
Normal file
172
js/src/jit-test/tests/wasm/spec/relaxed-simd/table_size.wast.js
Normal file
@@ -0,0 +1,172 @@
|
||||
/* 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/table_size.wast
|
||||
|
||||
// ./test/core/table_size.wast:1
|
||||
let $0 = instantiate(`(module
|
||||
(table $$t0 0 externref)
|
||||
(table $$t1 1 externref)
|
||||
(table $$t2 0 2 externref)
|
||||
(table $$t3 3 8 externref)
|
||||
|
||||
(func (export "size-t0") (result i32) (table.size $$t0))
|
||||
(func (export "size-t1") (result i32) (table.size $$t1))
|
||||
(func (export "size-t2") (result i32) (table.size $$t2))
|
||||
(func (export "size-t3") (result i32) (table.size $$t3))
|
||||
|
||||
(func (export "grow-t0") (param $$sz i32)
|
||||
(drop (table.grow $$t0 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t1") (param $$sz i32)
|
||||
(drop (table.grow $$t1 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t2") (param $$sz i32)
|
||||
(drop (table.grow $$t2 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
(func (export "grow-t3") (param $$sz i32)
|
||||
(drop (table.grow $$t3 (ref.null extern) (local.get $$sz)))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_size.wast:26
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:27
|
||||
assert_return(() => invoke($0, `grow-t0`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:28
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:29
|
||||
assert_return(() => invoke($0, `grow-t0`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:30
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_size.wast:31
|
||||
assert_return(() => invoke($0, `grow-t0`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:32
|
||||
assert_return(() => invoke($0, `size-t0`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_size.wast:34
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:35
|
||||
assert_return(() => invoke($0, `grow-t1`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:36
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_size.wast:37
|
||||
assert_return(() => invoke($0, `grow-t1`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:38
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/table_size.wast:39
|
||||
assert_return(() => invoke($0, `grow-t1`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:40
|
||||
assert_return(() => invoke($0, `size-t1`, []), [value("i32", 6)]);
|
||||
|
||||
// ./test/core/table_size.wast:42
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:43
|
||||
assert_return(() => invoke($0, `grow-t2`, [3]), []);
|
||||
|
||||
// ./test/core/table_size.wast:44
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_size.wast:45
|
||||
assert_return(() => invoke($0, `grow-t2`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:46
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:47
|
||||
assert_return(() => invoke($0, `grow-t2`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:48
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:49
|
||||
assert_return(() => invoke($0, `grow-t2`, [4]), []);
|
||||
|
||||
// ./test/core/table_size.wast:50
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_size.wast:51
|
||||
assert_return(() => invoke($0, `grow-t2`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:52
|
||||
assert_return(() => invoke($0, `size-t2`, []), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_size.wast:54
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_size.wast:55
|
||||
assert_return(() => invoke($0, `grow-t3`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:56
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_size.wast:57
|
||||
assert_return(() => invoke($0, `grow-t3`, [3]), []);
|
||||
|
||||
// ./test/core/table_size.wast:58
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:59
|
||||
assert_return(() => invoke($0, `grow-t3`, [0]), []);
|
||||
|
||||
// ./test/core/table_size.wast:60
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:61
|
||||
assert_return(() => invoke($0, `grow-t3`, [2]), []);
|
||||
|
||||
// ./test/core/table_size.wast:62
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 7)]);
|
||||
|
||||
// ./test/core/table_size.wast:63
|
||||
assert_return(() => invoke($0, `grow-t3`, [1]), []);
|
||||
|
||||
// ./test/core/table_size.wast:64
|
||||
assert_return(() => invoke($0, `size-t3`, []), [value("i32", 8)]);
|
||||
|
||||
// ./test/core/table_size.wast:69
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-empty
|
||||
(table.size $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_size.wast:78
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
(func $$type-result-i32-vs-f32 (result f32)
|
||||
(table.size $$t)
|
||||
)
|
||||
)`),
|
||||
`type mismatch`,
|
||||
);
|
||||
@@ -1238,3 +1238,19 @@ assert_invalid(
|
||||
() => instantiate(`(module (table funcref (elem 0 0)))`),
|
||||
`unknown function`,
|
||||
);
|
||||
|
||||
// ./test/core/call_indirect.wast:1024
|
||||
let $2 = instantiate(`(module
|
||||
(table 1 funcref)
|
||||
(func unreachable call_indirect)
|
||||
(func unreachable call_indirect nop)
|
||||
(func unreachable call_indirect call_indirect)
|
||||
(func unreachable call_indirect (call_indirect))
|
||||
(func unreachable call_indirect call_indirect call_indirect)
|
||||
(func unreachable call_indirect (result))
|
||||
(func unreachable call_indirect (result) (result))
|
||||
(func unreachable call_indirect (result) (result) call_indirect)
|
||||
(func unreachable call_indirect (result) (result) call_indirect (result))
|
||||
(func (result i32) unreachable call_indirect select)
|
||||
(func (result i32) unreachable call_indirect select call_indirect)
|
||||
)`);
|
||||
|
||||
@@ -110,7 +110,7 @@ assert_malformed(
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
"\\00\\26\\10" "a custom section" "this is the payload"
|
||||
)`),
|
||||
`unexpected end`,
|
||||
`length out of bounds`,
|
||||
);
|
||||
|
||||
// ./test/core/custom.wast:92
|
||||
|
||||
@@ -477,29 +477,41 @@ assert_invalid(
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:351
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (i32.const 0)) (global i32 (global.get 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:355
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global $$g i32 (i32.const 0)) (global i32 (global.get $$g)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:360
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global i32 (global.get 1)) (global i32 (i32.const 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:356
|
||||
// ./test/core/global.wast:365
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "test" "global-i32") i32) (global i32 (global.get 2)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:361
|
||||
// ./test/core/global.wast:370
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (global (import "test" "global-mut-i32") (mut i32)) (global i32 (global.get 0)))`),
|
||||
`constant expression required`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:366
|
||||
// ./test/core/global.wast:375
|
||||
let $3 = instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
)`);
|
||||
|
||||
// ./test/core/global.wast:369
|
||||
// ./test/core/global.wast:378
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -514,7 +526,7 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:382
|
||||
// ./test/core/global.wast:391
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -529,12 +541,12 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:396
|
||||
// ./test/core/global.wast:405
|
||||
let $4 = instantiate(`(module
|
||||
(global i32 (i32.const 0))
|
||||
)`);
|
||||
|
||||
// ./test/core/global.wast:399
|
||||
// ./test/core/global.wast:408
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -548,7 +560,7 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:411
|
||||
// ./test/core/global.wast:420
|
||||
assert_malformed(
|
||||
() => instantiate(`(module binary
|
||||
"\\00asm" "\\01\\00\\00\\00"
|
||||
@@ -562,13 +574,13 @@ assert_malformed(
|
||||
`malformed mutability`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:425
|
||||
// ./test/core/global.wast:434
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (result i32) (global.get 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:430
|
||||
// ./test/core/global.wast:439
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global i32 (i32.const 0))
|
||||
@@ -577,7 +589,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:438
|
||||
// ./test/core/global.wast:447
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -586,7 +598,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:446
|
||||
// ./test/core/global.wast:455
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -596,13 +608,13 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:456
|
||||
// ./test/core/global.wast:465
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (i32.const 0) (global.set 0)))`),
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:461
|
||||
// ./test/core/global.wast:470
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global i32 (i32.const 0))
|
||||
@@ -611,7 +623,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:469
|
||||
// ./test/core/global.wast:478
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -620,7 +632,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:477
|
||||
// ./test/core/global.wast:486
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(import "spectest" "global_i32" (global i32))
|
||||
@@ -630,7 +642,7 @@ assert_invalid(
|
||||
`unknown global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:487
|
||||
// ./test/core/global.wast:496
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -641,7 +653,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:496
|
||||
// ./test/core/global.wast:505
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -653,7 +665,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:506
|
||||
// ./test/core/global.wast:515
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -665,7 +677,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:516
|
||||
// ./test/core/global.wast:525
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -677,7 +689,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:526
|
||||
// ./test/core/global.wast:535
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -689,7 +701,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:536
|
||||
// ./test/core/global.wast:545
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -701,7 +713,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:546
|
||||
// ./test/core/global.wast:555
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -713,7 +725,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:556
|
||||
// ./test/core/global.wast:565
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -725,7 +737,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:566
|
||||
// ./test/core/global.wast:575
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -736,7 +748,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:575
|
||||
// ./test/core/global.wast:584
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -747,7 +759,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:584
|
||||
// ./test/core/global.wast:593
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -759,7 +771,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:594
|
||||
// ./test/core/global.wast:603
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(global $$x (mut i32) (i32.const 0))
|
||||
@@ -777,19 +789,19 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:613
|
||||
// ./test/core/global.wast:622
|
||||
assert_malformed(
|
||||
() => instantiate(`(global $$foo i32 (i32.const 0)) (global $$foo i32 (i32.const 0)) `),
|
||||
`duplicate global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:617
|
||||
// ./test/core/global.wast:626
|
||||
assert_malformed(
|
||||
() => instantiate(`(import "" "" (global $$foo i32)) (global $$foo i32 (i32.const 0)) `),
|
||||
`duplicate global`,
|
||||
);
|
||||
|
||||
// ./test/core/global.wast:621
|
||||
// ./test/core/global.wast:630
|
||||
assert_malformed(
|
||||
() => instantiate(`(import "" "" (global $$foo i32)) (import "" "" (global $$foo i32)) `),
|
||||
`duplicate global`,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2692,13 +2692,13 @@ assert_invalid(
|
||||
|
||||
// ./test/core/simd/simd_lane.wast:450
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (result v128) (f32x4.replace_lane 4 (v128.const f32x4 0 0 0 0) (i32.const 1))))`),
|
||||
() => instantiate(`(module (func (result v128) (f32x4.replace_lane 4 (v128.const f32x4 0 0 0 0) (f32.const 1))))`),
|
||||
`invalid lane index`,
|
||||
);
|
||||
|
||||
// ./test/core/simd/simd_lane.wast:451
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (result v128) (f32x4.replace_lane 255 (v128.const f32x4 0 0 0 0) (i32.const 1))))`),
|
||||
() => instantiate(`(module (func (result v128) (f32x4.replace_lane 255 (v128.const f32x4 0 0 0 0) (f32.const 1))))`),
|
||||
`invalid lane index`,
|
||||
);
|
||||
|
||||
@@ -2788,7 +2788,7 @@ assert_invalid(
|
||||
|
||||
// ./test/core/simd/simd_lane.wast:469
|
||||
assert_invalid(
|
||||
() => instantiate(`(module (func (result v128) (f32x4.replace_lane 4 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1))))`),
|
||||
() => instantiate(`(module (func (result v128) (f32x4.replace_lane 4 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (f32.const 1))))`),
|
||||
`invalid lane index`,
|
||||
);
|
||||
|
||||
|
||||
@@ -23,117 +23,121 @@ let $0 = instantiate(`(module
|
||||
(table.fill $$t (local.get $$i) (local.get $$r) (local.get $$n))
|
||||
)
|
||||
|
||||
(func (export "fill-abbrev") (param $$i i32) (param $$r externref) (param $$n i32)
|
||||
(table.fill (local.get $$i) (local.get $$r) (local.get $$n))
|
||||
)
|
||||
|
||||
(func (export "get") (param $$i i32) (result externref)
|
||||
(table.get $$t (local.get $$i))
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_fill.wast:13
|
||||
// ./test/core/table_fill.wast:17
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:14
|
||||
// ./test/core/table_fill.wast:18
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:15
|
||||
// ./test/core/table_fill.wast:19
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:16
|
||||
// ./test/core/table_fill.wast:20
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:17
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:19
|
||||
assert_return(() => invoke($0, `fill`, [2, externref(1), 3]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:20
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:21
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:22
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:23
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(1))]);
|
||||
assert_return(() => invoke($0, `fill`, [2, externref(1), 3]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:24
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:25
|
||||
assert_return(() => invoke($0, `get`, [2]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:26
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(2), 2]), []);
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:27
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:28
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:29
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:30
|
||||
assert_return(() => invoke($0, `get`, [6]), [value('externref', null)]);
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(2), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:32
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(3), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:33
|
||||
// ./test/core/table_fill.wast:31
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:34
|
||||
// ./test/core/table_fill.wast:32
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:35
|
||||
// ./test/core/table_fill.wast:33
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:34
|
||||
assert_return(() => invoke($0, `get`, [6]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:36
|
||||
assert_return(() => invoke($0, `fill`, [4, externref(3), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:37
|
||||
assert_return(() => invoke($0, `fill`, [8, externref(4), 2]), []);
|
||||
assert_return(() => invoke($0, `get`, [3]), [value('externref', externref(1))]);
|
||||
|
||||
// ./test/core/table_fill.wast:38
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:39
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
assert_return(() => invoke($0, `get`, [5]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_fill.wast:40
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', externref(4))]);
|
||||
// ./test/core/table_fill.wast:41
|
||||
assert_return(() => invoke($0, `fill`, [8, externref(4), 2]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:42
|
||||
assert_return(() => invoke($0, `fill`, [9, null, 1]), []);
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:43
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:44
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:46
|
||||
assert_return(() => invoke($0, `fill`, [10, externref(5), 0]), []);
|
||||
assert_return(() => invoke($0, `fill-abbrev`, [9, null, 1]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:47
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:49
|
||||
assert_trap(() => invoke($0, `fill`, [8, externref(6), 3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:53
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:54
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:55
|
||||
// ./test/core/table_fill.wast:48
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:50
|
||||
assert_return(() => invoke($0, `fill`, [10, externref(5), 0]), []);
|
||||
|
||||
// ./test/core/table_fill.wast:51
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:53
|
||||
assert_trap(() => invoke($0, `fill`, [8, externref(6), 3]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:57
|
||||
assert_return(() => invoke($0, `get`, [7]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:58
|
||||
assert_return(() => invoke($0, `get`, [8]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_fill.wast:59
|
||||
assert_return(() => invoke($0, `get`, [9]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_fill.wast:61
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:62
|
||||
// ./test/core/table_fill.wast:66
|
||||
assert_trap(() => invoke($0, `fill`, [11, null, 10]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_fill.wast:70
|
||||
// ./test/core/table_fill.wast:74
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
@@ -144,7 +148,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:79
|
||||
// ./test/core/table_fill.wast:83
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
@@ -155,7 +159,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:88
|
||||
// ./test/core/table_fill.wast:92
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
@@ -166,7 +170,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:97
|
||||
// ./test/core/table_fill.wast:101
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 10 externref)
|
||||
@@ -177,7 +181,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:106
|
||||
// ./test/core/table_fill.wast:110
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
@@ -188,7 +192,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:115
|
||||
// ./test/core/table_fill.wast:119
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
@@ -199,7 +203,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:124
|
||||
// ./test/core/table_fill.wast:128
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
@@ -210,7 +214,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:134
|
||||
// ./test/core/table_fill.wast:138
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t1 1 externref)
|
||||
@@ -222,7 +226,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_fill.wast:145
|
||||
// ./test/core/table_fill.wast:149
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
|
||||
@@ -28,7 +28,7 @@ let $0 = instantiate(`(module
|
||||
)
|
||||
|
||||
(func (export "get-externref") (param $$i i32) (result externref)
|
||||
(table.get $$t2 (local.get $$i))
|
||||
(table.get (local.get $$i))
|
||||
)
|
||||
(func $$f3 (export "get-funcref") (param $$i i32) (result funcref)
|
||||
(table.get $$t3 (local.get $$i))
|
||||
|
||||
@@ -25,73 +25,76 @@ let $0 = instantiate(`(module
|
||||
(func (export "grow") (param $$sz i32) (param $$init externref) (result i32)
|
||||
(table.grow $$t (local.get $$init) (local.get $$sz))
|
||||
)
|
||||
(func (export "grow-abbrev") (param $$sz i32) (param $$init externref) (result i32)
|
||||
(table.grow (local.get $$init) (local.get $$sz))
|
||||
)
|
||||
(func (export "size") (result i32) (table.size $$t))
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:13
|
||||
// ./test/core/table_grow.wast:16
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:14
|
||||
// ./test/core/table_grow.wast:17
|
||||
assert_trap(() => invoke($0, `set`, [0, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:15
|
||||
// ./test/core/table_grow.wast:18
|
||||
assert_trap(() => invoke($0, `get`, [0]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:17
|
||||
// ./test/core/table_grow.wast:20
|
||||
assert_return(() => invoke($0, `grow`, [1, null]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:18
|
||||
// ./test/core/table_grow.wast:21
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:19
|
||||
// ./test/core/table_grow.wast:22
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:20
|
||||
// ./test/core/table_grow.wast:23
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:21
|
||||
// ./test/core/table_grow.wast:24
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:22
|
||||
assert_trap(() => invoke($0, `set`, [1, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:23
|
||||
assert_trap(() => invoke($0, `get`, [1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:25
|
||||
assert_return(() => invoke($0, `grow`, [4, externref(3)]), [value("i32", 1)]);
|
||||
assert_trap(() => invoke($0, `set`, [1, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:26
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_grow.wast:27
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
assert_trap(() => invoke($0, `get`, [1]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:28
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
assert_return(() => invoke($0, `grow-abbrev`, [4, externref(3)]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:29
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
assert_return(() => invoke($0, `size`, []), [value("i32", 5)]);
|
||||
|
||||
// ./test/core/table_grow.wast:30
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', externref(3))]);
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:31
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(3))]);
|
||||
assert_return(() => invoke($0, `set`, [0, externref(2)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:32
|
||||
assert_return(() => invoke($0, `set`, [4, externref(4)]), []);
|
||||
assert_return(() => invoke($0, `get`, [0]), [value('externref', externref(2))]);
|
||||
|
||||
// ./test/core/table_grow.wast:33
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(4))]);
|
||||
assert_return(() => invoke($0, `get`, [1]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:34
|
||||
assert_trap(() => invoke($0, `set`, [5, externref(2)]), `out of bounds table access`);
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(3))]);
|
||||
|
||||
// ./test/core/table_grow.wast:35
|
||||
assert_return(() => invoke($0, `set`, [4, externref(4)]), []);
|
||||
|
||||
// ./test/core/table_grow.wast:36
|
||||
assert_return(() => invoke($0, `get`, [4]), [value('externref', externref(4))]);
|
||||
|
||||
// ./test/core/table_grow.wast:37
|
||||
assert_trap(() => invoke($0, `set`, [5, externref(2)]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:38
|
||||
assert_trap(() => invoke($0, `get`, [5]), `out of bounds table access`);
|
||||
|
||||
// ./test/core/table_grow.wast:39
|
||||
// ./test/core/table_grow.wast:42
|
||||
let $1 = instantiate(`(module
|
||||
(table $$t 0x10 funcref)
|
||||
(elem declare func $$f)
|
||||
@@ -100,10 +103,10 @@ let $1 = instantiate(`(module
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:47
|
||||
// ./test/core/table_grow.wast:50
|
||||
assert_return(() => invoke($1, `grow`, []), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:50
|
||||
// ./test/core/table_grow.wast:53
|
||||
let $2 = instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
@@ -111,22 +114,22 @@ let $2 = instantiate(`(module
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:57
|
||||
// ./test/core/table_grow.wast:60
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:58
|
||||
// ./test/core/table_grow.wast:61
|
||||
assert_return(() => invoke($2, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:59
|
||||
// ./test/core/table_grow.wast:62
|
||||
assert_return(() => invoke($2, `grow`, [0]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:60
|
||||
// ./test/core/table_grow.wast:63
|
||||
assert_return(() => invoke($2, `grow`, [2]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:61
|
||||
// ./test/core/table_grow.wast:64
|
||||
assert_return(() => invoke($2, `grow`, [800]), [value("i32", 3)]);
|
||||
|
||||
// ./test/core/table_grow.wast:64
|
||||
// ./test/core/table_grow.wast:67
|
||||
let $3 = instantiate(`(module
|
||||
(table $$t 0 10 externref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
@@ -134,31 +137,31 @@ let $3 = instantiate(`(module
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:71
|
||||
// ./test/core/table_grow.wast:74
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:72
|
||||
// ./test/core/table_grow.wast:75
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 0)]);
|
||||
|
||||
// ./test/core/table_grow.wast:73
|
||||
// ./test/core/table_grow.wast:76
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", 1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:74
|
||||
// ./test/core/table_grow.wast:77
|
||||
assert_return(() => invoke($3, `grow`, [2]), [value("i32", 2)]);
|
||||
|
||||
// ./test/core/table_grow.wast:75
|
||||
// ./test/core/table_grow.wast:78
|
||||
assert_return(() => invoke($3, `grow`, [6]), [value("i32", 4)]);
|
||||
|
||||
// ./test/core/table_grow.wast:76
|
||||
// ./test/core/table_grow.wast:79
|
||||
assert_return(() => invoke($3, `grow`, [0]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:77
|
||||
// ./test/core/table_grow.wast:80
|
||||
assert_return(() => invoke($3, `grow`, [1]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:78
|
||||
// ./test/core/table_grow.wast:81
|
||||
assert_return(() => invoke($3, `grow`, [65536]), [value("i32", -1)]);
|
||||
|
||||
// ./test/core/table_grow.wast:81
|
||||
// ./test/core/table_grow.wast:84
|
||||
let $4 = instantiate(`(module
|
||||
(table $$t 10 funcref)
|
||||
(func (export "grow") (param i32) (result i32)
|
||||
@@ -181,16 +184,16 @@ let $4 = instantiate(`(module
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/table_grow.wast:103
|
||||
// ./test/core/table_grow.wast:106
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 9]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:104
|
||||
// ./test/core/table_grow.wast:107
|
||||
assert_return(() => invoke($4, `grow`, [10]), [value("i32", 10)]);
|
||||
|
||||
// ./test/core/table_grow.wast:105
|
||||
// ./test/core/table_grow.wast:108
|
||||
assert_return(() => invoke($4, `check-table-null`, [0, 19]), [value('anyfunc', null)]);
|
||||
|
||||
// ./test/core/table_grow.wast:110
|
||||
// ./test/core/table_grow.wast:113
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
@@ -201,7 +204,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:119
|
||||
// ./test/core/table_grow.wast:122
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
@@ -212,7 +215,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:128
|
||||
// ./test/core/table_grow.wast:131
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
@@ -223,7 +226,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:137
|
||||
// ./test/core/table_grow.wast:140
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 externref)
|
||||
@@ -234,7 +237,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:146
|
||||
// ./test/core/table_grow.wast:149
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 0 funcref)
|
||||
@@ -245,7 +248,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:156
|
||||
// ./test/core/table_grow.wast:159
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
@@ -256,7 +259,7 @@ assert_invalid(
|
||||
`type mismatch`,
|
||||
);
|
||||
|
||||
// ./test/core/table_grow.wast:165
|
||||
// ./test/core/table_grow.wast:168
|
||||
assert_invalid(
|
||||
() => instantiate(`(module
|
||||
(table $$t 1 externref)
|
||||
|
||||
@@ -30,7 +30,7 @@ let $0 = instantiate(`(module
|
||||
)
|
||||
|
||||
(func (export "set-externref") (param $$i i32) (param $$r externref)
|
||||
(table.set $$t2 (local.get $$i) (local.get $$r))
|
||||
(table.set (local.get $$i) (local.get $$r))
|
||||
)
|
||||
(func (export "set-funcref") (param $$i i32) (param $$r funcref)
|
||||
(table.set $$t3 (local.get $$i) (local.get $$r))
|
||||
|
||||
@@ -22,7 +22,7 @@ let $0 = instantiate(`(module
|
||||
(table $$t2 0 2 externref)
|
||||
(table $$t3 3 8 externref)
|
||||
|
||||
(func (export "size-t0") (result i32) (table.size $$t0))
|
||||
(func (export "size-t0") (result i32) table.size)
|
||||
(func (export "size-t1") (result i32) (table.size $$t1))
|
||||
(func (export "size-t2") (result i32) (table.size $$t2))
|
||||
(func (export "size-t3") (result i32) (table.size $$t3))
|
||||
|
||||
@@ -83,3 +83,6 @@ let $1 = instantiate(`(module
|
||||
(drop)
|
||||
)
|
||||
)`);
|
||||
|
||||
// ./test/core/unreached-valid.wast:63
|
||||
assert_trap(() => invoke($1, `meet-bottom`, []), `unreachable`);
|
||||
|
||||
@@ -311,33 +311,33 @@ class MOZ_STACK_CLASS InitExprInterpreter {
|
||||
bool evalRefNull(RefType type) { return pushRef(type, AnyRef::null()); }
|
||||
#ifdef ENABLE_WASM_EXTENDED_CONST
|
||||
bool evalI32Add() {
|
||||
uint32_t a = popI32();
|
||||
uint32_t b = popI32();
|
||||
uint32_t a = popI32();
|
||||
return pushI32(a + b);
|
||||
}
|
||||
bool evalI32Sub() {
|
||||
uint32_t a = popI32();
|
||||
uint32_t b = popI32();
|
||||
uint32_t a = popI32();
|
||||
return pushI32(a - b);
|
||||
}
|
||||
bool evalI32Mul() {
|
||||
uint32_t a = popI32();
|
||||
uint32_t b = popI32();
|
||||
uint32_t a = popI32();
|
||||
return pushI32(a * b);
|
||||
}
|
||||
bool evalI64Add() {
|
||||
uint64_t a = popI64();
|
||||
uint64_t b = popI64();
|
||||
uint64_t a = popI64();
|
||||
return pushI64(a + b);
|
||||
}
|
||||
bool evalI64Sub() {
|
||||
uint64_t a = popI64();
|
||||
uint64_t b = popI64();
|
||||
uint64_t a = popI64();
|
||||
return pushI64(a - b);
|
||||
}
|
||||
bool evalI64Mul() {
|
||||
uint64_t a = popI64();
|
||||
uint64_t b = popI64();
|
||||
uint64_t a = popI64();
|
||||
return pushI64(a * b);
|
||||
}
|
||||
#endif // ENABLE_WASM_EXTENDED_CONST
|
||||
|
||||
@@ -7644,7 +7644,7 @@
|
||||
#if defined(ENABLE_WASM_EXTENDED_CONST)
|
||||
- name: javascript.options.wasm_extended_const
|
||||
type: bool
|
||||
value: @IS_NIGHTLY_BUILD@
|
||||
value: true
|
||||
mirror: always
|
||||
#endif // defined(ENABLE_WASM_EXTENDED_CONST)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user