Changeset 175514 in webkit
- Timestamp:
- Nov 3, 2014 11:36:15 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r175465 r175514 1 2014-11-03 Akos Kiss <akiss@inf.u-szeged.hu> 2 3 Workaround for Cortex-A53 erratum 835769 4 https://bugs.webkit.org/show_bug.cgi?id=138315 5 6 Reviewed by Filip Pizlo. 7 8 This patch introduces CMake variable and preprocessor macro 9 WTF_CPU_ARM64_CORTEXA53 with the aim of enabling Cortex-A53-specific 10 code paths, if set true. 11 12 * Source/cmake/OptionsCommon.cmake: 13 Add -mfix-cortex-a53-835769 to the compiler flags if compiler supports 14 it. 15 * Source/cmakeconfig.h.cmake: 16 #cmakedefine01 for WTF_CPU_ARM64_CORTEXA53 17 1 18 2014-11-02 Akos Kiss <akiss@inf.u-szeged.hu> 2 19 -
trunk/Source/JavaScriptCore/ChangeLog
r175512 r175514 1 2014-11-03 Akos Kiss <akiss@inf.u-szeged.hu> 2 3 Workaround for Cortex-A53 erratum 835769 4 https://bugs.webkit.org/show_bug.cgi?id=138315 5 6 Reviewed by Filip Pizlo. 7 8 This patch introduces CMake variable and preprocessor macro 9 WTF_CPU_ARM64_CORTEXA53 with the aim of enabling Cortex-A53-specific 10 code paths, if set true. The patch also implements one case where such 11 code paths are needed: the workaround for Cortex-A53 erratum 835769. If 12 WTF_CPU_ARM64_CORTEXA53 is set then: 13 - CMake checks whether the compiler already has support for a workaround 14 and adds -mfix-cortex-a53-835769 to the compiler flags if so, 15 - the ARM64 backend of offlineasm inserts a nop between memory and 16 multiply-accumulate instructions, and 17 - the ARM64 assembler also inserts a nop between memory and (64-bit) 18 multiply-accumulate instructions. 19 20 * assembler/ARM64Assembler.h: 21 (JSC::ARM64Assembler::madd): 22 Call nopCortexA53Fix835769() to insert a nop if CPU(ARM64_CORTEXA53) and 23 if necessary. 24 (JSC::ARM64Assembler::msub): Likewise. 25 (JSC::ARM64Assembler::smaddl): Likewise. 26 (JSC::ARM64Assembler::smsubl): Likewise. 27 (JSC::ARM64Assembler::umaddl): Likewise. 28 (JSC::ARM64Assembler::umsubl): Likewise. 29 (JSC::ARM64Assembler::nopCortexA53Fix835769): 30 Added. Insert a nop if the previously emitted instruction was a load, a 31 store, or a prefetch, and if the current instruction is 64-bit. 32 * offlineasm/arm64.rb: 33 Add the arm64CortexA53Fix835769 phase and call it from 34 getModifiedListARM64 to insert nopCortexA53Fix835769 between appropriate 35 macro instructions. Also, lower nopCortexA53Fix835769 to nop if 36 CPU(ARM64_CORTEXA53), to nothing otherwise. 37 * offlineasm/instructions.rb: 38 Define macro instruction nopFixCortexA53Err835769. 39 1 40 2014-11-03 Commit Queue <commit-queue@webkit.org> 2 41 -
trunk/Source/JavaScriptCore/assembler/ARM64Assembler.h
r172578 r175514 1569 1569 { 1570 1570 CHECK_DATASIZE(); 1571 nopCortexA53Fix835769<datasize>(); 1571 1572 insn(dataProcessing3Source(DATASIZE, DataOp_MADD, rm, ra, rn, rd)); 1572 1573 } … … 1621 1622 { 1622 1623 CHECK_DATASIZE(); 1624 nopCortexA53Fix835769<datasize>(); 1623 1625 insn(dataProcessing3Source(DATASIZE, DataOp_MSUB, rm, ra, rn, rd)); 1624 1626 } … … 1807 1809 ALWAYS_INLINE void smaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) 1808 1810 { 1811 nopCortexA53Fix835769<64>(); 1809 1812 insn(dataProcessing3Source(Datasize_64, DataOp_SMADDL, rm, ra, rn, rd)); 1810 1813 } … … 1817 1820 ALWAYS_INLINE void smsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) 1818 1821 { 1822 nopCortexA53Fix835769<64>(); 1819 1823 insn(dataProcessing3Source(Datasize_64, DataOp_SMSUBL, rm, ra, rn, rd)); 1820 1824 } … … 2060 2064 ALWAYS_INLINE void umaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) 2061 2065 { 2066 nopCortexA53Fix835769<64>(); 2062 2067 insn(dataProcessing3Source(Datasize_64, DataOp_UMADDL, rm, ra, rn, rd)); 2063 2068 } … … 2070 2075 ALWAYS_INLINE void umsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) 2071 2076 { 2077 nopCortexA53Fix835769<64>(); 2072 2078 insn(dataProcessing3Source(Datasize_64, DataOp_UMSUBL, rm, ra, rn, rd)); 2073 2079 } … … 3630 3636 } 3631 3637 3638 // Workaround for Cortex-A53 erratum (835769). Emit an extra nop if the 3639 // last instruction in the buffer is a load, store or prefetch. Needed 3640 // before 64-bit multiply-accumulate instructions. 3641 template<int datasize> 3642 ALWAYS_INLINE void nopCortexA53Fix835769() 3643 { 3644 #if CPU(ARM64_CORTEXA53) 3645 CHECK_DATASIZE(); 3646 if (datasize == 64) { 3647 if (LIKELY(m_buffer.codeSize() >= sizeof(int32_t))) { 3648 // From ARMv8 Reference Manual, Section C4.1: the encoding of the 3649 // instructions in the Loads and stores instruction group is: 3650 // ---- 1-0- ---- ---- ---- ---- ---- ---- 3651 if (UNLIKELY((*reinterpret_cast_ptr<int32_t*>(reinterpret_cast_ptr<char*>(m_buffer.data()) + m_buffer.codeSize() - sizeof(int32_t)) & 0x0a000000) == 0x08000000)) 3652 nop(); 3653 } 3654 } 3655 #endif 3656 } 3657 3632 3658 AssemblerBuffer m_buffer; 3633 3659 Vector<LinkRecord, 0, UnsafeVectorOverflow> m_jumpsToLink; -
trunk/Source/JavaScriptCore/offlineasm/arm64.rb
r173497 r175514 229 229 end 230 230 231 # Workaround for Cortex-A53 erratum (835769) 232 def arm64CortexA53Fix835769(list) 233 newList = [] 234 lastOpcodeUnsafe = false 235 236 list.each { 237 | node | 238 if node.is_a? Instruction 239 case node.opcode 240 when /^store/, /^load/ 241 # List all macro instructions that can be lowered to a load, store or prefetch ARM64 assembly instruction 242 lastOpcodeUnsafe = true 243 when "muli", "mulp", "mulq", "smulli" 244 # List all macro instructions that can be lowered to a 64-bit multiply-accumulate ARM64 assembly instruction 245 # (defined as one of MADD, MSUB, SMADDL, SMSUBL, UMADDL or UMSUBL). 246 if lastOpcodeUnsafe 247 newList << Instruction.new(node.codeOrigin, "nopCortexA53Fix835769", []) 248 end 249 lastOpcodeUnsafe = false 250 else 251 lastOpcodeUnsafe = false 252 end 253 end 254 newList << node 255 } 256 newList 257 end 258 231 259 class Sequence 232 260 def getModifiedListARM64 … … 285 313 result = assignRegistersToTemporaries(result, :gpr, ARM64_EXTRA_GPRS) 286 314 result = assignRegistersToTemporaries(result, :fpr, ARM64_EXTRA_FPRS) 315 result = arm64CortexA53Fix835769(result) 287 316 return result 288 317 end … … 838 867 $asm.puts "dmb sy" 839 868 when "pcrtoaddr" 840 $asm.puts "adr #{operands[1].arm64Operand(:ptr)}, #{operands[0].value}" 869 $asm.puts "adr #{operands[1].arm64Operand(:ptr)}, #{operands[0].value}" 870 when "nopCortexA53Fix835769" 871 $asm.putStr("#if CPU(ARM64_CORTEXA53)") 872 $asm.puts "nop" 873 $asm.putStr("#endif") 841 874 else 842 875 lowerDefault -
trunk/Source/JavaScriptCore/offlineasm/instructions.rb
r173232 r175514 267 267 ARM64_INSTRUCTIONS = 268 268 [ 269 "pcrtoaddr" # Address from PC relative offset - adr instruction 269 "pcrtoaddr", # Address from PC relative offset - adr instruction 270 "nopFixCortexA53Err835769" # nop on Cortex-A53 (nothing otherwise) 270 271 ] 271 272 -
trunk/Source/cmake/OptionsCommon.cmake
r172698 r175514 29 29 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-exceptions -fno-strict-aliasing -fno-rtti") 30 30 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 31 endif () 32 33 if (WTF_CPU_ARM64_CORTEXA53) 34 if (NOT WTF_CPU_ARM64) 35 message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64") 36 endif () 37 message("Checking if compiler supports -mfix-cortex-a53-835769") 38 execute_process(COMMAND ${CMAKE_C_COMPILER} -mfix-cortex-a53-835769 ERROR_VARIABLE COMPILER_OUTPUT) 39 if ((NOT "${COMPILER_OUTPUT}" MATCHES "unrecognized command line option") 40 AND (NOT "${COMPILER_OUTPUT}" MATCHES "unknown argument")) 41 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769") 42 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769") 43 message("Enabling Cortex-A53 workaround for compiler") 44 endif () 31 45 endif () 32 46 -
trunk/Source/cmakeconfig.h.cmake
r175414 r175514 141 141 #cmakedefine01 HAVE_LLVM 142 142 #cmakedefine01 HAVE_GTK_UNIX_PRINTING 143 #cmakedefine01 WTF_CPU_ARM64_CORTEXA53 143 144 144 145 #if defined(BUILDING_GTK__) && !defined(GTK_API_VERSION_2)
Note: See TracChangeset
for help on using the changeset viewer.