Changeset 260680 in webkit


Ignore:
Timestamp:
Apr 24, 2020 4:35:02 PM (4 years ago)
Author:
commit-queue@webkit.org
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 <Michael Catanzaro> on 2020-04-24
Reviewed by Yusuke Suzuki.

.:

  • Source/cmake/OptionsCommon.cmake:

Source/JavaScriptCore:

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:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r260672 r260680  
     12020-04-24  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        [GTK][WPE][JSCOnly] compile error when -DWTF_CPU_ARM64_CORTEXA53=ON set for arm64
     4        https://bugs.webkit.org/show_bug.cgi?id=197192
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * Source/cmake/OptionsCommon.cmake:
     9
    1102020-04-24  Christopher Reid  <chris.reid@sony.com>
    211
  • trunk/Source/JavaScriptCore/ChangeLog

    r260674 r260680  
     12020-04-24  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        [GTK][WPE][JSCOnly] compile error when -DWTF_CPU_ARM64_CORTEXA53=ON set for arm64
     4        https://bugs.webkit.org/show_bug.cgi?id=197192
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        This workaround is supposed to fix WebKit on old Cortex A53 CPUs, but it has been broken
     9        since 2018, and people would like to use WebKit on modern Cortex A53. If anyone using WebKit
     10        on the original hardware wants to fix and reimplement the workaround, feel free.
     11
     12        * assembler/ARM64Assembler.h:
     13        (JSC::ARM64Assembler::adrp):
     14        (JSC::ARM64Assembler::madd):
     15        (JSC::ARM64Assembler::msub):
     16        (JSC::ARM64Assembler::smaddl):
     17        (JSC::ARM64Assembler::smsubl):
     18        (JSC::ARM64Assembler::umaddl):
     19        (JSC::ARM64Assembler::umsubl):
     20        (JSC::ARM64Assembler::nopCortexA53Fix835769): Deleted.
     21        (JSC::ARM64Assembler::nopCortexA53Fix843419): Deleted.
     22        * offlineasm/arm64.rb:
     23        * offlineasm/instructions.rb:
     24
    1252020-04-24  Yusuke Suzuki  <ysuzuki@apple.com>
    226
  • trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h

    r259582 r260680  
    741741        ASSERT(!(offset & 0xfff));
    742742        insn(pcRelative(true, offset >> 12, rd));
    743         nopCortexA53Fix843419();
    744743    }
    745744
     
    13861385    {
    13871386        CHECK_DATASIZE();
    1388         nopCortexA53Fix835769<datasize>();
    13891387        insn(dataProcessing3Source(DATASIZE, DataOp_MADD, rm, ra, rn, rd));
    13901388    }
     
    14391437    {
    14401438        CHECK_DATASIZE();
    1441         nopCortexA53Fix835769<datasize>();
    14421439        insn(dataProcessing3Source(DATASIZE, DataOp_MSUB, rm, ra, rn, rd));
    14431440    }
     
    16871684    ALWAYS_INLINE void smaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
    16881685    {
    1689         nopCortexA53Fix835769<64>();
    16901686        insn(dataProcessing3Source(Datasize_64, DataOp_SMADDL, rm, ra, rn, rd));
    16911687    }
     
    16981694    ALWAYS_INLINE void smsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
    16991695    {
    1700         nopCortexA53Fix835769<64>();
    17011696        insn(dataProcessing3Source(Datasize_64, DataOp_SMSUBL, rm, ra, rn, rd));
    17021697    }
     
    19561951    ALWAYS_INLINE void umaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
    19571952    {
    1958         nopCortexA53Fix835769<64>();
    19591953        insn(dataProcessing3Source(Datasize_64, DataOp_UMADDL, rm, ra, rn, rd));
    19601954    }
     
    19671961    ALWAYS_INLINE void umsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra)
    19681962    {
    1969         nopCortexA53Fix835769<64>();
    19701963        insn(dataProcessing3Source(Datasize_64, DataOp_UMSUBL, rm, ra, rn, rd));
    19711964    }
     
    37293722    }
    37303723
    3731     // Workaround for Cortex-A53 erratum (835769). Emit an extra nop if the
    3732     // last instruction in the buffer is a load, store or prefetch. Needed
    3733     // before 64-bit multiply-accumulate instructions.
    3734     template<int datasize>
    3735     ALWAYS_INLINE void nopCortexA53Fix835769()
    3736     {
    3737 #if CPU(ARM64_CORTEXA53)
    3738         CHECK_DATASIZE();
    3739         if (datasize == 64) {
    3740             if (LIKELY(m_buffer.codeSize() >= sizeof(int32_t))) {
    3741                 // From ARMv8 Reference Manual, Section C4.1: the encoding of the
    3742                 // instructions in the Loads and stores instruction group is:
    3743                 // ---- 1-0- ---- ---- ---- ---- ---- ----
    3744                 if (UNLIKELY((*reinterpret_cast_ptr<int32_t*>(reinterpret_cast_ptr<char*>(m_buffer.data()) + m_buffer.codeSize() - sizeof(int32_t)) & 0x0a000000) == 0x08000000))
    3745                     nop();
    3746             }
    3747         }
    3748 #endif
    3749     }
    3750 
    3751     // Workaround for Cortex-A53 erratum (843419). Emit extra nops to avoid
    3752     // wrong address access after ADRP instruction.
    3753     ALWAYS_INLINE void nopCortexA53Fix843419()
    3754     {
    3755 #if CPU(ARM64_CORTEXA53)
    3756         nop();
    3757         nop();
    3758         nop();
    3759 #endif
    3760     }
    3761 
    37623724    Vector<LinkRecord, 0, UnsafeVectorOverflow> m_jumpsToLink;
    37633725    int m_indexOfLastWatchpoint;
  • trunk/Source/JavaScriptCore/offlineasm/arm64.rb

    r252422 r260680  
    352352end
    353353
    354 # Workaround for Cortex-A53 erratum (835769)
    355 def arm64CortexA53Fix835769(list)
    356     newList = []
    357     lastOpcodeUnsafe = false
    358 
    359     list.each {
    360         | node |
    361         if node.is_a? Instruction
    362             case node.opcode
    363             when /^store/, /^load/
    364                 # List all macro instructions that can be lowered to a load, store or prefetch ARM64 assembly instruction
    365                 lastOpcodeUnsafe = true
    366             when  "muli", "mulp", "mulq", "smulli"
    367                 # List all macro instructions that can be lowered to a 64-bit multiply-accumulate ARM64 assembly instruction
    368                 # (defined as one of MADD, MSUB, SMADDL, SMSUBL, UMADDL or UMSUBL).
    369                 if lastOpcodeUnsafe
    370                     newList << Instruction.new(node.codeOrigin, "nopCortexA53Fix835769", [])
    371                 end
    372                 lastOpcodeUnsafe = false
    373             else
    374                 lastOpcodeUnsafe = false
    375             end
    376         end
    377         newList << node
    378     }
    379     newList
    380 end
    381 
    382354class Sequence
    383355    def getModifiedListARM64(result = @list)
     
    471443        result = assignRegistersToTemporaries(result, :gpr, ARM64_EXTRA_GPRS)
    472444        result = assignRegistersToTemporaries(result, :fpr, ARM64_EXTRA_FPRS)
    473         result = arm64CortexA53Fix835769(result)
    474445        return result
    475446    end
     
    11161087        when "pcrtoaddr"
    11171088            $asm.puts "adr #{operands[1].arm64Operand(:quad)}, #{operands[0].value}"
    1118         when "nopCortexA53Fix835769"
    1119             $asm.putStr("#if CPU(ARM64_CORTEXA53)")
    1120             $asm.puts "nop"
    1121             $asm.putStr("#endif")
    11221089        when "globaladdr"
    11231090            uid = $asm.newUID
  • trunk/Source/JavaScriptCore/offlineasm/instructions.rb

    r252422 r260680  
    355355     "bfiq", # Bit field insert <source reg> <last bit written> <width immediate> <dest reg>
    356356     "pcrtoaddr",   # Address from PC relative offset - adr instruction
    357      "nopFixCortexA53Err835769", # nop on Cortex-A53 (nothing otherwise)
    358357     "globaladdr",
    359358     "divi",
  • trunk/Source/cmake/OptionsCommon.cmake

    r260554 r260680  
    1919set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    2020define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name")
    21 
    22 # Detect Cortex-A53 core if CPU is ARM64 and OS is Linux.
    23 # Query /proc/cpuinfo for each available core and check reported CPU part number: 0xd03 signals Cortex-A53.
    24 # (see Main ID Register in ARM Cortex-A53 MPCore Processor Technical Reference Manual)
    25 set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE OFF)
    26 if (WTF_CPU_ARM64 AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
    27     execute_process(COMMAND nproc OUTPUT_VARIABLE PROC_COUNT)
    28     math(EXPR PROC_MAX ${PROC_COUNT}-1)
    29     foreach (PROC_ID RANGE ${PROC_MAX})
    30         execute_process(COMMAND taskset -c ${PROC_ID} grep "^CPU part" /proc/cpuinfo OUTPUT_VARIABLE PROC_PART)
    31         if (PROC_PART MATCHES "0xd03")
    32             set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE ON)
    33             break ()
    34         endif ()
    35     endforeach ()
    36 endif ()
    37 option(WTF_CPU_ARM64_CORTEXA53 "Enable Cortex-A53-specific code paths" ${WTF_CPU_ARM64_CORTEXA53_INITIALVALUE})
    38 
    39 if (WTF_CPU_ARM64_CORTEXA53)
    40     if (NOT WTF_CPU_ARM64)
    41         message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64")
    42     endif ()
    43     WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-mfix-cortex-a53-835769)
    44 endif ()
    45 
    46 EXPOSE_VARIABLE_TO_BUILD(WTF_CPU_ARM64_CORTEXA53)
    4721
    4822set(ARM_TRADITIONAL_DETECTED FALSE)
Note: See TracChangeset for help on using the changeset viewer.