Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 7170eb5

Browse files
author
Lars T Hansen
committed
Bug 1488205 - Remove gc_feature_opt_in from reftypes-only tests. r=jseward
Differential Revision: https://phabricator.services.mozilla.com/D21691 --HG-- extra : rebase_source : 831b1b09efd1963b5f2bffbefe520c61034048e1 extra : histedit_source : 589898d3d56268d03491155ce938fd7d7c281d89
1 parent 1290444 commit 7170eb5

16 files changed

+37
-136
lines changed

js/src/jit-test/tests/wasm/gc/anyref-boxing.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ for (let v of VALUES)
5858
let g = new WebAssembly.Global({value: "anyref"}, v);
5959
let ins = wasmEvalText(
6060
`(module
61-
(gc_feature_opt_in 3)
6261
(import $glob "m" "g" (global anyref))
6362
(func (export "f") (result anyref)
6463
(get_global $glob)))`,
@@ -73,7 +72,6 @@ for (let v of VALUES)
7372
let g = new WebAssembly.Global({value: "anyref", mutable: true});
7473
let ins = wasmEvalText(
7574
`(module
76-
(gc_feature_opt_in 3)
7775
(import $glob "m" "g" (global (mut anyref)))
7876
(func (export "f") (param $v anyref)
7977
(set_global $glob (get_local $v))))`,
@@ -112,7 +110,6 @@ for (let v of VALUES)
112110
let t = new WebAssembly.Table({element: "anyref", initial: 10});
113111
let ins = wasmEvalText(
114112
`(module
115-
(gc_feature_opt_in 3)
116113
(import $t "m" "t" (table 10 anyref))
117114
(func (export "f") (param $v anyref)
118115
(table.set $t (i32.const 3) (get_local $v))))`,
@@ -128,7 +125,6 @@ for (let v of VALUES)
128125
let t = new WebAssembly.Table({element: "anyref", initial: 10});
129126
let ins = wasmEvalText(
130127
`(module
131-
(gc_feature_opt_in 3)
132128
(import $t "m" "t" (table 10 anyref))
133129
(func (export "f") (result anyref)
134130
(table.get $t (i32.const 3))))`,
@@ -146,7 +142,6 @@ for (let v of VALUES)
146142
let receiver = function (w) { assertEq(w, v); };
147143
let ins = wasmEvalText(
148144
`(module
149-
(gc_feature_opt_in 3)
150145
(import $returner "m" "returner" (func (result anyref)))
151146
(import $receiver "m" "receiver" (func (param anyref)))
152147
(func (export "test_returner") (result anyref)

js/src/jit-test/tests/wasm/gc/anyref-global-postbarrier.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ function Baguette(calories) {
1010
// Ensure the baseline compiler sync's before the postbarrier.
1111
(function() {
1212
wasmEvalText(`(module
13-
(gc_feature_opt_in 3)
1413
(global (mut anyref) (ref.null))
1514
(func (export "f")
1615
get_global 0
@@ -22,15 +21,13 @@ function Baguette(calories) {
2221
})();
2322

2423
let exportsPlain = wasmEvalText(`(module
25-
(gc_feature_opt_in 3)
2624
(global i32 (i32.const 42))
2725
(global $g (mut anyref) (ref.null))
2826
(func (export "set") (param anyref) get_local 0 set_global $g)
2927
(func (export "get") (result anyref) get_global $g)
3028
)`).exports;
3129

3230
let exportsObj = wasmEvalText(`(module
33-
(gc_feature_opt_in 3)
3431
(global $g (export "g") (mut anyref) (ref.null))
3532
(func (export "set") (param anyref) get_local 0 set_global $g)
3633
(func (export "get") (result anyref) get_global $g)

js/src/jit-test/tests/wasm/gc/anyref-global-prebarrier.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ if (opts['ion.enable'] || opts['baseline.enable'])
1010
const { startProfiling, endProfiling, assertEqPreciseStacks, isSingleStepProfilingEnabled } = WasmHelpers;
1111

1212
let e = wasmEvalText(`(module
13-
(gc_feature_opt_in 3)
1413
(global $g (mut anyref) (ref.null))
1514
(func (export "set") (param anyref) get_local 0 set_global $g)
1615
)`).exports;

js/src/jit-test/tests/wasm/gc/anyref-val-tracing.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
gczeal(14, 1);
44
let { exports } = wasmEvalText(`(module
5-
(gc_feature_opt_in 3)
65
(global $anyref (import "glob" "anyref") anyref)
76
(func (export "get") (result anyref) get_global $anyref)
87
)`, {

js/src/jit-test/tests/wasm/gc/anyref.js

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ function Baguette(calories) {
1010
const { validate, CompileError } = WebAssembly;
1111

1212
assertErrorMessage(() => wasmEvalText(`(module
13-
(gc_feature_opt_in 3)
1413
(func (result anyref)
1514
i32.const 42
1615
)
1716
)`), CompileError, mismatchError('i32', 'anyref'));
1817

1918
assertErrorMessage(() => wasmEvalText(`(module
20-
(gc_feature_opt_in 3)
2119
(func (result anyref)
2220
i32.const 0
2321
ref.null
@@ -27,7 +25,6 @@ assertErrorMessage(() => wasmEvalText(`(module
2725
)`), CompileError, /select operand types/);
2826

2927
assertErrorMessage(() => wasmEvalText(`(module
30-
(gc_feature_opt_in 3)
3128
(func (result i32)
3229
ref.null
3330
if
@@ -40,16 +37,16 @@ assertErrorMessage(() => wasmEvalText(`(module
4037
// Basic compilation tests.
4138

4239
let simpleTests = [
43-
"(module (gc_feature_opt_in 3) (func (drop (ref.null))))",
44-
"(module (gc_feature_opt_in 3) (func $test (local anyref)))",
45-
"(module (gc_feature_opt_in 3) (func $test (param anyref)))",
46-
"(module (gc_feature_opt_in 3) (func $test (result anyref) (ref.null)))",
47-
"(module (gc_feature_opt_in 3) (func $test (block anyref (unreachable)) unreachable))",
48-
"(module (gc_feature_opt_in 3) (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
49-
`(module (gc_feature_opt_in 3) (import "a" "b" (param anyref)))`,
50-
`(module (gc_feature_opt_in 3) (import "a" "b" (result anyref)))`,
51-
`(module (gc_feature_opt_in 3) (global anyref (ref.null)))`,
52-
`(module (gc_feature_opt_in 3) (global (mut anyref) (ref.null)))`,
40+
"(module (func (drop (ref.null))))",
41+
"(module (func $test (local anyref)))",
42+
"(module (func $test (param anyref)))",
43+
"(module (func $test (result anyref) (ref.null)))",
44+
"(module (func $test (block anyref (unreachable)) unreachable))",
45+
"(module (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
46+
`(module (import "a" "b" (param anyref)))`,
47+
`(module (import "a" "b" (result anyref)))`,
48+
`(module (global anyref (ref.null)))`,
49+
`(module (global (mut anyref) (ref.null)))`,
5350
];
5451

5552
for (let src of simpleTests) {
@@ -60,7 +57,6 @@ for (let src of simpleTests) {
6057
// Basic behavioral tests.
6158

6259
let { exports } = wasmEvalText(`(module
63-
(gc_feature_opt_in 3)
6460
(func (export "is_null") (result i32)
6561
ref.null
6662
ref.is_null
@@ -98,7 +94,6 @@ assertEq(exports.is_null_local(), 1);
9894
// Anyref param and result in wasm functions.
9995

10096
exports = wasmEvalText(`(module
101-
(gc_feature_opt_in 3)
10297
(func (export "is_null") (result i32) (param $ref anyref)
10398
get_local $ref
10499
ref.is_null
@@ -156,7 +151,6 @@ assertEq(ref.calories, baguette.calories);
156151
// Make sure grow-memory isn't blocked by the lack of gc.
157152
(function() {
158153
assertEq(wasmEvalText(`(module
159-
(gc_feature_opt_in 3)
160154
(memory 0 64)
161155
(func (export "f") (param anyref) (result i32)
162156
i32.const 10
@@ -172,7 +166,6 @@ assertEq(ref.calories, baguette.calories);
172166
function assertJoin(body) {
173167
let val = { i: -1 };
174168
assertEq(wasmEvalText(`(module
175-
(gc_feature_opt_in 3)
176169
(func (export "test") (param $ref anyref) (param $i i32) (result anyref)
177170
${body}
178171
)
@@ -239,7 +232,6 @@ assertJoin(`(block $out anyref (block $unreachable anyref (loop $top
239232

240233
let x = { i: 42 }, y = { f: 53 };
241234
exports = wasmEvalText(`(module
242-
(gc_feature_opt_in 3)
243235
(func (export "test") (param $lhs anyref) (param $rhs anyref) (param $i i32) (result anyref)
244236
get_local $lhs
245237
get_local $rhs
@@ -294,7 +286,6 @@ let imports = {
294286
};
295287

296288
exports = wasmEvalText(`(module
297-
(gc_feature_opt_in 3)
298289
(import $ret "funcs" "ret" (result anyref))
299290
(import $param "funcs" "param" (param anyref))
300291
@@ -323,7 +314,6 @@ assertEq(exports.ret(), imports.myBaguette);
323314
// Check lazy stubs generation.
324315

325316
exports = wasmEvalText(`(module
326-
(gc_feature_opt_in 3)
327317
(import $mirror "funcs" "mirror" (param anyref) (result anyref))
328318
(import $augment "funcs" "augment" (param anyref) (result anyref))
329319
@@ -407,11 +397,11 @@ assertEq(exports.count_g(), 1);
407397

408398
// Anyref globals in wasm modules.
409399

410-
assertErrorMessage(() => wasmEvalText(`(module (gc_feature_opt_in 3) (global (import "glob" "anyref") anyref))`, { glob: { anyref: new WebAssembly.Global({ value: 'i32' }, 42) } }),
400+
assertErrorMessage(() => wasmEvalText(`(module (global (import "glob" "anyref") anyref))`, { glob: { anyref: new WebAssembly.Global({ value: 'i32' }, 42) } }),
411401
WebAssembly.LinkError,
412402
/imported global type mismatch/);
413403

414-
assertErrorMessage(() => wasmEvalText(`(module (gc_feature_opt_in 3) (global (import "glob" "i32") i32))`, { glob: { i32: {} } }),
404+
assertErrorMessage(() => wasmEvalText(`(module (global (import "glob" "i32") i32))`, { glob: { i32: {} } }),
415405
WebAssembly.LinkError,
416406
/import object field 'i32' is not a Number/);
417407

@@ -425,7 +415,6 @@ imports = {
425415
};
426416

427417
exports = wasmEvalText(`(module
428-
(gc_feature_opt_in 3)
429418
(global $g_imp_imm_null (import "constants" "imm_null") anyref)
430419
(global $g_imp_imm_bread (import "constants" "imm_bread") anyref)
431420

js/src/jit-test/tests/wasm/gc/debugger.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(function() {
44
let g = newGlobal({newCompartment: true});
55
let dbg = new Debugger(g);
6-
g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (gc_feature_opt_in 3) (func (result anyref) (param anyref) get_local 0) (export "" 0))')));`);
6+
g.eval(`o = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary('(module (func (result anyref) (param anyref) get_local 0) (export "" 0))')));`);
77
})();
88

99
(function() {
@@ -12,7 +12,6 @@
1212

1313
let src = `
1414
(module
15-
(gc_feature_opt_in 3)
1615
(func (export "func") (result anyref) (param $ref anyref)
1716
get_local $ref
1817
)

js/src/jit-test/tests/wasm/gc/disabled.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ const { CompileError, validate } = WebAssembly;
55
const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|(Structure|reference) types not enabled|invalid inline block type/;
66

77
let simpleTests = [
8-
"(module (gc_feature_opt_in 3) (func (drop (ref.null))))",
9-
"(module (gc_feature_opt_in 3) (func $test (local anyref)))",
10-
"(module (gc_feature_opt_in 3) (func $test (param anyref)))",
11-
"(module (gc_feature_opt_in 3) (func $test (result anyref) (ref.null)))",
12-
"(module (gc_feature_opt_in 3) (func $test (block anyref (unreachable)) unreachable))",
13-
"(module (gc_feature_opt_in 3) (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
14-
`(module (gc_feature_opt_in 3) (import "a" "b" (param anyref)))`,
15-
`(module (gc_feature_opt_in 3) (import "a" "b" (result anyref)))`,
16-
`(module (gc_feature_opt_in 3) (type $s (struct)))`,
8+
"(module (func (drop (ref.null))))",
9+
"(module (func $test (local anyref)))",
10+
"(module (func $test (param anyref)))",
11+
"(module (func $test (result anyref) (ref.null)))",
12+
"(module (func $test (block anyref (unreachable)) unreachable))",
13+
"(module (func $test (local anyref) (result i32) (ref.is_null (get_local 0))))",
14+
`(module (import "a" "b" (param anyref)))`,
15+
`(module (import "a" "b" (result anyref)))`,
16+
`(module (type $s (struct)))`,
1717
];
1818

1919
// Two distinct failure modes:

js/src/jit-test/tests/wasm/gc/gc-feature-opt-in.js

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,16 @@ assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
4646
WebAssembly.CompileError,
4747
/GC feature version is unknown/);
4848

49-
// Parameters of ref type are only available if we opt in.
49+
// Parameters of anyref type are available regardless of whether we opt in.
5050

5151
new WebAssembly.Module(wasmTextToBinary(
5252
`(module
5353
(gc_feature_opt_in ${CURRENT_VERSION})
5454
(type (func (param anyref))))`));
5555

56-
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
56+
new WebAssembly.Module(wasmTextToBinary(
5757
`(module
58-
(type (func (param anyref))))`)),
59-
WebAssembly.CompileError,
60-
/reference types not enabled/);
58+
(type (func (param anyref))))`));
6159

6260
// Ditto returns
6361

@@ -66,11 +64,9 @@ new WebAssembly.Module(wasmTextToBinary(
6664
(gc_feature_opt_in ${CURRENT_VERSION})
6765
(type (func (result anyref))))`));
6866

69-
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
67+
new WebAssembly.Module(wasmTextToBinary(
7068
`(module
71-
(type (func (result anyref))))`)),
72-
WebAssembly.CompileError,
73-
/reference types not enabled/);
69+
(type (func (result anyref))))`));
7470

7571
// Ditto locals
7672

@@ -81,13 +77,11 @@ new WebAssembly.Module(wasmTextToBinary(
8177
(local anyref)
8278
(i32.const 0)))`));
8379

84-
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
80+
new WebAssembly.Module(wasmTextToBinary(
8581
`(module
8682
(func (result i32)
8783
(local anyref)
88-
(i32.const 0)))`)),
89-
WebAssembly.CompileError,
90-
/reference types not enabled/);
84+
(i32.const 0)))`));
9185

9286
// Ditto globals
9387

@@ -96,29 +90,24 @@ new WebAssembly.Module(wasmTextToBinary(
9690
(gc_feature_opt_in ${CURRENT_VERSION})
9791
(global (mut anyref) (ref.null)))`));
9892

99-
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
93+
new WebAssembly.Module(wasmTextToBinary(
10094
`(module
101-
(global (mut anyref) (ref.null)))`)),
102-
WebAssembly.CompileError,
103-
/reference types not enabled/);
95+
(global (mut anyref) (ref.null)))`));
10496

105-
// Ref instructions are only available if we opt in.
97+
// ref.null and ref.is_null are available whetehr we opt in or not, but ref.eq
98+
// only if we opt in
10699
//
107100
// When testing these we need to avoid struct types or parameters, locals,
108101
// returns, or globals of ref type, or guards on those will preempt the guards
109102
// on the instructions.
110103

111-
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
104+
new WebAssembly.Module(wasmTextToBinary(
112105
`(module
113-
(func ref.null))`)),
114-
WebAssembly.CompileError,
115-
/unrecognized opcode/);
106+
(func (result anyref) ref.null))`));
116107

117-
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
108+
new WebAssembly.Module(wasmTextToBinary(
118109
`(module
119-
(func ref.is_null))`)),
120-
WebAssembly.CompileError,
121-
/unrecognized opcode/);
110+
(func (param anyref) (result i32) (ref.is_null (local.get 0))))`));
122111

123112
assertErrorMessage(() => new WebAssembly.Module(wasmTextToBinary(
124113
`(module

js/src/jit-test/tests/wasm/gc/ion-and-baseline.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
var refmod = new WebAssembly.Module(wasmTextToBinary(
2222
`(module
23-
(gc_feature_opt_in 3)
24-
2523
(import $tbl "" "tbl" (table 4 funcref))
2624
(import $print "" "print" (func (param i32)))
2725

0 commit comments

Comments
 (0)