Bug 1453628 - [MIPS64] Cleanup JIT <-> C++ 32-bit argument passing for simulator build. r=bbouvier
authorDragan Mladjenovic <dragan.mladjenovic@rt-rk.com>
Mon, 16 Apr 2018 09:03:40 -0400
changeset 467373 f88b7fb02d30e6cce1e9f3c49d0a2c242d2a30bd
parent 467372 efac2c840d9be2cd675a541bf60443906330f3b6
child 467374 a1869efdd7aa8162dd68eb47288dffc528ce7980
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1453628
milestone61.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 1453628 - [MIPS64] Cleanup JIT <-> C++ 32-bit argument passing for simulator build. r=bbouvier
js/src/jit/JitCommon.h
js/src/jit/arm/Simulator-arm.cpp
js/src/jit/mips32/Simulator-mips32.cpp
js/src/jit/mips64/Simulator-mips64.cpp
--- a/js/src/jit/JitCommon.h
+++ b/js/src/jit/JitCommon.h
@@ -16,31 +16,32 @@
 #elif defined(JS_SIMULATOR_MIPS32)
 #include "jit/mips32/Simulator-mips32.h"
 #elif defined(JS_SIMULATOR_MIPS64)
 #include "jit/mips64/Simulator-mips64.h"
 #endif
 
 #ifdef JS_SIMULATOR
 // Call into cross-jitted code by following the ABI of the simulated architecture.
-#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7)     \
-    (js::jit::Simulator::Current()->call(                              \
-        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 8, p0, p1, p2, p3, p4, p5, p6, p7))
+#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7)                         \
+    (js::jit::Simulator::Current()->call(                                                  \
+        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 8, intptr_t(p0), intptr_t(p1), intptr_t(p2), \
+                            intptr_t(p3), intptr_t(p4), intptr_t(p5), intptr_t(p6), intptr_t(p7)))
 
 #define CALL_GENERATED_1(entry, p0)                     \
     (js::jit::Simulator::Current()->call(               \
-        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 1, p0))
+        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 1, intptr_t(p0)))
 
 #define CALL_GENERATED_2(entry, p0, p1)                                 \
     (js::jit::Simulator::Current()->call(                               \
-        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 2, p0, p1))
+        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 2, intptr_t(p0), intptr_t(p1)))
 
 #define CALL_GENERATED_3(entry, p0, p1, p2)                             \
     (js::jit::Simulator::Current()->call(                               \
-        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 3, p0, p1, p2))
+        JS_FUNC_TO_DATA_PTR(uint8_t*, entry), 3, intptr_t(p0), intptr_t(p1), intptr_t(p2)))
 
 #else
 
 // Call into jitted code by following the ABI of the native architecture.
 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7)   \
   entry(p0, p1, p2, p3, p4, p5, p6, p7)
 
 #define CALL_GENERATED_1(entry, p0)         entry(p0)
--- a/js/src/jit/arm/Simulator-arm.cpp
+++ b/js/src/jit/arm/Simulator-arm.cpp
@@ -2543,17 +2543,17 @@ typedef int32_t (*Prototype_Int_Double)(
 typedef int64_t (*Prototype_Int64_Double)(double arg0);
 typedef int32_t (*Prototype_Int_DoubleIntInt)(double arg0, int32_t arg1, int32_t arg2);
 typedef int32_t (*Prototype_Int_IntDoubleIntInt)(int32_t arg0, double arg1, int32_t arg2,
                                                  int32_t arg3);
 typedef float (*Prototype_Float32_Float32)(float arg0);
 typedef float (*Prototype_Float32_Float32Float32)(float arg0, float arg1);
 typedef float (*Prototype_Float32_IntInt)(int arg0, int arg1);
 
-typedef double (*Prototype_DoubleInt)(double arg0, int32_t arg1);
+typedef double (*Prototype_Double_DoubleInt)(double arg0, int32_t arg1);
 typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double arg1);
 typedef double (*Prototype_Double_DoubleDouble)(double arg0, double arg1);
 typedef int32_t (*Prototype_Int_IntDouble)(int32_t arg0, double arg1);
 
 typedef double (*Prototype_Double_DoubleDoubleDouble)(double arg0, double arg1, double arg2);
 typedef double (*Prototype_Double_DoubleDoubleDoubleDouble)(double arg0, double arg1,
                                                             double arg2, double arg3);
 
