Bug 1531670 - Replace ENABLE_WASM_GENERALIZED_TABLES. r=bbouvier
authorLars T Hansen <lhansen@mozilla.com>
Fri, 01 Mar 2019 09:33:31 +0100
changeset 519976 9453f4e1827d249f898b214f549c2fc08931d81c
parent 519975 5ab328aef1d472bbd0dfe3e237c2f0e698bcb88a
child 519977 74ab0e9aebf5cea683ca7c9b8fd77303e223c3b9
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1531670
milestone67.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 1531670 - Replace ENABLE_WASM_GENERALIZED_TABLES. r=bbouvier Replace all uses of ENABLE_WASM_GENERALIZED_TABLES with ENABLE_WASM_REFTYPES, plus some knock-on effects. Replace all uses of wasmGeneralizedTables with wasmReftypesEnabled. Drive-by fix: replace 'anyfunc' in a couple of error strings with the canonical 'funcref'. Drive-by fix: remove isSimdAvailable, it is not used and we have no SIMD. Differential Revision: https://phabricator.services.mozilla.com/D21653
js/moz.configure
js/src/builtin/TestingFunctions.cpp
js/src/jit-test/tests/wasm/gc/tables-generalized-disabled.js
js/src/jit-test/tests/wasm/gc/tables-generalized-struct.js
js/src/jit-test/tests/wasm/gc/tables-generalized.js
js/src/jit-test/tests/wasm/gc/tables-multiple.js
js/src/jit-test/tests/wasm/gc/tables-stress.js
js/src/wasm/WasmAST.h
js/src/wasm/WasmBaselineCompile.cpp
js/src/wasm/WasmConstants.h
js/src/wasm/WasmIonCompile.cpp
js/src/wasm/WasmJS.cpp
js/src/wasm/WasmOpIter.cpp
js/src/wasm/WasmTextToBinary.cpp
js/src/wasm/WasmValidate.cpp
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -553,32 +553,16 @@ def default_wasm_reftypes(is_nightly):
 js_option('--enable-wasm-reftypes',
           default=default_wasm_reftypes,
           help='{Enable|Disable} WebAssembly reference types')
 
 set_config('ENABLE_WASM_REFTYPES', depends_if('--enable-wasm-reftypes')(lambda x: True))
 set_define('ENABLE_WASM_REFTYPES', depends_if('--enable-wasm-reftypes')(lambda x: True))
 
 
