Title: [260680] trunk
Revision
260680
Author
[email protected]
Date
2020-04-24 16:35:02 -0700 (Fri, 24 Apr 2020)

Log Message

[GTK][WPE][JSCOnly] compile error when -DWTF_CPU_ARM64_CORTEXA53=ON set for arm64
https://bugs.webkit.org/show_bug.cgi?id=197192

Patch by Michael Catanzaro <[email protected]> on 2020-04-24
Reviewed by Yusuke Suzuki.

.:

* Source/cmake/OptionsCommon.cmake:

Source/_javascript_Core:

This workaround is supposed to fix WebKit on old Cortex A53 CPUs, but it has been broken
since 2018, and people would like to use WebKit on modern Cortex A53. If anyone using WebKit
on the original hardware wants to fix and reimplement the workaround, feel free.

* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::adrp):
(JSC::ARM64Assembler::madd):
(JSC::ARM64Assembler::msub):
(JSC::ARM64Assembler::smaddl):
(JSC::ARM64Assembler::smsubl):
(JSC::ARM64Assembler::umaddl):
(JSC::ARM64Assembler::umsubl):
(JSC::ARM64Assembler::nopCortexA53Fix835769): Deleted.
(JSC::ARM64Assembler::nopCortexA53Fix843419): Deleted.
* offlineasm/arm64.rb:
* offlineasm/instructions.rb:

Modified Paths

Diff

Modified: trunk/ChangeLog (260679 => 260680)


--- trunk/ChangeLog	2020-04-24 23:32:04 UTC (rev 260679)
+++ trunk/ChangeLog	2020-04-24 23:35:02 UTC (rev 260680)
@@ -1,3 +1,12 @@
+2020-04-24  Michael Catanzaro  <[email protected]>
+
+        [GTK][WPE][JSCOnly] compile error when -DWTF_CPU_ARM64_CORTEXA53=ON set for arm64
+        https://bugs.webkit.org/show_bug.cgi?id=197192
+
+        Reviewed by Yusuke Suzuki.
+
+        * Source/cmake/OptionsCommon.cmake:
+
 2020-04-24  Christopher Reid  <[email protected]>
 
         [Win] Bundle Inspector Resources in Release builds

Modified: trunk/Source/_javascript_Core/ChangeLog (260679 => 260680)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-24 23:32:04 UTC (rev 260679)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-24 23:35:02 UTC (rev 260680)
@@ -1,3 +1,27 @@
+2020-04-24  Michael Catanzaro  <[email protected]>
+
+        [GTK][WPE][JSCOnly] compile error when -DWTF_CPU_ARM64_CORTEXA53=ON set for arm64
+        https://bugs.webkit.org/show_bug.cgi?id=197192
+
+        Reviewed by Yusuke Suzuki.
+
+        This workaround is supposed to fix WebKit on old Cortex A53 CPUs, but it has been broken
+        since 2018, and people would like to use WebKit on modern Cortex A53. If anyone using WebKit
+        on the original hardware wants to fix and reimplement the workaround, feel free.
+
+        * assembler/ARM64Assembler.h:
+        (JSC::ARM64Assembler::adrp):
+        (JSC::ARM64Assembler::madd):
+        (JSC::ARM64Assembler::msub):
+        (JSC::ARM64Assembler::smaddl):
+        (JSC::ARM64Assembler::smsubl):
+        (JSC::ARM64Assembler::umaddl):
+        (JSC::ARM64Assembler::umsubl):
+        (JSC::ARM64Assembler::nopCortexA53Fix835769): Deleted.
+        (JSC::ARM64Assembler::nopCortexA53Fix843419): Deleted.
+        * offlineasm/arm64.rb:
+        * offlineasm/instructions.rb:
+
 2020-04-24  Yusuke Suzuki  <[email protected]>
 
         [JSC] Fix DataFormatJSBigInt32 missing part

Modified: trunk/Source/_javascript_Core/assembler/ARM64Assembler.h (260679 => 260680)


--- trunk/Source/_javascript_Core/assembler/ARM64Assembler.h	2020-04-24 23:32:04 UTC (rev 260679)
+++ trunk/Source/_javascript_Core/assembler/ARM64Assembler.h	2020-04-24 23:35:02 UTC (rev 260680)
@@ -740,7 +740,6 @@
     {
         ASSERT(!(offset & 0xfff));
         insn(pcRelative(true, offset >> 12, rd));
-        nopCortexA53Fix843419();
     }
 
     template<int datasize, SetFlags setFlags = DontSetFlags>
