Backed out changeset 8cb2020d0325 (bug 1308996) for arm failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 24 Oct 2016 16:49:02 +0200
changeset 428747 c928343953fe9539448fd6cb54a905daa853e4de
parent 428684 8cb2020d0325cc15def6299cf270ebbdd4c0e31b
child 428748 f5f40e55b2e8ac2e64e203ac713339f62815c508
push id33413
push usermozilla@kaply.com
push dateMon, 24 Oct 2016 15:54:36 +0000
bugs1308996
milestone52.0a1
backs out8cb2020d0325cc15def6299cf270ebbdd4c0e31b
Backed out changeset 8cb2020d0325 (bug 1308996) for arm failures
js/src/jit/arm/Architecture-arm.cpp
js/src/jit/arm/Architecture-arm.h
js/src/jit/arm/Simulator-arm.cpp
--- a/js/src/jit/arm/Architecture-arm.cpp
+++ b/js/src/jit/arm/Architecture-arm.cpp
@@ -43,19 +43,16 @@ namespace jit {
 
 // Parse the Linux kernel cpuinfo features. This is also used to parse the
 // override features which has some extensions: 'armv7', 'align' and 'hardfp'.
 static uint32_t
 ParseARMCpuFeatures(const char* features, bool override = false)
 {
     uint32_t flags = 0;
 
-    // For ease of running tests we want it to be the default to fixup faults.
-    bool fixupAlignmentFault = true;
-
     for (;;) {
         char ch = *features;
         if (!ch) {
             // End of string.
             break;
         }
         if (ch == ' ' || ch == ',') {
             // Skip separator characters.
@@ -84,31 +81,25 @@ ParseARMCpuFeatures(const char* features
             flags |= HWCAP_IDIVA;
         else if (count == 5 && strncmp(features, "idivt", 5) == 0)
             flags |= HWCAP_IDIVT;
         else if (count == 6 && strncmp(features, "vfpd32", 6) == 0)
             flags |= HWCAP_VFPD32;
         else if (count == 5 && strncmp(features, "armv7", 5) == 0)
             flags |= HWCAP_ARMv7;
         else if (count == 5 && strncmp(features, "align", 5) == 0)
-            flags |= HWCAP_ALIGNMENT_FAULT | HWCAP_FIXUP_FAULT;
+            flags |= HWCAP_ALIGNMENT_FAULT;
 #if defined(JS_SIMULATOR_ARM)
-        else if (count == 7 && strncmp(features, "nofixup", 7) == 0)
-            fixupAlignmentFault = false;
         else if (count == 6 && strncmp(features, "hardfp", 6) == 0)
             flags |= HWCAP_USE_HARDFP_ABI;
 #endif
         else if (override)
             fprintf(stderr, "Warning: unexpected ARM feature at: %s\n", features);
         features = end;
     }
-
-    if (!fixupAlignmentFault)
-        flags &= ~HWCAP_FIXUP_FAULT;
-
     return flags;
 }
 
 static uint32_t
 CanonicalizeARMHwCapFlags(uint32_t flags)
 {
     // Canonicalize the flags. These rules are also applied to the features
     // supplied for simulation.
@@ -156,19 +147,18 @@ ParseARMHwCapFlags(const char* armHwCap)
                "  neon     \n"
                "  vfpv3    \n"
                "  vfpv3d16 \n"
                "  vfpv4    \n"
                "  idiva    \n"
                "  idivt    \n"
                "  vfpd32   \n"
                "  armv7    \n"
-               "  align    - unaligned accesses will trap and be emulated\n"
+               "  align    \n"
 #ifdef JS_SIMULATOR_ARM
-               "  nofixup  - disable emulation of unaligned accesses\n"
                "  hardfp   \n"
 #endif
                "\n"
                );
         exit(0);
         /*NOTREACHED*/
     }
 
--- a/js/src/jit/arm/Architecture-arm.h
+++ b/js/src/jit/arm/Architecture-arm.h
@@ -585,49 +585,36 @@ bool HasVFP();
 bool Has32DP();
 bool HasIDIV();
 
 extern volatile uint32_t armHwCapFlags;
 
 // Not part of the HWCAP flag, but we need to know these and these bits are not
 // used. Define these here so that their use can be inlined by the simulator.
 
-// A bit to flag when signaled alignment faults are to be fixed up.
-#define HWCAP_FIXUP_FAULT (1 << 24)
-
 // A bit to flag when the flags are uninitialized, so they can be atomically set.
 #define HWCAP_UNINITIALIZED (1 << 25)
 
 // A bit to flag when alignment faults are enabled and signal.
 #define HWCAP_ALIGNMENT_FAULT (1 << 26)
 
 // A bit to flag the use of the hardfp ABI.
 #define HWCAP_USE_HARDFP_ABI (1 << 27)
 
 // A bit to flag the use of the ARMv7 arch, otherwise ARMv6.
 #define HWCAP_ARMv7 (1 << 28)
 
-// Top three bits are reserved, do not use them.
-
 // Returns true when cpu alignment faults are enabled and signaled, and thus we
 // should ensure loads and stores are aligned.
 inline bool HasAlignmentFault()
 {
     MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
     return armHwCapFlags & HWCAP_ALIGNMENT_FAULT;
 }
 
-// Returns true when cpu alignment faults will be fixed up by the
-// "operating system", which functionality we will emulate.
-inline bool FixupFault()
-{
-    MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);
-    return armHwCapFlags & HWCAP_FIXUP_FAULT;
-}
-
 // Arm/D32 has double registers that can NOT be treated as float32 and this
 // requires some dances in lowering.
 inline bool
 hasUnaliasedDouble()
 {
     return Has32DP();
 }
 
--- a/js/src/jit/arm/Simulator-arm.cpp
+++ b/js/src/jit/arm/Simulator-arm.cpp
@@ -1567,17 +1567,17 @@ Simulator::readQ(int32_t addr, SimInstru
         return -1;
 
     if ((addr & 3) == 0 || (f == AllowUnaligned && !HasAlignmentFault())) {
         uint64_t* ptr = reinterpret_cast<uint64_t*>(addr);
         return *ptr;
     }
 
     // See the comments below in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         uint64_t value;
         memcpy(&value, ptr, sizeof(value));
         return value;
     }
 
     printf("Unaligned read at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
@@ -1590,18 +1590,18 @@ Simulator::writeQ(int32_t addr, uint64_t
         return;
 
     if ((addr & 3) == 0 || (f == AllowUnaligned && !HasAlignmentFault())) {
         uint64_t* ptr = reinterpret_cast<uint64_t*>(addr);
         *ptr = value;
         return;
     }
 
-    // See the comments below in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    // See the comments above in readW.
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         memcpy(ptr, &value, sizeof(value));
         return;
     }
 
     printf("Unaligned write at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
 }
@@ -1616,17 +1616,17 @@ Simulator::readW(int32_t addr, SimInstru
         intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
         return *ptr;
     }
 
     // In WebAssembly, we want unaligned accesses to either raise a signal or
     // do the right thing. Making this simulator properly emulate the behavior
     // of raising a signal is complex, so as a special-case, when in wasm code,
     // we just do the right thing.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         int value;
         memcpy(&value, ptr, sizeof(value));
         return value;
     }
 
     printf("Unaligned read at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
@@ -1640,17 +1640,17 @@ Simulator::writeW(int32_t addr, int valu
 
     if ((addr & 3) == 0 || (f == AllowUnaligned && !HasAlignmentFault())) {
         intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
         *ptr = value;
         return;
     }
 
     // See the comments above in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         memcpy(ptr, &value, sizeof(value));
         return;
     }
 
     printf("Unaligned write at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
 }
@@ -1715,18 +1715,18 @@ Simulator::readHU(int32_t addr, SimInstr
 
     // The regexp engine emits unaligned loads, so we don't check for them here
     // like most of the other methods do.
     if ((addr & 1) == 0 || !HasAlignmentFault()) {
         uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
         return *ptr;
     }
 
-    // See comments above in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    // See comments in readW.
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         uint16_t value;
         memcpy(&value, ptr, sizeof(value));
         return value;
     }
 
     printf("Unaligned unsigned halfword read at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
@@ -1739,18 +1739,18 @@ Simulator::readH(int32_t addr, SimInstru
     if (handleWasmFault(addr, 2))
         return -1;
 
     if ((addr & 1) == 0 || !HasAlignmentFault()) {
         int16_t* ptr = reinterpret_cast<int16_t*>(addr);
         return *ptr;
     }
 
-    // See comments above in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    // See comments in readW.
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         int16_t value;
         memcpy(&value, ptr, sizeof(value));
         return value;
     }
 
     printf("Unaligned signed halfword read at 0x%08x\n", addr);
     MOZ_CRASH();
@@ -1765,17 +1765,17 @@ Simulator::writeH(int32_t addr, uint16_t
 
     if ((addr & 1) == 0 || !HasAlignmentFault()) {
         uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
         *ptr = value;
         return;
     }
 
     // See the comments above in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         memcpy(ptr, &value, sizeof(value));
         return;
     }
 
     printf("Unaligned unsigned halfword write at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
 }
@@ -1788,17 +1788,17 @@ Simulator::writeH(int32_t addr, int16_t 
 
     if ((addr & 1) == 0 || !HasAlignmentFault()) {
         int16_t* ptr = reinterpret_cast<int16_t*>(addr);
         *ptr = value;
         return;
     }
 
     // See the comments above in readW.
-    if (FixupFault() && wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
+    if (wasm::IsPCInWasmCode(reinterpret_cast<void *>(get_pc()))) {
         char* ptr = reinterpret_cast<char*>(addr);
         memcpy(ptr, &value, sizeof(value));
         return;
     }
 
     printf("Unaligned halfword write at 0x%08x, pc=%p\n", addr, instr);
     MOZ_CRASH();
 }