-# Support for WebAssembly generalized tables (anyref tables, multiple tables).
-# ============================================================================
-
-@depends(milestone.is_nightly, '--enable-wasm-reftypes')
-def default_wasm_generalized_tables(is_nightly, reftypes):
-    if reftypes and is_nightly:
-        return True
-
-js_option('--enable-wasm-generalized-tables',
-          default=default_wasm_generalized_tables,
-          help='{Enable|Disable} WebAssembly generalized reference tables')
-
-set_config('ENABLE_WASM_GENERALIZED_TABLES', depends_if('--enable-wasm-generalized-tables')(lambda x: True))
-set_define('ENABLE_WASM_GENERALIZED_TABLES', depends_if('--enable-wasm-generalized-tables')(lambda x: True))
-
-
 # Support for WebAssembly GC.
 # ===========================
 
 @depends(milestone.is_nightly, '--enable-wasm-reftypes')
 def default_wasm_gc(is_nightly, reftypes):
     if reftypes and is_nightly:
         return True
 
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -699,29 +699,16 @@ static bool WasmGcEnabled(JSContext* cx,
 
 static bool WasmDebugSupport(JSContext* cx, unsigned argc, Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
   args.rval().setBoolean(cx->options().wasmBaseline() &&
                          wasm::BaselineCanCompile());
   return true;
 }
 
-static bool WasmGeneralizedTables(JSContext* cx, unsigned argc, Value* vp) {
-  CallArgs args = CallArgsFromVp(argc, vp);
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
-  // Generalized tables depend on anyref, though not currently on (ref T)
-  // types nor on structures or other GC-proposal features.
-  bool isSupported = wasm::HasReftypesSupport(cx);
-#else
-  bool isSupported = false;
-#endif
-  args.rval().setBoolean(isSupported);
-  return true;
-}
-
 static bool WasmCompileMode(JSContext* cx, unsigned argc, Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 
   bool baseline = cx->options().wasmBaseline();
   bool ion = cx->options().wasmIon();
 #ifdef ENABLE_WASM_CRANELIFT
   bool cranelift = cx->options().wasmCranelift();
 #else
@@ -4006,22 +3993,16 @@ static bool ShellCloneAndExecuteScript(J
   if (!JS::CloneAndExecuteScript(cx, script, &rval)) {
     return false;
   }
 
   args.rval().setUndefined();
   return true;
 }
 
-static bool IsSimdAvailable(JSContext* cx, unsigned argc, Value* vp) {
-  CallArgs args = CallArgsFromVp(argc, vp);
-  args.rval().set(BooleanValue(cx->jitSupportsSimd()));
-  return true;
-}
-
 static bool ByteSize(JSContext* cx, unsigned argc, Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
   mozilla::MallocSizeOf mallocSizeOf = cx->runtime()->debuggerMallocSizeOf;
 
   {
     // We can't tolerate the GC moving things around while we're using a
     // ubi::Node. Check that nothing we do causes a GC.
     JS::AutoCheckCannotGC autoCannotGC;
@@ -5923,20 +5904,16 @@ gc::ZealModeHelpText),
 "  inferred name based on where the function was defined. This can be\n"
 "  different from the 'name' property on the function."),
 
     JS_FN_HELP("isAsmJSCompilationAvailable", IsAsmJSCompilationAvailable, 0, 0,
 "isAsmJSCompilationAvailable",
 "  Returns whether asm.js compilation is currently available or whether it is disabled\n"
 "  (e.g., by the debugger)."),
 
-    JS_FN_HELP("isSimdAvailable", IsSimdAvailable, 0, 0,
-"isSimdAvailable",
-"  Returns true if SIMD extensions are supported on this platform."),
-
     JS_FN_HELP("getJitCompilerOptions", GetJitCompilerOptions, 0, 0,
 "getJitCompilerOptions()",
 "  Return an object describing some of the JIT compiler options.\n"),
 
     JS_FN_HELP("isAsmJSModule", IsAsmJSModule, 1, 0,
 "isAsmJSModule(fn)",
 "  Returns whether the given value is a function containing \"use asm\" that has been\n"
 "  validated according to the asm.js spec."),
@@ -6005,22 +5982,16 @@ gc::ZealModeHelpText),
     JS_FN_HELP("wasmGcEnabled", WasmGcEnabled, 1, 0,
 "wasmGcEnabled(bool)",
 "  Returns a boolean indicating whether the WebAssembly GC types proposal is enabled."),
 
     JS_FN_HELP("wasmDebugSupport", WasmDebugSupport, 1, 0,
 "wasmDebugSupport(bool)",
 "  Returns a boolean indicating whether the WebAssembly compilers support debugging."),
 
-    JS_FN_HELP("wasmGeneralizedTables", WasmGeneralizedTables, 1, 0,
-"wasmGeneralizedTables(bool)",
-"  Returns a boolean indicating whether generalized tables are available.\n"
-"  This feature set includes 'anyref' as a table type, and new instructions\n"
-"  including table.get, table.set, table.grow, and table.size."),
-
     JS_FN_HELP("isLazyFunction", IsLazyFunction, 1, 0,
 "isLazyFunction(fun)",
 "  True if fun is a lazy JSFunction."),
 
     JS_FN_HELP("isRelazifiableFunction", IsRelazifiableFunction, 1, 0,
 "isRelazifiableFunction(fun)",
 "  True if fun is a JSFunction with a relazifiable JSScript."),
 
--- a/js/src/jit-test/tests/wasm/gc/tables-generalized-disabled.js
+++ b/js/src/jit-test/tests/wasm/gc/tables-generalized-disabled.js
@@ -1,6 +1,6 @@
-// |jit-test| skip-if: wasmGeneralizedTables()
+// |jit-test| skip-if: wasmReftypesEnabled()
 
 assertErrorMessage(() => new WebAssembly.Table({element:"anyref", initial:10}),
                    TypeError,
                    /"element" property of table descriptor must be "funcref"/);
 
--- a/js/src/jit-test/tests/wasm/gc/tables-generalized-struct.js
+++ b/js/src/jit-test/tests/wasm/gc/tables-generalized-struct.js
@@ -1,9 +1,9 @@
-// |jit-test| skip-if: !wasmGeneralizedTables() || !wasmGcEnabled() || wasmCompileMode() != 'baseline'
+// |jit-test| skip-if: !wasmReftypesEnabled() || !wasmGcEnabled() || wasmCompileMode() != 'baseline'
 
 // table.set in bounds with i32 x anyref - works, no value generated
 // table.set with (ref T) - works
 // table.set with null - works
 // table.set out of bounds - fails
 
 {
     let ins = wasmEvalText(
--- a/js/src/jit-test/tests/wasm/gc/tables-generalized.js
+++ b/js/src/jit-test/tests/wasm/gc/tables-generalized.js
@@ -1,9 +1,9 @@
-// |jit-test| skip-if: !wasmGeneralizedTables()
+// |jit-test| skip-if: !wasmReftypesEnabled()
 
 ///////////////////////////////////////////////////////////////////////////
 //
 // General table management in wasm
 
 // Wasm: Create table-of-anyref
 
 new WebAssembly.Module(wasmTextToBinary(
--- a/js/src/jit-test/tests/wasm/gc/tables-multiple.js
+++ b/js/src/jit-test/tests/wasm/gc/tables-multiple.js
@@ -1,9 +1,9 @@
-// |jit-test| skip-if: !wasmGeneralizedTables()
+// |jit-test| skip-if: !wasmReftypesEnabled()
 
 // Note that negative tests not having to do with table indices have been taken
 // care of by tables-generalized.js.
 
 ///////////////////////////////////////////////////////////////////////////
 //
 // Positive tests
 
--- a/js/src/jit-test/tests/wasm/gc/tables-stress.js
+++ b/js/src/jit-test/tests/wasm/gc/tables-stress.js
@@ -1,9 +1,9 @@
-// |jit-test| skip-if: !wasmGeneralizedTables()
+// |jit-test| skip-if: !wasmReftypesEnabled()
 
 for ( let prefix of ['', '(table $prefix 0 32 funcref)']) {
     let mod = new WebAssembly.Module(wasmTextToBinary(
     `(module
        (gc_feature_opt_in 3)
        ${prefix}
        (table $tbl 0 anyref)
        (import $item "m" "item" (func (result anyref)))
--- a/js/src/wasm/WasmAST.h
+++ b/js/src/wasm/WasmAST.h
@@ -424,17 +424,17 @@ enum class AstExprKind {
   SetGlobal,
   SetLocal,
 #ifdef ENABLE_WASM_GC
   StructNew,
   StructGet,
   StructSet,
   StructNarrow,
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
   TableGet,
   TableGrow,
   TableSet,
   TableSize,
 #endif
   TeeLocal,
   Store,
   TernaryOperator,
@@ -913,17 +913,17 @@ class AstMemOrTableInit : public AstExpr
     return target_;
   }
   AstExpr& dst() const { return *dst_; }
   AstExpr& src() const { return *src_; }
   AstExpr& len() const { return *len_; }
 };
 #endif
 
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
 class AstTableGet : public AstExpr {
   AstRef targetTable_;
   AstExpr* index_;
 
  public:
   static const AstExprKind Kind = AstExprKind::TableGet;
   explicit AstTableGet(AstRef targetTable, AstExpr* index)
       : AstExpr(Kind, ExprType::AnyRef),
@@ -975,17 +975,17 @@ class AstTableSize : public AstExpr {
 
  public:
   static const AstExprKind Kind = AstExprKind::TableSize;
   explicit AstTableSize(AstRef targetTable)
       : AstExpr(Kind, ExprType::I32), targetTable_(targetTable) {}
 
   AstRef& targetTable() { return targetTable_; }
 };
-#endif  // ENABLE_WASM_GENERALIZED_TABLES
+#endif  // ENABLE_WASM_REFTYPES
 
 #ifdef ENABLE_WASM_GC
 class AstStructNew : public AstExpr {
   AstRef structType_;
   AstExprVector fieldValues_;
 
  public:
   static const AstExprKind Kind = AstExprKind::StructNew;
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -10937,17 +10937,17 @@ bool BaseCompiler::emitBody() {
       case uint16_t(Op::SetLocal):
         CHECK_NEXT(emitSetLocal());
       case uint16_t(Op::TeeLocal):
         CHECK_NEXT(emitTeeLocal());
       case uint16_t(Op::GetGlobal):
         CHECK_NEXT(emitGetGlobal());
       case uint16_t(Op::SetGlobal):
         CHECK_NEXT(emitSetGlobal());
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
       case uint16_t(Op::TableGet):
         CHECK_NEXT(emitTableGet());
       case uint16_t(Op::TableSet):
         CHECK_NEXT(emitTableSet());
 #endif
 
       // Select
       case uint16_t(Op::Select):
@@ -11539,17 +11539,17 @@ bool BaseCompiler::emitBody() {
             CHECK_NEXT(emitMemOrTableInit(/*isMem=*/true));
           case uint16_t(MiscOp::TableCopy):
             CHECK_NEXT(emitMemOrTableCopy(/*isMem=*/false));
           case uint16_t(MiscOp::ElemDrop):
             CHECK_NEXT(emitDataOrElemDrop(/*isData=*/false));
           case uint16_t(MiscOp::TableInit):
             CHECK_NEXT(emitMemOrTableInit(/*isMem=*/false));
 #endif  // ENABLE_WASM_BULKMEM_OPS
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
           case uint16_t(MiscOp::TableGrow):
             CHECK_NEXT(emitTableGrow());
           case uint16_t(MiscOp::TableSize):
             CHECK_NEXT(emitTableSize());
 #endif
 #ifdef ENABLE_WASM_GC
           case uint16_t(MiscOp::StructNew):
             if (!env_.gcTypesEnabled()) {
--- a/js/src/wasm/WasmConstants.h
+++ b/js/src/wasm/WasmConstants.h
@@ -165,17 +165,17 @@ enum class Op {
   Select = 0x1b,
 
   // Variable access
   GetLocal = 0x20,
   SetLocal = 0x21,
   TeeLocal = 0x22,
   GetGlobal = 0x23,
   SetGlobal = 0x24,
-  TableGet = 0x25,              // Generalized table ops,
+  TableGet = 0x25,              // Reftypes,
   TableSet = 0x26,              //   per proposal as of February 2019
 
   // Memory-related operators
   I32Load = 0x28,
   I64Load = 0x29,
   F32Load = 0x2a,
   F64Load = 0x2b,
   I32Load8S = 0x2c,
@@ -377,17 +377,17 @@ enum class MiscOp {
   MemInit = 0x08,
   DataDrop = 0x09,
   MemCopy = 0x0a,
   MemFill = 0x0b,
   TableInit = 0x0c,
   ElemDrop = 0x0d,
   TableCopy = 0x0e,
 
-  // Generalized table operations, per proposal as of February 2019.
+  // Reftypes, per proposal as of February 2019.
   TableGrow = 0x0f,
   TableSize = 0x10,
   // TableFill = 0x11, // reserved
 
   // Structure operations.  Note, these are unofficial.
   StructNew = 0x50,
   StructGet = 0x51,
   StructSet = 0x52,
--- a/js/src/wasm/WasmIonCompile.cpp
+++ b/js/src/wasm/WasmIonCompile.cpp
@@ -3108,17 +3108,17 @@ static bool EmitMemOrTableInit(FunctionC
   if (!f.checkI32NegativeMeansFailedResult(ret)) {
     return false;
   }
 
   return true;
 }
 #endif  // ENABLE_WASM_BULKMEM_OPS
 
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
 // Note, table.{get,grow,set} on table(anyfunc) are currently rejected by the
 // verifier.
 
 static bool EmitTableGet(FunctionCompiler& f) {
   uint32_t tableIndex;
   MDefinition* index;
   if (!f.iter().readTableGet(&tableIndex, &index)) {
     return false;
@@ -3306,17 +3306,17 @@ static bool EmitTableSize(FunctionCompil
   if (!f.builtinInstanceMethodCall(SASigTableSize, lineOrBytecode, args,
                                    &ret)) {
     return false;
   }
 
   f.iter().setResult(ret);
   return true;
 }
-#endif  // ENABLE_WASM_GENERALIZED_TABLES
+#endif  // ENABLE_WASM_REFTYPES
 
 #ifdef ENABLE_WASM_REFTYPES
 static bool EmitRefNull(FunctionCompiler& f) {
   if (!f.iter().readRefNull()) {
     return false;
   }
 
   if (f.inDeadCode()) {
@@ -3420,17 +3420,17 @@ static bool EmitBodyExprs(FunctionCompil
       case uint16_t(Op::SetLocal):
         CHECK(EmitSetLocal(f));
       case uint16_t(Op::TeeLocal):
         CHECK(EmitTeeLocal(f));
       case uint16_t(Op::GetGlobal):
         CHECK(EmitGetGlobal(f));
       case uint16_t(Op::SetGlobal):
         CHECK(EmitSetGlobal(f));
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
       case uint16_t(Op::TableGet):
         CHECK(EmitTableGet(f));
       case uint16_t(Op::TableSet):
         CHECK(EmitTableSet(f));
 #endif
 
       // Memory-related operators
       case uint16_t(Op::I32Load):
@@ -3844,17 +3844,17 @@ static bool EmitBodyExprs(FunctionCompil
             CHECK(EmitMemOrTableInit(f, /*isMem=*/true));
           case uint16_t(MiscOp::TableCopy):
             CHECK(EmitMemOrTableCopy(f, /*isMem=*/false));
           case uint16_t(MiscOp::ElemDrop):
             CHECK(EmitDataOrElemDrop(f, /*isData=*/false));
           case uint16_t(MiscOp::TableInit):
             CHECK(EmitMemOrTableInit(f, /*isMem=*/false));
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
           case uint16_t(MiscOp::TableGrow):
             CHECK(EmitTableGrow(f));
           case uint16_t(MiscOp::TableSize):
             CHECK(EmitTableSize(f));
 #endif
 #ifdef ENABLE_WASM_GC
           case uint16_t(MiscOp::StructNew):
           case uint16_t(MiscOp::StructGet):
--- a/js/src/wasm/WasmJS.cpp
+++ b/js/src/wasm/WasmJS.cpp
@@ -2098,27 +2098,27 @@ bool WasmTableObject::construct(JSContex
     return false;
   }
 
   TableKind tableKind;
   if (StringEqualsAscii(elementLinearStr, "anyfunc") ||
       StringEqualsAscii(elementLinearStr, "funcref"))
   {
     tableKind = TableKind::AnyFunction;
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
   } else if (StringEqualsAscii(elementLinearStr, "anyref")) {
     if (!HasReftypesSupport(cx)) {
       JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
                                JSMSG_WASM_BAD_ELEMENT);
       return false;
     }
     tableKind = TableKind::AnyRef;
 #endif
   } else {
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
     JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
                              JSMSG_WASM_BAD_ELEMENT_GENERALIZED);
 #else
     JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
                              JSMSG_WASM_BAD_ELEMENT);
 #endif
     return false;
   }
--- a/js/src/wasm/WasmOpIter.cpp
+++ b/js/src/wasm/WasmOpIter.cpp
@@ -17,22 +17,16 @@
  */
 
 #include "wasm/WasmOpIter.h"
 
 using namespace js;
 using namespace js::jit;
 using namespace js::wasm;
 
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
-#  ifndef ENABLE_WASM_REFTYPES
-#    error "Generalized tables require the reftypes feature"
-#  endif
-#endif
-
 #ifdef ENABLE_WASM_GC
 #  ifndef ENABLE_WASM_REFTYPES
 #    error "GC types require the reftypes feature"
 #  endif
 #endif
 
 #ifdef DEBUG
 
@@ -46,21 +40,16 @@ using namespace js::wasm;
 #  else
 #    define WASM_GC_OP(code) break
 #  endif
 #  ifdef ENABLE_WASM_BULKMEM_OPS
 #    define WASM_BULK_OP(code) return code
 #  else
 #    define WASM_BULK_OP(code) break
 #  endif
-#  ifdef ENABLE_WASM_GENERALIZED_TABLES
-#    define WASM_TABLE_OP(code) return code
-#  else
-#    define WASM_TABLE_OP(code) break
-#  endif
 
 OpKind wasm::Classify(OpBytes op) {
   switch (Op(op.b0)) {
     case Op::Block:
       return OpKind::Block;
     case Op::Loop:
       return OpKind::Loop;
     case Op::Unreachable:
@@ -248,19 +237,19 @@ OpKind wasm::Classify(OpBytes op) {
       return OpKind::SetLocal;
     case Op::TeeLocal:
       return OpKind::TeeLocal;
     case Op::GetGlobal:
       return OpKind::GetGlobal;
     case Op::SetGlobal:
       return OpKind::SetGlobal;
     case Op::TableGet:
-      WASM_TABLE_OP(OpKind::TableGet);
+      WASM_REF_OP(OpKind::TableGet);
     case Op::TableSet:
-      WASM_TABLE_OP(OpKind::TableSet);
+      WASM_REF_OP(OpKind::TableSet);
     case Op::Call:
       return OpKind::Call;
     case Op::CallIndirect:
       return OpKind::CallIndirect;
     case Op::Return:
     case Op::Limit:
       // Accept Limit, for use in decoding the end of a function after the body.
       return OpKind::Return;
@@ -303,19 +292,19 @@ OpKind wasm::Classify(OpBytes op) {
         case MiscOp::ElemDrop:
           WASM_BULK_OP(OpKind::DataOrElemDrop);
         case MiscOp::MemFill:
           WASM_BULK_OP(OpKind::MemFill);
         case MiscOp::MemInit:
         case MiscOp::TableInit:
           WASM_BULK_OP(OpKind::MemOrTableInit);
         case MiscOp::TableGrow:
-          WASM_TABLE_OP(OpKind::TableGrow);
+          WASM_REF_OP(OpKind::TableGrow);
         case MiscOp::TableSize:
-          WASM_TABLE_OP(OpKind::TableSize);
+          WASM_REF_OP(OpKind::TableSize);
         case MiscOp::StructNew:
           WASM_GC_OP(OpKind::StructNew);
         case MiscOp::StructGet:
           WASM_GC_OP(OpKind::StructGet);
         case MiscOp::StructSet:
           WASM_GC_OP(OpKind::StructSet);
         case MiscOp::StructNarrow:
           WASM_GC_OP(OpKind::StructNarrow);
@@ -450,11 +439,11 @@ OpKind wasm::Classify(OpBytes op) {
       break;
     }
   }
   MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("unimplemented opcode");
 }
 
 #  undef WASM_GC_OP
 #  undef WASM_BULK_OP
-#  undef WASM_TABLE_OP
+#  undef WASM_REF_OP
 
 #endif
--- a/js/src/wasm/WasmTextToBinary.cpp
+++ b/js/src/wasm/WasmTextToBinary.cpp
@@ -140,17 +140,17 @@ class WasmToken {
     Struct,
     Store,
     Table,
 #ifdef ENABLE_WASM_BULKMEM_OPS
     TableCopy,
     ElemDrop,
     TableInit,
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
     TableGet,
     TableGrow,
     TableSet,
     TableSize,
 #endif
     TeeLocal,
     TernaryOpcode,
     Text,
@@ -340,17 +340,17 @@ class WasmToken {
       case Return:
       case SetGlobal:
       case SetLocal:
       case Store:
 #ifdef ENABLE_WASM_BULKMEM_OPS
       case TableCopy:
       case TableInit:
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
       case TableGet:
       case TableGrow:
       case TableSet:
       case TableSize:
 #endif
       case TeeLocal:
       case TernaryOpcode:
       case UnaryOpcode:
@@ -2251,17 +2251,17 @@ WasmToken WasmTokenStream::next() {
 #ifdef ENABLE_WASM_BULKMEM_OPS
         if (consume(u"copy")) {
           return WasmToken(WasmToken::TableCopy, begin, cur_);
         }
         if (consume(u"init")) {
           return WasmToken(WasmToken::TableInit, begin, cur_);
         }
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
         if (consume(u"get")) {
           return WasmToken(WasmToken::TableGet, begin, cur_);
         }
         if (consume(u"grow")) {
           return WasmToken(WasmToken::TableGrow, begin, cur_);
         }
         if (consume(u"set")) {
           return WasmToken(WasmToken::TableSet, begin, cur_);
@@ -3777,17 +3777,17 @@ static AstMemOrTableInit* ParseMemOrTabl
     return nullptr;
   }
 
   return new (c.lifo)
       AstMemOrTableInit(isMem, segIndex, targetMemOrTable, dst, src, len);
 }
 #endif
 
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
 static AstTableGet* ParseTableGet(WasmParseContext& c, bool inParens) {
   // (table.get table index)
   // (table.get index)
 
   AstRef targetTable = AstRef(0);
   c.ts.getIfRef(&targetTable);
 
   AstExpr* index = ParseExpr(c, inParens);
@@ -4032,17 +4032,17 @@ static AstExpr* ParseExprBody(WasmParseC
       return ParseMemOrTableInit(c, inParens, /*isMem=*/true);
     case WasmToken::TableCopy:
       return ParseMemOrTableCopy(c, inParens, /*isMem=*/false);
     case WasmToken::ElemDrop:
       return ParseDataOrElemDrop(c, /*isData=*/false);
     case WasmToken::TableInit:
       return ParseMemOrTableInit(c, inParens, /*isMem=*/false);
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
     case WasmToken::TableGet:
       return ParseTableGet(c, inParens);
     case WasmToken::TableGrow:
       return ParseTableGrow(c, inParens);
     case WasmToken::TableSet:
       return ParseTableSet(c, inParens);
     case WasmToken::TableSize:
       return ParseTableSize(c, inParens);
@@ -4651,17 +4651,17 @@ static bool ParseGlobalType(WasmParseCon
 }
 
 static bool ParseElemType(WasmParseContext& c, TableKind* tableKind) {
   WasmToken token;
   if (c.ts.getIf(WasmToken::FuncRef, &token)) {
     *tableKind = TableKind::AnyFunction;
     return true;
   }
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
   if (c.ts.getIf(WasmToken::ValueType, &token) &&
       token.valueType() == ValType::AnyRef) {
     *tableKind = TableKind::AnyRef;
     return true;
   }
   c.ts.generateError(token, "'anyfunc' or 'anyref' required", c.error);
 #else
   c.ts.generateError(token, "'anyfunc' required", c.error);
@@ -5645,17 +5645,17 @@ static bool ResolveMemFill(Resolver& r, 
 static bool ResolveMemOrTableInit(Resolver& r, AstMemOrTableInit& s) {
   return ResolveExpr(r, s.dst()) && ResolveExpr(r, s.src()) &&
          ResolveExpr(r, s.len()) &&
          (s.isMem() ? r.resolveMemory(s.targetMemory())
                     : r.resolveTable(s.targetTable()));
 }
 #endif
 
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
 static bool ResolveTableGet(Resolver& r, AstTableGet& s) {
   return ResolveExpr(r, s.index()) && r.resolveTable(s.targetTable());
 }
 
 static bool ResolveTableGrow(Resolver& r, AstTableGrow& s) {
   return ResolveExpr(r, s.delta()) && ResolveExpr(r, s.initValue()) &&
          r.resolveTable(s.targetTable());
 }
@@ -5797,17 +5797,17 @@ static bool ResolveExpr(Resolver& r, Ast
       return ResolveMemOrTableCopy(r, expr.as<AstMemOrTableCopy>());
     case AstExprKind::DataOrElemDrop:
       return true;
     case AstExprKind::MemFill:
       return ResolveMemFill(r, expr.as<AstMemFill>());
     case AstExprKind::MemOrTableInit:
       return ResolveMemOrTableInit(r, expr.as<AstMemOrTableInit>());
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
     case AstExprKind::TableGet:
       return ResolveTableGet(r, expr.as<AstTableGet>());
     case AstExprKind::TableGrow:
       return ResolveTableGrow(r, expr.as<AstTableGrow>());
     case AstExprKind::TableSet:
       return ResolveTableSet(r, expr.as<AstTableSet>());
     case AstExprKind::TableSize:
       return ResolveTableSize(r, expr.as<AstTableSize>());
@@ -6419,17 +6419,17 @@ static bool EncodeMemFill(Encoder& e, As
 static bool EncodeMemOrTableInit(Encoder& e, AstMemOrTableInit& s) {
   return EncodeExpr(e, s.dst()) && EncodeExpr(e, s.src()) &&
          EncodeExpr(e, s.len()) &&
          e.writeOp(s.isMem() ? MiscOp::MemInit : MiscOp::TableInit) &&
          e.writeVarU32(s.segIndex()) && e.writeVarU32(s.target().index());
 }
 #endif
 
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
 static bool EncodeTableGet(Encoder& e, AstTableGet& s) {
   return EncodeExpr(e, s.index()) && e.writeOp(Op::TableGet) &&
          e.writeVarU32(s.targetTable().index());
 }
 
 static bool EncodeTableGrow(Encoder& e, AstTableGrow& s) {
   return EncodeExpr(e, s.delta()) && EncodeExpr(e, s.initValue()) &&
          e.writeOp(MiscOp::TableGrow) &&
@@ -6599,17 +6599,17 @@ static bool EncodeExpr(Encoder& e, AstEx
       return EncodeMemOrTableCopy(e, expr.as<AstMemOrTableCopy>());
     case AstExprKind::DataOrElemDrop:
       return EncodeDataOrElemDrop(e, expr.as<AstDataOrElemDrop>());
     case AstExprKind::MemFill:
       return EncodeMemFill(e, expr.as<AstMemFill>());
     case AstExprKind::MemOrTableInit:
       return EncodeMemOrTableInit(e, expr.as<AstMemOrTableInit>());
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
     case AstExprKind::TableGet:
       return EncodeTableGet(e, expr.as<AstTableGet>());
     case AstExprKind::TableGrow:
       return EncodeTableGrow(e, expr.as<AstTableGrow>());
     case AstExprKind::TableSet:
       return EncodeTableSet(e, expr.as<AstTableSet>());
     case AstExprKind::TableSize:
       return EncodeTableSize(e, expr.as<AstTableSize>());
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -529,17 +529,17 @@ static bool DecodeFunctionBodyExprs(cons
       case uint16_t(Op::GetGlobal): {
         uint32_t unused;
         CHECK(iter.readGetGlobal(&unused));
       }
       case uint16_t(Op::SetGlobal): {
         uint32_t unused;
         CHECK(iter.readSetGlobal(&unused, &nothing));
       }
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
       case uint16_t(Op::TableGet): {
         uint32_t unusedTableIndex;
         CHECK(iter.readTableGet(&unusedTableIndex, &nothing));
       }
       case uint16_t(Op::TableSet): {
         uint32_t unusedTableIndex;
         CHECK(iter.readTableSet(&unusedTableIndex, &nothing, &nothing));
       }
@@ -864,17 +864,17 @@ static bool DecodeFunctionBodyExprs(cons
           case uint16_t(MiscOp::TableInit): {
             uint32_t unusedSegIndex;
             uint32_t unusedTableIndex;
             CHECK(iter.readMemOrTableInit(/*isMem=*/false, &unusedSegIndex,
                                           &unusedTableIndex, &nothing, &nothing,
                                           &nothing));
           }
 #endif
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
           case uint16_t(MiscOp::TableGrow): {
             uint32_t unusedTableIndex;
             CHECK(iter.readTableGrow(&unusedTableIndex, &nothing, &nothing));
           }
           case uint16_t(MiscOp::TableSize): {
             uint32_t unusedTableIndex;
             CHECK(iter.readTableSize(&unusedTableIndex));
           }
@@ -1557,28 +1557,28 @@ static bool DecodeTableTypeAndLimits(Dec
   uint8_t elementType;
   if (!d.readFixedU8(&elementType)) {
     return d.fail("expected table element type");
   }
 
   TableKind tableKind;
   if (elementType == uint8_t(TypeCode::AnyFunc)) {
     tableKind = TableKind::AnyFunction;
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
+#ifdef ENABLE_WASM_REFTYPES
   } else if (elementType == uint8_t(TypeCode::AnyRef)) {
     if (!gcTypesEnabled) {
       return d.fail("reference types not enabled");
     }
     tableKind = TableKind::AnyRef;
 #endif
   } else {
-#ifdef ENABLE_WASM_GENERALIZED_TABLES
-    return d.fail("expected 'anyfunc' or 'anyref' element type");
+#ifdef ENABLE_WASM_REFTYPES
+    return d.fail("expected 'funcref' or 'anyref' element type");
 #else
-    return d.fail("expected 'anyfunc' element type");
+    return d.fail("expected 'funcref' element type");
 #endif
   }
 
   Limits limits;
   if (!DecodeLimits(d, &limits)) {
     return false;
   }