@@ -2793,17 +2793,17 @@ Simulator::softwareInterrupt(SimInstruct
             scratchVolatileRegisters(/* scratchFloat = true */);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleInt: {
             double dval0, dval1;
             int32_t ival;
             getFpArgs(&dval0, &dval1, &ival);
-            Prototype_DoubleInt target = reinterpret_cast<Prototype_DoubleInt>(external);
+            Prototype_Double_DoubleInt target = reinterpret_cast<Prototype_Double_DoubleInt>(external);
             double dresult = target(dval0, ival);
             scratchVolatileRegisters(/* scratchFloat = true */);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleDouble: {
             double dval0, dval1;
             int32_t ival;
--- a/js/src/jit/mips32/Simulator-mips32.cpp
+++ b/js/src/jit/mips32/Simulator-mips32.cpp
@@ -2014,17 +2014,17 @@ typedef int32_t (*Prototype_Int_Double)(
 typedef int64_t (*Prototype_Int64_Double)(double arg0);
 typedef int32_t (*Prototype_Int_DoubleIntInt)(double arg0, int32_t arg1, int32_t arg2);
 typedef int32_t (*Prototype_Int_IntDoubleIntInt)(int32_t arg0, double arg1, int32_t arg2,
                                                  int32_t arg3);
 typedef float (*Prototype_Float32_Float32)(float arg0);
 typedef float (*Prototype_Float32_Float32Float32)(float arg0, float arg1);
 typedef float (*Prototype_Float32_IntInt)(int arg0, int arg1);
 
-typedef double (*Prototype_DoubleInt)(double arg0, int32_t arg1);
+typedef double (*Prototype_Double_DoubleInt)(double arg0, int32_t arg1);
 typedef double (*Prototype_Double_IntInt)(int32_t arg0, int32_t arg1);
 typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double arg1);
 typedef double (*Prototype_Double_DoubleDouble)(double arg0, double arg1);
 typedef int32_t (*Prototype_Int_IntDouble)(int32_t arg0, double arg1);
 
 typedef double (*Prototype_Double_DoubleDoubleDouble)(double arg0, double arg1, double arg2);
 typedef double (*Prototype_Double_DoubleDoubleDoubleDouble)(double arg0, double arg1,
                                                             double arg2, double arg3);
@@ -2229,17 +2229,17 @@ Simulator::softwareInterrupt(SimInstruct
             double dresult = target(arg0, arg1);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleInt: {
             double dval0, dval1;
             int32_t ival;
             getFpArgs(&dval0, &dval1, &ival);
-            Prototype_DoubleInt target = reinterpret_cast<Prototype_DoubleInt>(external);
+            Prototype_Double_DoubleInt target = reinterpret_cast<Prototype_Double_DoubleInt>(external);
             double dresult = target(dval0, ival);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleDouble: {
             double dval0, dval1;
             int32_t ival;
             getFpArgs(&dval0, &dval1, &ival);
--- a/js/src/jit/mips64/Simulator-mips64.cpp
+++ b/js/src/jit/mips64/Simulator-mips64.cpp
@@ -2104,35 +2104,35 @@ typedef int64_t (*Prototype_General4)(in
 typedef int64_t (*Prototype_General5)(int64_t arg0, int64_t arg1, int64_t arg2, int64_t arg3,
                                       int64_t arg4);
 typedef int64_t (*Prototype_General6)(int64_t arg0, int64_t arg1, int64_t arg2, int64_t arg3,
                                       int64_t arg4, int64_t arg5);
 typedef int64_t (*Prototype_General7)(int64_t arg0, int64_t arg1, int64_t arg2, int64_t arg3,
                                       int64_t arg4, int64_t arg5, int64_t arg6);
 typedef int64_t (*Prototype_General8)(int64_t arg0, int64_t arg1, int64_t arg2, int64_t arg3,
                                       int64_t arg4, int64_t arg5, int64_t arg6, int64_t arg7);
-typedef int64_t (*Prototype_GeneralGeneralGeneralInt64)(int64_t arg0, int64_t arg1, int64_t arg2,
+typedef int32_t (*Prototype_Int_GeneralGeneralGeneralInt64)(int64_t arg0, int64_t arg1, int64_t arg2,
                                                         int64_t arg3);
-typedef int64_t (*Prototype_GeneralGeneralInt64Int64)(int64_t arg0, int64_t arg1, int64_t arg2,
+typedef int32_t (*Prototype_Int_GeneralGeneralInt64Int64)(int64_t arg0, int64_t arg1, int64_t arg2,
                                                       int64_t arg3);
 typedef double (*Prototype_Double_None)();
 typedef double (*Prototype_Double_Double)(double arg0);
-typedef double (*Prototype_Double_Int)(int64_t arg0);
-typedef int64_t (*Prototype_Int_Double)(double arg0);
-typedef int64_t (*Prototype_Int_DoubleIntInt)(double arg0, int64_t arg1, int64_t arg2);
-typedef int64_t (*Prototype_Int_IntDoubleIntInt)(int64_t arg0, double arg1, int64_t arg2,
-                                                 int64_t arg3);
+typedef double (*Prototype_Double_Int)(int32_t arg0);
+typedef int32_t (*Prototype_Int_Double)(double arg0);
+typedef int32_t (*Prototype_Int_DoubleIntInt)(double arg0, int32_t arg1, int32_t arg2);
+typedef int32_t (*Prototype_Int_IntDoubleIntInt)(int32_t arg0, double arg1, int32_t arg2,
+                                                 int32_t arg3);
 typedef float (*Prototype_Float32_Float32)(float arg0);
 typedef float (*Prototype_Float32_Float32Float32)(float arg0, float arg1);
-typedef float (*Prototype_Float32_IntInt)(int arg0, int arg1);
-
-typedef double (*Prototype_DoubleInt)(double arg0, int64_t arg1);
-typedef double (*Prototype_Double_IntDouble)(int64_t arg0, double arg1);
+typedef float (*Prototype_Float32_IntInt)(int32_t arg0, int32_t arg1);
+
+typedef double (*Prototype_Double_DoubleInt)(double arg0, int32_t arg1);
+typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double arg1);
 typedef double (*Prototype_Double_DoubleDouble)(double arg0, double arg1);
-typedef int64_t (*Prototype_Int_IntDouble)(int64_t arg0, double arg1);
+typedef int32_t (*Prototype_Int_IntDouble)(int32_t arg0, double arg1);
 
 typedef double (*Prototype_Double_DoubleDoubleDouble)(double arg0, double arg1, double arg2);
 typedef double (*Prototype_Double_DoubleDoubleDoubleDouble)(double arg0, double arg1,
                                                             double arg2, double arg3);
 
 // Software interrupt instructions are used by the simulator to call into C++.
 void
 Simulator::softwareInterrupt(SimInstruction* instr)
@@ -2233,51 +2233,45 @@ Simulator::softwareInterrupt(SimInstruct
             Prototype_Double_None target = reinterpret_cast<Prototype_Double_None>(external);
             double dresult = target();
             setCallResultDouble(dresult);
             break;
           }
           case Args_Int_Double: {
             double dval0 = getFpuRegisterDouble(12);
             Prototype_Int_Double target = reinterpret_cast<Prototype_Int_Double>(external);
-            int64_t res = target(dval0);
+            int32_t res = target(dval0);
             setRegister(v0, res);
             break;
           }
           case Args_Int_GeneralGeneralGeneralInt64: {
-            Prototype_GeneralGeneralGeneralInt64 target =
-                reinterpret_cast<Prototype_GeneralGeneralGeneralInt64>(external);
-            int64_t result = target(arg0, arg1, arg2, arg3);
-            if(external == intptr_t(&js::wasm::Instance::wait_i32)) {
-                result = int32_t(result);
-            }
-            setCallResult(result);
+            Prototype_Int_GeneralGeneralGeneralInt64 target =
+                reinterpret_cast<Prototype_Int_GeneralGeneralGeneralInt64>(external);
+            int32_t res = target(arg0, arg1, arg2, arg3);
+            setRegister(v0, res);
             break;
           }
           case Args_Int_GeneralGeneralInt64Int64: {
-            Prototype_GeneralGeneralInt64Int64 target =
-                reinterpret_cast<Prototype_GeneralGeneralInt64Int64>(external);
-            int64_t result = target(arg0, arg1, arg2, arg3);
-            if(external == intptr_t(&js::wasm::Instance::wait_i64)) {
-                result = int32_t(result);
-            }
-            setCallResult(result);
+            Prototype_Int_GeneralGeneralInt64Int64 target =
+                reinterpret_cast<Prototype_Int_GeneralGeneralInt64Int64>(external);
+            int32_t res = target(arg0, arg1, arg2, arg3);
+            setRegister(v0, res);
             break;
           }
           case Args_Int_DoubleIntInt: {
             double dval = getFpuRegisterDouble(12);
             Prototype_Int_DoubleIntInt target = reinterpret_cast<Prototype_Int_DoubleIntInt>(external);
-            int64_t res = target(dval, arg1, arg2);
+            int32_t res = target(dval, int32_t(arg1), int32_t(arg2));
             setRegister(v0, res);
             break;
           }
           case Args_Int_IntDoubleIntInt: {
             double dval = getFpuRegisterDouble(13);
             Prototype_Int_IntDoubleIntInt target = reinterpret_cast<Prototype_Int_IntDoubleIntInt>(external);
-            int64_t res = target(arg0, dval, arg2, arg3);
+            int32_t res = target(int32_t(arg0), dval, int32_t(arg2), int32_t(arg3));
             setRegister(v0, res);
             break;
           }
           case Args_Double_Double: {
             double dval0 = getFpuRegisterDouble(12);
             Prototype_Double_Double target = reinterpret_cast<Prototype_Double_Double>(external);
             double dresult = target(dval0);
             setCallResultDouble(dresult);
@@ -2298,52 +2292,52 @@ Simulator::softwareInterrupt(SimInstruct
             fval1 = getFpuRegisterFloat(13);
             Prototype_Float32_Float32Float32 target = reinterpret_cast<Prototype_Float32_Float32Float32>(external);
             float fresult = target(fval0, fval1);
             setCallResultFloat(fresult);
             break;
           }
           case Args_Float32_IntInt: {
             Prototype_Float32_IntInt target = reinterpret_cast<Prototype_Float32_IntInt>(external);
-            float fresult = target(arg0, arg1);
+            float fresult = target(int32_t(arg0), int32_t(arg1));
             setCallResultFloat(fresult);
             break;
           }
           case Args_Double_Int: {
             Prototype_Double_Int target = reinterpret_cast<Prototype_Double_Int>(external);
-            double dresult = target(arg0);
+            double dresult = target(int32_t(arg0));
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleInt: {
             double dval0 = getFpuRegisterDouble(12);
-            Prototype_DoubleInt target = reinterpret_cast<Prototype_DoubleInt>(external);
-            double dresult = target(dval0, arg1);
+            Prototype_Double_DoubleInt target = reinterpret_cast<Prototype_Double_DoubleInt>(external);
+            double dresult = target(dval0, int32_t(arg1));
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_DoubleDouble: {
             double dval0 = getFpuRegisterDouble(12);
             double dval1 = getFpuRegisterDouble(13);
             Prototype_Double_DoubleDouble target = reinterpret_cast<Prototype_Double_DoubleDouble>(external);
             double dresult = target(dval0, dval1);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Double_IntDouble: {
             double dval1 = getFpuRegisterDouble(13);
             Prototype_Double_IntDouble target = reinterpret_cast<Prototype_Double_IntDouble>(external);
-            double dresult = target(arg0, dval1);
+            double dresult = target(int32_t(arg0), dval1);
             setCallResultDouble(dresult);
             break;
           }
           case Args_Int_IntDouble: {
             double dval1 = getFpuRegisterDouble(13);
             Prototype_Int_IntDouble target = reinterpret_cast<Prototype_Int_IntDouble>(external);
-            int64_t result = target(arg0, dval1);
+            int32_t result = target(int32_t(arg0), dval1);
             setRegister(v0, result);
             break;
           }
           case Args_Double_DoubleDoubleDouble: {
             double dval0 = getFpuRegisterDouble(12);
             double dval1 = getFpuRegisterDouble(13);
             double dval2 = getFpuRegisterDouble(14);
             Prototype_Double_DoubleDoubleDouble target =