Bug 1647295 - assert that we're not using a forbidden ABI. r=rhunt
authorLars T Hansen <lhansen@mozilla.com>
Tue, 23 Jun 2020 14:56:52 +0000
changeset 536919 45683d53e9089b96998d44f1dd161ff19c08bd27
parent 536918 5a872ac49db2ff1e805d30377fdf3dad66373d5b
child 536920 c7f363de938afc45261800ca4d2fbf3ee4851ad4
push id37533
push userdluca@mozilla.com
push dateTue, 23 Jun 2020 21:38:40 +0000
treeherdermozilla-central@d48aa0f0aa0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1647295
milestone79.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 1647295 - assert that we're not using a forbidden ABI. r=rhunt For regular calls, the combination of the system ABI and softFP is forbidden because the code that handles multi-value returns does not contain the special-case workarounds that are needed to move GPR results into FPRs. Assert that we're not running into this. Differential Revision: https://phabricator.services.mozilla.com/D80510
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -4820,20 +4820,16 @@ class BaseCompiler final : public BaseCo
       }
     }
   }
 
   void pushBlockResults(ResultType type) {
     pushResults(type, controlItem().stackHeight);
   }
 
-  void pushCallResults(ResultType type, const StackResultsLoc& loc) {
-    pushResults(type, fr.stackResultsBase(loc.bytes()));
-  }
-
   // A combination of popBlockResults + pushBlockResults, used when entering a
   // block with a control-flow join (loops) or split (if) to shuffle the
   // fallthrough block parameters into the locations expected by the
   // continuation.
   void topBlockParams(ResultType type) {
     // This function should only be called when entering a block with a
     // control-flow join at the entry, where there are no live temporaries in
     // the current block.
@@ -5786,16 +5782,29 @@ class BaseCompiler final : public BaseCo
     // Builtin method calls assume the TLS register has been set.
     fr.loadTlsPtr(WasmTlsReg);
 
     CallSiteDesc desc(call.lineOrBytecode, CallSiteDesc::Symbolic);
     return masm.wasmCallBuiltinInstanceMethod(
         desc, instanceArg, builtin.identity, builtin.failureMode);
   }
 
+  void pushCallResults(const FunctionCall& call, ResultType type,
+                       const StackResultsLoc& loc) {
+#if defined(JS_CODEGEN_ARM)
+    // pushResults currently bypasses special case code in captureReturnedFxx()
+    // that converts GPR results to FPR results for systemABI+softFP.  If we
+    // ever start using that combination for calls we need more code.  This
+    // assert is stronger than we need - we only care about results in return
+    // registers - but that's OK.
+    MOZ_ASSERT(!call.usesSystemAbi || call.hardFP);
+#endif
+    pushResults(type, fr.stackResultsBase(loc.bytes()));
+  }
+
   //////////////////////////////////////////////////////////////////////
   //
   // Sundry low-level code generators.
 
   // The compiler depends on moveImm32() clearing the high bits of a 64-bit
   // register on 64-bit systems except MIPS64 where high bits are sign extended
   // from lower bits.
 
@@ -10108,17 +10117,17 @@ bool BaseCompiler::emitCall() {
 
   popStackResultsAfterCall(results, stackArgBytes);
 
   endCall(baselineCall, stackArgBytes);
 
   popValueStackBy(numArgs);
 
   captureResultRegisters(resultType);
-  pushCallResults(resultType, results);
+  pushCallResults(baselineCall, resultType, results);
 
   return true;
 }
 
 bool BaseCompiler::emitCallIndirect() {
   uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
 
   uint32_t funcTypeIndex;
@@ -10165,17 +10174,17 @@ bool BaseCompiler::emitCallIndirect() {
 
   popStackResultsAfterCall(results, stackArgBytes);
 
   endCall(baselineCall, stackArgBytes);
 
   popValueStackBy(numArgs);
 
   captureResultRegisters(resultType);
-  pushCallResults(resultType, results);
+  pushCallResults(baselineCall, resultType, results);
 
   return true;
 }
 
 void BaseCompiler::emitRound(RoundingMode roundingMode, ValType operandType) {
   if (operandType == ValType::F32) {
     RegF32 f0 = popF32();
     roundF32(roundingMode, f0);