@@ -1385,7 +1384,6 @@
     ALWAYS_INLINE void madd(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
     {
         CHECK_DATASIZE();
-        nopCortexA53Fix835769<datasize>();
         insn(dataProcessing3Source(DATASIZE, DataOp_MADD, rm, ra, rn, rd));
     }
 
@@ -1438,7 +1436,6 @@
     ALWAYS_INLINE void msub(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
     {
         CHECK_DATASIZE();
-        nopCortexA53Fix835769<datasize>();
         insn(dataProcessing3Source(DATASIZE, DataOp_MSUB, rm, ra, rn, rd));
     }
 
@@ -1686,7 +1683,6 @@
 
     ALWAYS_INLINE void smaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
     {
-        nopCortexA53Fix835769<64>();
         insn(dataProcessing3Source(Datasize_64, DataOp_SMADDL, rm, ra, rn, rd));
     }
 
@@ -1697,7 +1693,6 @@
 
     ALWAYS_INLINE void smsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
     {
-        nopCortexA53Fix835769<64>();
         insn(dataProcessing3Source(Datasize_64, DataOp_SMSUBL, rm, ra, rn, rd));
     }
 
@@ -1955,7 +1950,6 @@
 
     ALWAYS_INLINE void umaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
     {
-        nopCortexA53Fix835769<64>();
         insn(dataProcessing3Source(Datasize_64, DataOp_UMADDL, rm, ra, rn, rd));
     }
 
@@ -1966,7 +1960,6 @@
 
     ALWAYS_INLINE void umsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
     {
-        nopCortexA53Fix835769<64>();
         insn(dataProcessing3Source(Datasize_64, DataOp_UMSUBL, rm, ra, rn, rd));
     }
 
@@ -3728,37 +3721,6 @@
         return 0x1e7e0000 | (dn << 5) | rd;
     }
 
-    // Workaround for Cortex-A53 erratum (835769). Emit an extra nop if the
-    // last instruction in the buffer is a load, store or prefetch. Needed
-    // before 64-bit multiply-accumulate instructions.
-    template<int datasize>
-    ALWAYS_INLINE void nopCortexA53Fix835769()
-    {
-#if CPU(ARM64_CORTEXA53)
-        CHECK_DATASIZE();
-        if (datasize == 64) {
-            if (LIKELY(m_buffer.codeSize() >= sizeof(int32_t))) {
-                // From ARMv8 Reference Manual, Section C4.1: the encoding of the
-                // instructions in the Loads and stores instruction group is:
-                // ---- 1-0- ---- ---- ---- ---- ---- ----
-                if (UNLIKELY((*reinterpret_cast_ptr<int32_t*>(reinterpret_cast_ptr<char*>(m_buffer.data()) + m_buffer.codeSize() - sizeof(int32_t)) & 0x0a000000) == 0x08000000))
-                    nop();
-            }
-        }
-#endif
-    }
-
-    // Workaround for Cortex-A53 erratum (843419). Emit extra nops to avoid
-    // wrong address access after ADRP instruction.
-    ALWAYS_INLINE void nopCortexA53Fix843419()
-    {
-#if CPU(ARM64_CORTEXA53)
-        nop();
-        nop();
-        nop();
-#endif
-    }
-
     Vector<LinkRecord, 0, UnsafeVectorOverflow> m_jumpsToLink;
     int m_indexOfLastWatchpoint;
     int m_indexOfTailOfLastWatchpoint;

Modified: trunk/Source/_javascript_Core/offlineasm/arm64.rb (260679 => 260680)


--- trunk/Source/_javascript_Core/offlineasm/arm64.rb	2020-04-24 23:32:04 UTC (rev 260679)
+++ trunk/Source/_javascript_Core/offlineasm/arm64.rb	2020-04-24 23:35:02 UTC (rev 260680)
@@ -351,34 +351,6 @@
     newList
 end
 
-# Workaround for Cortex-A53 erratum (835769)
-def arm64CortexA53Fix835769(list)
-    newList = []
-    lastOpcodeUnsafe = false
-
-    list.each {
-        | node |
-        if node.is_a? Instruction
-            case node.opcode
-            when /^store/, /^load/
-                # List all macro instructions that can be lowered to a load, store or prefetch ARM64 assembly instruction
-                lastOpcodeUnsafe = true
-            when  "muli", "mulp", "mulq", "smulli"
-                # List all macro instructions that can be lowered to a 64-bit multiply-accumulate ARM64 assembly instruction
-                # (defined as one of MADD, MSUB, SMADDL, SMSUBL, UMADDL or UMSUBL).
-                if lastOpcodeUnsafe
-                    newList << Instruction.new(node.codeOrigin, "nopCortexA53Fix835769", [])
-                end
-                lastOpcodeUnsafe = false
-            else
-                lastOpcodeUnsafe = false
-            end
-        end
-        newList << node
-    }
-    newList
-end
-
 class Sequence
     def getModifiedListARM64(result = @list)
         result = riscLowerNot(result)
@@ -470,7 +442,6 @@
         result = arm64FixSpecialRegisterArithmeticMode(result)
         result = assignRegistersToTemporaries(result, :gpr, ARM64_EXTRA_GPRS)
         result = assignRegistersToTemporaries(result, :fpr, ARM64_EXTRA_FPRS)
-        result = arm64CortexA53Fix835769(result)
         return result
     end
 end
@@ -1115,10 +1086,6 @@
             $asm.puts "bfi #{operands[3].arm64Operand(:quad)}, #{operands[0].arm64Operand(:quad)}, #{operands[1].value}, #{operands[2].value}"
         when "pcrtoaddr"
             $asm.puts "adr #{operands[1].arm64Operand(:quad)}, #{operands[0].value}"
-        when "nopCortexA53Fix835769"
-            $asm.putStr("#if CPU(ARM64_CORTEXA53)")
-            $asm.puts "nop"
-            $asm.putStr("#endif")
         when "globaladdr"
             uid = $asm.newUID
 

Modified: trunk/Source/_javascript_Core/offlineasm/instructions.rb (260679 => 260680)


--- trunk/Source/_javascript_Core/offlineasm/instructions.rb	2020-04-24 23:32:04 UTC (rev 260679)
+++ trunk/Source/_javascript_Core/offlineasm/instructions.rb	2020-04-24 23:35:02 UTC (rev 260680)
@@ -354,7 +354,6 @@
     [
      "bfiq", # Bit field insert <source reg> <last bit written> <width immediate> <dest reg>
      "pcrtoaddr",   # Address from PC relative offset - adr instruction
-     "nopFixCortexA53Err835769", # nop on Cortex-A53 (nothing otherwise)
      "globaladdr",
      "divi",
      "divis",

Modified: trunk/Source/cmake/OptionsCommon.cmake (260679 => 260680)


--- trunk/Source/cmake/OptionsCommon.cmake	2020-04-24 23:32:04 UTC (rev 260679)
+++ trunk/Source/cmake/OptionsCommon.cmake	2020-04-24 23:35:02 UTC (rev 260680)
@@ -19,32 +19,6 @@
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name")
 
-# Detect Cortex-A53 core if CPU is ARM64 and OS is Linux.
-# Query /proc/cpuinfo for each available core and check reported CPU part number: 0xd03 signals Cortex-A53.
-# (see Main ID Register in ARM Cortex-A53 MPCore Processor Technical Reference Manual)
-set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE OFF)
-if (WTF_CPU_ARM64 AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
-    execute_process(COMMAND nproc OUTPUT_VARIABLE PROC_COUNT)
-    math(EXPR PROC_MAX ${PROC_COUNT}-1)
-    foreach (PROC_ID RANGE ${PROC_MAX})
-        execute_process(COMMAND taskset -c ${PROC_ID} grep "^CPU part" /proc/cpuinfo OUTPUT_VARIABLE PROC_PART)
-        if (PROC_PART MATCHES "0xd03")
-            set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE ON)
-            break ()
-        endif ()
-    endforeach ()
-endif ()
-option(WTF_CPU_ARM64_CORTEXA53 "Enable Cortex-A53-specific code paths" ${WTF_CPU_ARM64_CORTEXA53_INITIALVALUE})
-
-if (WTF_CPU_ARM64_CORTEXA53)
-    if (NOT WTF_CPU_ARM64)
-        message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64")
-    endif ()
-    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-mfix-cortex-a53-835769)
-endif ()
-
-EXPOSE_VARIABLE_TO_BUILD(WTF_CPU_ARM64_CORTEXA53)
-
 set(ARM_TRADITIONAL_DETECTED FALSE)
 if (WTF_CPU_ARM)
     set(ARM_THUMB2_TEST_SOURCE
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to