Bug 1637564 part 2 - Fix build errors and some tests. r=lth
authorRyan Hunt <rhunt@eqrion.net>
Fri, 15 May 2020 06:51:40 +0000
changeset 530286 a35b8898b37eee38766c9dcad3784c90c747283b
parent 530285 a3400287932b9b79dc30983f0341e5f84f4e0f34
child 530287 e13ede3c68d41582f6fb231acbb6cffd3db4e4a4
push id37420
push usernerli@mozilla.com
push dateFri, 15 May 2020 21:52:36 +0000
treeherdermozilla-central@f340bbb582d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1637564
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1637564 part 2 - Fix build errors and some tests. r=lth I skimmed the original build error log and missed there was a second issue. The original drop-subtyping patches added a `readRefType` function to decoder and conditionally compiled it. This function is used by readRefNull, which is not conditionally compiled. The pattern used for disabling ref-types instructions so far is to conditionally compile the switches to ignore the op-code but still compile the WasmOpIter::read* method. This commit removes the conditional around `readRefType` to make that work. From local testing on a beta build, there are also two test failures. * Missing ref.null type immediate on test that's not run by default * Missing skip-if reftypes guard on multi-value Differential Revision: https://phabricator.services.mozilla.com/D75339
js/src/jit-test/tests/wasm/gc/disabled.js
js/src/jit-test/tests/wasm/multi-value/regress-1628499.js
js/src/wasm/WasmValidate.h
--- a/js/src/jit-test/tests/wasm/gc/disabled.js
+++ b/js/src/jit-test/tests/wasm/gc/disabled.js
@@ -1,21 +1,21 @@
 // |jit-test| skip-if: wasmReftypesEnabled() || wasmGcEnabled()
 
 const { CompileError, validate } = WebAssembly;
 
 const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|(Structure|reference) types not enabled|invalid inline block type|bad type|Cranelift error in clifFunc/;
 
 let simpleTests = [
-    "(module (func (drop (ref.null))))",
+    "(module (func (drop (ref.null extern))))",
     "(module (func $test (local anyref)))",
     "(module (func $test (param anyref)))",
-    "(module (func $test (result anyref) (ref.null)))",
+    "(module (func $test (result anyref) (ref.null extern)))",
     "(module (func $test (block (result anyref) (unreachable)) unreachable))",
-    "(module (func $test (result i32) (local anyref) (ref.is_null (local.get 0))))",
+    "(module (func $test (result i32) (local anyref) (ref.is_null extern (local.get 0))))",
     `(module (import "a" "b" (func (param anyref))))`,
     `(module (import "a" "b" (func (result anyref))))`,
     `(module (type $s (struct)))`,
 ];
 
 // Test that use of reference-types or structs fails when
 // reference-types is disabled.
 
--- a/js/src/jit-test/tests/wasm/multi-value/regress-1628499.js
+++ b/js/src/jit-test/tests/wasm/multi-value/regress-1628499.js
@@ -1,8 +1,10 @@
+// |jit-test| skip-if: !wasmReftypesEnabled()
+
 // |jit-test| skip-if: !wasmReftypesEnabled()
 
 let instance = wasmEvalText(`
   (func $twoRefs (result anyref anyref)
     (ref.null extern)
     (ref.null extern))
   (func $fourRefs (export "run") (result anyref anyref anyref anyref anyref anyref)
     call $twoRefs
--- a/js/src/wasm/WasmValidate.h
+++ b/js/src/wasm/WasmValidate.h
@@ -736,61 +736,59 @@ class Decoder {
       return false;
     }
     if (type->isTypeIndex() &&
         !types[type->refType().typeIndex()].isStructType()) {
       return fail("type index does not reference a struct type");
     }
     return true;
   }
-#ifdef ENABLE_WASM_REFTYPES
   MOZ_MUST_USE bool readRefType(uint32_t numTypes, bool gcTypesEnabled,
                                 RefType* type) {
     static_assert(uint8_t(TypeCode::Limit) <= UINT8_MAX, "fits");
     uint8_t code;
     if (!readFixedU8(&code)) {
       return false;
     }
     switch (code) {
       case uint8_t(TypeCode::FuncRef):
       case uint8_t(TypeCode::AnyRef):
         *type = RefType::fromTypeCode(TypeCode(code));
         return true;
-#  ifdef ENABLE_WASM_GC
+#ifdef ENABLE_WASM_GC
       case uint8_t(TypeCode::OptRef): {
         if (!gcTypesEnabled) {
           return fail("(optref T) types not enabled");
         }
         uint32_t typeIndex;
         if (!readVarU32(&typeIndex)) {
           return false;
         }
         if (typeIndex >= numTypes) {
           return fail("ref index out of range");
         }
         *type = RefType::fromTypeIndex(typeIndex);
         return true;
       }
-#  endif
+#endif
       default:
         return fail("bad type");
     }
   }
   MOZ_MUST_USE bool readRefType(const TypeDefVector& types, bool gcTypesEnabled,
                                 RefType* type) {
     if (!readRefType(types.length(), gcTypesEnabled, type)) {
       return false;
     }
     if (type->kind() == RefType::TypeIndex &&
         !types[type->typeIndex()].isStructType()) {
       return fail("type index does not reference a struct type");
     }
     return true;
   }
-#endif
   MOZ_MUST_USE bool readOp(OpBytes* op) {
     static_assert(size_t(Op::Limit) == 256, "fits");
     uint8_t u8;
     if (!readFixedU8(&u8)) {
       return false;
     }
     op->b0 = u8;
     if (MOZ_LIKELY(!IsPrefixByte(u8))) {