Bug 1598377 - Only enable multi-value and ref-types compiler environment flag if build time flag is set. r=lth
☠☠ backed out by 7c75c3077b22 ☠ ☠
authorRyan Hunt <rhunt@eqrion.net>
Fri, 06 Dec 2019 01:52:52 +0000
changeset 567941 774ad330f4f6eab85644f083607158115f8cfa38
parent 567940 f0865dabd55a549de7cad0dcdede430ec3c83fd5
child 567942 7c75c3077b22479e61a6e414b54fef6bb932f092
push id12493
push userffxbld-merge
push dateMon, 06 Jan 2020 15:38:57 +0000
treeherdermozilla-beta@63ae456b848d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1598377
milestone73.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 1598377 - Only enable multi-value and ref-types compiler environment flag if build time flag is set. r=lth The ref-types and multi-value compiler environment flags can be true even if they are disabled by compile time flag. This mostly works for ref-types because all new instructions are only decoded if the compile time flag is enabled. This does not work for multi-value as it affects type validation. Differential Revision: https://phabricator.services.mozilla.com/D55891
js/src/wasm/AsmJS.cpp
js/src/wasm/WasmCompile.cpp
js/src/wasm/WasmValidate.cpp
js/src/wasm/WasmValidate.h
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -1346,19 +1346,19 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
         validationLifo_(VALIDATION_LIFO_DEFAULT_CHUNK_SIZE),
         funcDefs_(cx),
         tables_(cx),
         globalMap_(cx),
         sigSet_(cx),
         funcImportMap_(cx),
         arrayViews_(cx),
         compilerEnv_(CompileMode::Once, Tier::Optimized, OptimizedBackend::Ion,
-                     DebugEnabled::False, /* ref types */ false,
-                     /* gc types */ false, /* huge memory */ false,
-                     /* bigint */ false),
+                     DebugEnabled::False, /* multi value */ false,
+                     /* ref types */ false, /* gc types */ false,
+                     /* huge memory */ false, /* bigint */ false),
         env_(&compilerEnv_, Shareable::False, ModuleKind::AsmJS) {
     compilerEnv_.computeParameters(/* gc types */ false);
     env_.minMemoryLength = RoundUpToNextValidAsmJSHeapLength(0);
   }
 
  protected:
   MOZ_MUST_USE bool addStandardLibraryMathInfo() {
     static constexpr struct {
--- a/js/src/wasm/WasmCompile.cpp
+++ b/js/src/wasm/WasmCompile.cpp
@@ -441,27 +441,28 @@ static bool TieringBeneficial(uint32_t c
 }
 
 CompilerEnvironment::CompilerEnvironment(const CompileArgs& args)
     : state_(InitialWithArgs), args_(&args) {}
 
 CompilerEnvironment::CompilerEnvironment(CompileMode mode, Tier tier,
                                          OptimizedBackend optimizedBackend,
                                          DebugEnabled debugEnabled,
+                                         bool multiValueConfigured,
                                          bool refTypesConfigured,
                                          bool gcTypesConfigured,
                                          bool hugeMemory, bool bigIntConfigured)
     : state_(InitialWithModeTierDebug),
       mode_(mode),
       tier_(tier),
       optimizedBackend_(optimizedBackend),
       debug_(debugEnabled),
+      multiValues_(multiValueConfigured),
       refTypes_(refTypesConfigured),
       gcTypes_(gcTypesConfigured),
-      multiValues_(true),
       hugeMemory_(hugeMemory),
       bigInt_(bigIntConfigured) {}
 
 void CompilerEnvironment::computeParameters(bool gcFeatureOptIn) {
   MOZ_ASSERT(state_ == InitialWithModeTierDebug);
 
   if (gcTypes_) {
     gcTypes_ = gcFeatureOptIn;
@@ -509,18 +510,26 @@ void CompilerEnvironment::computeParamet
     tier_ = hasSecondTier ? Tier::Optimized : Tier::Baseline;
   }
 
   optimizedBackend_ =
       craneliftEnabled ? OptimizedBackend::Cranelift : OptimizedBackend::Ion;
 
   debug_ = debugEnabled ? DebugEnabled::True : DebugEnabled::False;
   gcTypes_ = gcEnabled;
+#ifdef ENABLE_WASM_REFTYPES
   refTypes_ = !craneliftEnabled;
+#else
+  refTypes_ = false;
+#endif
+#ifdef ENABLE_WASM_MULTI_VALUE
   multiValues_ = !craneliftEnabled;
+#else
+  multiValues_ = false;
+#endif
   hugeMemory_ = hugeMemory;
   bigInt_ = bigIntEnabled && !craneliftEnabled;
   state_ = Computed;
 }
 
 template <class DecoderT>
 static bool DecodeFunctionBody(DecoderT& d, ModuleGenerator& mg,
                                uint32_t funcIndex) {
@@ -612,26 +621,36 @@ SharedModule wasm::CompileBuffer(const C
 }
 
 void wasm::CompileTier2(const CompileArgs& args, const Bytes& bytecode,
                         const Module& module, Atomic<bool>* cancelled) {
   UniqueChars error;
   Decoder d(bytecode, 0, &error);
 
   bool gcTypesConfigured = false;  // No optimized backend support yet
+#ifdef ENABLE_WASM_REFTYPES
   bool refTypesConfigured = !args.craneliftEnabled;
+#else
+  bool refTypesConfigured = false;
+#endif
+#ifdef ENABLE_WASM_MULTI_VALUE
+  bool multiValueConfigured = !args.craneliftEnabled;
+#else
+  bool multiValueConfigured = false;
+#endif
   bool bigIntConfigured = args.bigIntEnabled && !args.craneliftEnabled;
+
   OptimizedBackend optimizedBackend = args.craneliftEnabled
                                           ? OptimizedBackend::Cranelift
                                           : OptimizedBackend::Ion;
 
-  CompilerEnvironment compilerEnv(CompileMode::Tier2, Tier::Optimized,
-                                  optimizedBackend, DebugEnabled::False,
-                                  refTypesConfigured, gcTypesConfigured,
-                                  args.hugeMemory, bigIntConfigured);
+  CompilerEnvironment compilerEnv(
+      CompileMode::Tier2, Tier::Optimized, optimizedBackend,
+      DebugEnabled::False, multiValueConfigured, refTypesConfigured,
+      gcTypesConfigured, args.hugeMemory, bigIntConfigured);
 
   ModuleEnvironment env(&compilerEnv, args.sharedMemoryEnabled
                                           ? Shareable::True
                                           : Shareable::False);
   if (!DecodeModuleEnvironment(d, &env)) {
     return;
   }
 
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -2960,23 +2960,24 @@ bool wasm::DecodeModuleTail(Decoder& d, 
 // Validate algorithm.
 
 bool wasm::Validate(JSContext* cx, const ShareableBytes& bytecode,
                     UniqueChars* error) {
   Decoder d(bytecode.bytes, 0, error);
 
   bool gcTypesConfigured = HasGcSupport(cx);
   bool refTypesConfigured = HasReftypesSupport(cx);
+  bool multiValueConfigured = HasMultiValueSupport(cx);
   bool hugeMemory = false;
   bool bigIntConfigured = HasI64BigIntSupport(cx);
 
-  CompilerEnvironment compilerEnv(CompileMode::Once, Tier::Optimized,
-                                  OptimizedBackend::Ion, DebugEnabled::False,
-                                  refTypesConfigured, gcTypesConfigured,
-                                  hugeMemory, bigIntConfigured);
+  CompilerEnvironment compilerEnv(
+      CompileMode::Once, Tier::Optimized, OptimizedBackend::Ion,
+      DebugEnabled::False, multiValueConfigured, refTypesConfigured,
+      gcTypesConfigured, hugeMemory, bigIntConfigured);
   ModuleEnvironment env(
       &compilerEnv,
       cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled()
           ? Shareable::True
           : Shareable::False);
   if (!DecodeModuleEnvironment(d, &env)) {
     return false;
   }
--- a/js/src/wasm/WasmValidate.h
+++ b/js/src/wasm/WasmValidate.h
@@ -82,19 +82,19 @@ struct CompilerEnvironment {
   // will compute all parameters from the CompileArgs and additional values.
   explicit CompilerEnvironment(const CompileArgs& args);
 
   // Save the provided values for mode, tier, and debug, and the initial value
   // for gcTypes/refTypes. A subsequent computeParameters() will compute the
   // final value of gcTypes/refTypes.
   CompilerEnvironment(CompileMode mode, Tier tier,
                       OptimizedBackend optimizedBackend,
-                      DebugEnabled debugEnabled, bool refTypesConfigured,
-                      bool gcTypesConfigured, bool hugeMemory,
-                      bool bigIntConfigured);
+                      DebugEnabled debugEnabled, bool multiValueConfigured,
+                      bool refTypesConfigured, bool gcTypesConfigured,
+                      bool hugeMemory, bool bigIntConfigured);
 
   // Compute any remaining compilation parameters.
   void computeParameters(Decoder& d, bool gcFeatureOptIn);
 
   // Compute any remaining compilation parameters.  Only use this method if
   // the CompilerEnvironment was created with values for mode, tier, and
   // debug.
   void computeParameters(bool gcFeatureOptIn);