Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ |
| 19 | |
Mark P Mendell | 17077d8 | 2015-12-16 19:15:59 +0000 | [diff] [blame] | 20 | #include "arch/x86_64/instruction_set_features_x86_64.h" |
Vladimír Marko | 434d968 | 2022-11-04 14:04:17 +0000 | [diff] [blame] | 21 | #include "base/macros.h" |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 22 | #include "code_generator.h" |
Calin Juravle | cd6dffe | 2015-01-08 17:35:35 +0000 | [diff] [blame] | 23 | #include "driver/compiler_options.h" |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 24 | #include "nodes.h" |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 25 | #include "parallel_move_resolver.h" |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 26 | #include "utils/x86_64/assembler_x86_64.h" |
| 27 | |
Vladimír Marko | 434d968 | 2022-11-04 14:04:17 +0000 | [diff] [blame] | 28 | namespace art HIDDEN { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 29 | namespace x86_64 { |
| 30 | |
Nicolas Geoffray | 86a8d7a | 2014-11-19 08:47:18 +0000 | [diff] [blame] | 31 | // Use a local definition to prevent copying mistakes. |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 32 | static constexpr size_t kX86_64WordSize = static_cast<size_t>(kX86_64PointerSize); |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 33 | |
Nicolas Geoffray | ee3cf07 | 2015-10-06 11:45:02 +0100 | [diff] [blame] | 34 | // Some x86_64 instructions require a register to be available as temp. |
| 35 | static constexpr Register TMP = R11; |
| 36 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 37 | static constexpr Register kParameterCoreRegisters[] = { RSI, RDX, RCX, R8, R9 }; |
Nicolas Geoffray | 7fb49da | 2014-10-06 09:12:41 +0100 | [diff] [blame] | 38 | static constexpr FloatRegister kParameterFloatRegisters[] = |
| 39 | { XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7 }; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 40 | |
| 41 | static constexpr size_t kParameterCoreRegistersLength = arraysize(kParameterCoreRegisters); |
Nicolas Geoffray | 7fb49da | 2014-10-06 09:12:41 +0100 | [diff] [blame] | 42 | static constexpr size_t kParameterFloatRegistersLength = arraysize(kParameterFloatRegisters); |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 43 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 44 | static constexpr Register kRuntimeParameterCoreRegisters[] = { RDI, RSI, RDX, RCX }; |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 45 | static constexpr size_t kRuntimeParameterCoreRegistersLength = |
| 46 | arraysize(kRuntimeParameterCoreRegisters); |
| 47 | static constexpr FloatRegister kRuntimeParameterFpuRegisters[] = { XMM0, XMM1 }; |
| 48 | static constexpr size_t kRuntimeParameterFpuRegistersLength = |
| 49 | arraysize(kRuntimeParameterFpuRegisters); |
| 50 | |
Mark Mendell | a4f1220 | 2015-08-06 15:23:34 -0400 | [diff] [blame] | 51 | // These XMM registers are non-volatile in ART ABI, but volatile in native ABI. |
| 52 | // If the ART ABI changes, this list must be updated. It is used to ensure that |
| 53 | // these are not clobbered by any direct call to native code (such as math intrinsics). |
| 54 | static constexpr FloatRegister non_volatile_xmm_regs[] = { XMM12, XMM13, XMM14, XMM15 }; |
| 55 | |
Santiago Aboy Solanes | 76d519b | 2023-04-03 12:34:45 +0100 | [diff] [blame] | 56 | #define UNIMPLEMENTED_INTRINSIC_LIST_X86_64(V) \ |
| 57 | V(CRC32Update) \ |
| 58 | V(CRC32UpdateBytes) \ |
| 59 | V(CRC32UpdateByteBuffer) \ |
| 60 | V(FP16ToFloat) \ |
| 61 | V(FP16ToHalf) \ |
| 62 | V(FP16Floor) \ |
| 63 | V(FP16Ceil) \ |
| 64 | V(FP16Rint) \ |
| 65 | V(FP16Greater) \ |
| 66 | V(FP16GreaterEquals) \ |
| 67 | V(FP16Less) \ |
| 68 | V(FP16LessEquals) \ |
| 69 | V(FP16Compare) \ |
| 70 | V(FP16Min) \ |
| 71 | V(FP16Max) \ |
| 72 | V(StringStringIndexOf) \ |
| 73 | V(StringStringIndexOfAfter) \ |
| 74 | V(StringBufferAppend) \ |
| 75 | V(StringBufferLength) \ |
| 76 | V(StringBufferToString) \ |
| 77 | V(StringBuilderAppendObject) \ |
| 78 | V(StringBuilderAppendString) \ |
| 79 | V(StringBuilderAppendCharSequence) \ |
| 80 | V(StringBuilderAppendCharArray) \ |
| 81 | V(StringBuilderAppendBoolean) \ |
| 82 | V(StringBuilderAppendChar) \ |
| 83 | V(StringBuilderAppendInt) \ |
| 84 | V(StringBuilderAppendLong) \ |
| 85 | V(StringBuilderAppendFloat) \ |
| 86 | V(StringBuilderAppendDouble) \ |
| 87 | V(StringBuilderLength) \ |
| 88 | V(StringBuilderToString) \ |
| 89 | /* 1.8 */ \ |
| 90 | V(UnsafeGetAndAddInt) \ |
| 91 | V(UnsafeGetAndAddLong) \ |
| 92 | V(UnsafeGetAndSetInt) \ |
| 93 | V(UnsafeGetAndSetLong) \ |
| 94 | V(UnsafeGetAndSetObject) \ |
| 95 | V(MethodHandleInvokeExact) \ |
| 96 | V(MethodHandleInvoke) \ |
| 97 | /* OpenJDK 11 */ \ |
| 98 | V(JdkUnsafeGetAndAddInt) \ |
| 99 | V(JdkUnsafeGetAndAddLong) \ |
| 100 | V(JdkUnsafeGetAndSetInt) \ |
| 101 | V(JdkUnsafeGetAndSetLong) \ |
Vladimir Marko | 0ac7d57 | 2023-11-22 16:46:30 +0100 | [diff] [blame^] | 102 | V(JdkUnsafeGetAndSetReference) |
Mark Mendell | a4f1220 | 2015-08-06 15:23:34 -0400 | [diff] [blame] | 103 | |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 104 | class InvokeRuntimeCallingConvention : public CallingConvention<Register, FloatRegister> { |
| 105 | public: |
| 106 | InvokeRuntimeCallingConvention() |
| 107 | : CallingConvention(kRuntimeParameterCoreRegisters, |
| 108 | kRuntimeParameterCoreRegistersLength, |
| 109 | kRuntimeParameterFpuRegisters, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 110 | kRuntimeParameterFpuRegistersLength, |
| 111 | kX86_64PointerSize) {} |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 112 | |
| 113 | private: |
| 114 | DISALLOW_COPY_AND_ASSIGN(InvokeRuntimeCallingConvention); |
| 115 | }; |
| 116 | |
Nicolas Geoffray | 7fb49da | 2014-10-06 09:12:41 +0100 | [diff] [blame] | 117 | class InvokeDexCallingConvention : public CallingConvention<Register, FloatRegister> { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 118 | public: |
Nicolas Geoffray | 7fb49da | 2014-10-06 09:12:41 +0100 | [diff] [blame] | 119 | InvokeDexCallingConvention() : CallingConvention( |
| 120 | kParameterCoreRegisters, |
| 121 | kParameterCoreRegistersLength, |
| 122 | kParameterFloatRegisters, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 123 | kParameterFloatRegistersLength, |
| 124 | kX86_64PointerSize) {} |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 125 | |
| 126 | private: |
| 127 | DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConvention); |
| 128 | }; |
| 129 | |
Vladimir Marko | 86c8752 | 2020-05-11 16:55:55 +0100 | [diff] [blame] | 130 | class CriticalNativeCallingConventionVisitorX86_64 : public InvokeDexCallingConventionVisitor { |
| 131 | public: |
| 132 | explicit CriticalNativeCallingConventionVisitorX86_64(bool for_register_allocation) |
| 133 | : for_register_allocation_(for_register_allocation) {} |
| 134 | |
| 135 | virtual ~CriticalNativeCallingConventionVisitorX86_64() {} |
| 136 | |
| 137 | Location GetNextLocation(DataType::Type type) override; |
| 138 | Location GetReturnLocation(DataType::Type type) const override; |
| 139 | Location GetMethodLocation() const override; |
| 140 | |
| 141 | size_t GetStackOffset() const { return stack_offset_; } |
| 142 | |
| 143 | private: |
| 144 | // Register allocator does not support adjusting frame size, so we cannot provide final locations |
| 145 | // of stack arguments for register allocation. We ask the register allocator for any location and |
| 146 | // move these arguments to the right place after adjusting the SP when generating the call. |
| 147 | const bool for_register_allocation_; |
| 148 | size_t gpr_index_ = 0u; |
| 149 | size_t fpr_index_ = 0u; |
| 150 | size_t stack_offset_ = 0u; |
| 151 | |
| 152 | DISALLOW_COPY_AND_ASSIGN(CriticalNativeCallingConventionVisitorX86_64); |
| 153 | }; |
| 154 | |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 155 | class FieldAccessCallingConventionX86_64 : public FieldAccessCallingConvention { |
| 156 | public: |
| 157 | FieldAccessCallingConventionX86_64() {} |
| 158 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 159 | Location GetObjectLocation() const override { |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 160 | return Location::RegisterLocation(RSI); |
| 161 | } |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 162 | Location GetFieldIndexLocation() const override { |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 163 | return Location::RegisterLocation(RDI); |
| 164 | } |
Stefano Cianciulli | 78f3c72 | 2023-05-16 10:32:54 +0000 | [diff] [blame] | 165 | Location GetReturnLocation([[maybe_unused]] DataType::Type type) const override { |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 166 | return Location::RegisterLocation(RAX); |
| 167 | } |
Stefano Cianciulli | 78f3c72 | 2023-05-16 10:32:54 +0000 | [diff] [blame] | 168 | Location GetSetValueLocation([[maybe_unused]] DataType::Type type, |
| 169 | bool is_instance) const override { |
Nicolas Geoffray | 5b3c6c0 | 2017-01-19 14:22:26 +0000 | [diff] [blame] | 170 | return is_instance |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 171 | ? Location::RegisterLocation(RDX) |
Nicolas Geoffray | 5b3c6c0 | 2017-01-19 14:22:26 +0000 | [diff] [blame] | 172 | : Location::RegisterLocation(RSI); |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 173 | } |
Stefano Cianciulli | 78f3c72 | 2023-05-16 10:32:54 +0000 | [diff] [blame] | 174 | Location GetFpuLocation([[maybe_unused]] DataType::Type type) const override { |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 175 | return Location::FpuRegisterLocation(XMM0); |
| 176 | } |
| 177 | |
| 178 | private: |
| 179 | DISALLOW_COPY_AND_ASSIGN(FieldAccessCallingConventionX86_64); |
| 180 | }; |
| 181 | |
| 182 | |
Roland Levillain | 2d27c8e | 2015-04-28 15:48:45 +0100 | [diff] [blame] | 183 | class InvokeDexCallingConventionVisitorX86_64 : public InvokeDexCallingConventionVisitor { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 184 | public: |
Roland Levillain | 2d27c8e | 2015-04-28 15:48:45 +0100 | [diff] [blame] | 185 | InvokeDexCallingConventionVisitorX86_64() {} |
| 186 | virtual ~InvokeDexCallingConventionVisitorX86_64() {} |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 187 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 188 | Location GetNextLocation(DataType::Type type) override; |
| 189 | Location GetReturnLocation(DataType::Type type) const override; |
| 190 | Location GetMethodLocation() const override; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 191 | |
| 192 | private: |
| 193 | InvokeDexCallingConvention calling_convention; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 194 | |
Roland Levillain | 2d27c8e | 2015-04-28 15:48:45 +0100 | [diff] [blame] | 195 | DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitorX86_64); |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | class CodeGeneratorX86_64; |
Andreas Gampe | 71fb52f | 2014-12-29 17:43:08 -0800 | [diff] [blame] | 199 | |
Zheng Xu | ad4450e | 2015-04-17 18:48:56 +0800 | [diff] [blame] | 200 | class ParallelMoveResolverX86_64 : public ParallelMoveResolverWithSwap { |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 201 | public: |
| 202 | ParallelMoveResolverX86_64(ArenaAllocator* allocator, CodeGeneratorX86_64* codegen) |
Zheng Xu | ad4450e | 2015-04-17 18:48:56 +0800 | [diff] [blame] | 203 | : ParallelMoveResolverWithSwap(allocator), codegen_(codegen) {} |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 204 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 205 | void EmitMove(size_t index) override; |
| 206 | void EmitSwap(size_t index) override; |
| 207 | void SpillScratch(int reg) override; |
| 208 | void RestoreScratch(int reg) override; |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 209 | |
| 210 | X86_64Assembler* GetAssembler() const; |
| 211 | |
| 212 | private: |
Nicolas Geoffray | 412f10c | 2014-06-19 10:00:34 +0100 | [diff] [blame] | 213 | void Exchange32(CpuRegister reg, int mem); |
Nicolas Geoffray | 102cbed | 2014-10-15 18:31:05 +0100 | [diff] [blame] | 214 | void Exchange32(XmmRegister reg, int mem); |
Mark Mendell | 8a1c728 | 2015-06-29 15:41:28 -0400 | [diff] [blame] | 215 | void Exchange64(CpuRegister reg1, CpuRegister reg2); |
Nicolas Geoffray | 412f10c | 2014-06-19 10:00:34 +0100 | [diff] [blame] | 216 | void Exchange64(CpuRegister reg, int mem); |
Nicolas Geoffray | 102cbed | 2014-10-15 18:31:05 +0100 | [diff] [blame] | 217 | void Exchange64(XmmRegister reg, int mem); |
Aart Bik | cfe50bb | 2017-12-12 14:54:12 -0800 | [diff] [blame] | 218 | void Exchange128(XmmRegister reg, int mem); |
| 219 | void ExchangeMemory32(int mem1, int mem2); |
| 220 | void ExchangeMemory64(int mem1, int mem2, int num_of_qwords); |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 221 | |
| 222 | CodeGeneratorX86_64* const codegen_; |
| 223 | |
| 224 | DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolverX86_64); |
| 225 | }; |
| 226 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 227 | class LocationsBuilderX86_64 : public HGraphVisitor { |
| 228 | public: |
| 229 | LocationsBuilderX86_64(HGraph* graph, CodeGeneratorX86_64* codegen) |
| 230 | : HGraphVisitor(graph), codegen_(codegen) {} |
| 231 | |
Nicolas Geoffray | 360231a | 2014-10-08 21:07:48 +0100 | [diff] [blame] | 232 | #define DECLARE_VISIT_INSTRUCTION(name, super) \ |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 233 | void Visit##name(H##name* instr) override; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 234 | |
Alexandre Rames | ef20f71 | 2015-06-09 10:29:30 +0100 | [diff] [blame] | 235 | FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) |
| 236 | FOR_EACH_CONCRETE_INSTRUCTION_X86_64(DECLARE_VISIT_INSTRUCTION) |
Shalini Salomi Bodapati | dd121f6 | 2018-10-26 15:03:53 +0530 | [diff] [blame] | 237 | FOR_EACH_CONCRETE_INSTRUCTION_X86_COMMON(DECLARE_VISIT_INSTRUCTION) |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 238 | |
| 239 | #undef DECLARE_VISIT_INSTRUCTION |
| 240 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 241 | void VisitInstruction(HInstruction* instruction) override { |
Alexandre Rames | ef20f71 | 2015-06-09 10:29:30 +0100 | [diff] [blame] | 242 | LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() |
| 243 | << " (id " << instruction->GetId() << ")"; |
| 244 | } |
| 245 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 246 | private: |
Nicolas Geoffray | 9574c4b | 2014-11-12 13:19:37 +0000 | [diff] [blame] | 247 | void HandleInvoke(HInvoke* invoke); |
| 248 | void HandleBitwiseOperation(HBinaryOperation* operation); |
Vladimir Marko | 5f7b58e | 2015-11-23 19:49:34 +0000 | [diff] [blame] | 249 | void HandleCondition(HCondition* condition); |
Calin Juravle | 9aec02f | 2014-11-18 23:06:35 +0000 | [diff] [blame] | 250 | void HandleShift(HBinaryOperation* operation); |
Calin Juravle | 52c4896 | 2014-12-16 17:02:57 +0000 | [diff] [blame] | 251 | void HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info); |
| 252 | void HandleFieldGet(HInstruction* instruction); |
Shalini Salomi Bodapati | b45a435 | 2019-07-10 16:09:41 +0530 | [diff] [blame] | 253 | bool CpuHasAvxFeatureFlag(); |
| 254 | bool CpuHasAvx2FeatureFlag(); |
Nicolas Geoffray | 9574c4b | 2014-11-12 13:19:37 +0000 | [diff] [blame] | 255 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 256 | CodeGeneratorX86_64* const codegen_; |
Roland Levillain | 2d27c8e | 2015-04-28 15:48:45 +0100 | [diff] [blame] | 257 | InvokeDexCallingConventionVisitorX86_64 parameter_visitor_; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 258 | |
| 259 | DISALLOW_COPY_AND_ASSIGN(LocationsBuilderX86_64); |
| 260 | }; |
| 261 | |
Aart Bik | 42249c3 | 2016-01-07 15:33:50 -0800 | [diff] [blame] | 262 | class InstructionCodeGeneratorX86_64 : public InstructionCodeGenerator { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 263 | public: |
| 264 | InstructionCodeGeneratorX86_64(HGraph* graph, CodeGeneratorX86_64* codegen); |
| 265 | |
Nicolas Geoffray | 360231a | 2014-10-08 21:07:48 +0100 | [diff] [blame] | 266 | #define DECLARE_VISIT_INSTRUCTION(name, super) \ |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 267 | void Visit##name(H##name* instr) override; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 268 | |
Alexandre Rames | ef20f71 | 2015-06-09 10:29:30 +0100 | [diff] [blame] | 269 | FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) |
| 270 | FOR_EACH_CONCRETE_INSTRUCTION_X86_64(DECLARE_VISIT_INSTRUCTION) |
Shalini Salomi Bodapati | dd121f6 | 2018-10-26 15:03:53 +0530 | [diff] [blame] | 271 | FOR_EACH_CONCRETE_INSTRUCTION_X86_COMMON(DECLARE_VISIT_INSTRUCTION) |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 272 | |
| 273 | #undef DECLARE_VISIT_INSTRUCTION |
| 274 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 275 | void VisitInstruction(HInstruction* instruction) override { |
Alexandre Rames | ef20f71 | 2015-06-09 10:29:30 +0100 | [diff] [blame] | 276 | LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() |
| 277 | << " (id " << instruction->GetId() << ")"; |
| 278 | } |
| 279 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 280 | X86_64Assembler* GetAssembler() const { return assembler_; } |
| 281 | |
Ulya Trafimovich | 2ee6969 | 2021-05-19 14:15:14 +0100 | [diff] [blame] | 282 | // Generate a GC root reference load: |
| 283 | // |
| 284 | // root <- *address |
| 285 | // |
| 286 | // while honoring read barriers based on read_barrier_option. |
| 287 | void GenerateGcRootFieldLoad(HInstruction* instruction, |
| 288 | Location root, |
| 289 | const Address& address, |
| 290 | Label* fixup_label, |
| 291 | ReadBarrierOption read_barrier_option); |
Ulya Trafimovich | 6a4b299 | 2021-06-11 12:02:17 +0100 | [diff] [blame] | 292 | void HandleFieldSet(HInstruction* instruction, |
| 293 | uint32_t value_index, |
| 294 | uint32_t extra_temp_index, |
| 295 | DataType::Type field_type, |
| 296 | Address field_addr, |
| 297 | CpuRegister base, |
| 298 | bool is_volatile, |
Ulya Trafimovich | 30bb6af | 2021-06-15 17:34:51 +0100 | [diff] [blame] | 299 | bool is_atomic, |
Ulya Trafimovich | 44a1dc7 | 2021-11-02 15:38:03 +0000 | [diff] [blame] | 300 | bool value_can_be_null, |
Santiago Aboy Solanes | d422960 | 2023-01-03 16:20:50 +0000 | [diff] [blame] | 301 | bool byte_swap, |
| 302 | WriteBarrierKind write_barrier_kind); |
Ulya Trafimovich | 44a1dc7 | 2021-11-02 15:38:03 +0000 | [diff] [blame] | 303 | |
| 304 | void Bswap(Location value, DataType::Type type, CpuRegister* temp = nullptr); |
Ulya Trafimovich | 2ee6969 | 2021-05-19 14:15:14 +0100 | [diff] [blame] | 305 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 306 | private: |
Nicolas Geoffray | 3c04974 | 2014-09-24 18:10:46 +0100 | [diff] [blame] | 307 | // Generate code for the given suspend check. If not null, `successor` |
| 308 | // is the block to branch to if the suspend check is not needed, and after |
| 309 | // the suspend call. |
| 310 | void GenerateSuspendCheck(HSuspendCheck* instruction, HBasicBlock* successor); |
Andreas Gampe | 85b62f2 | 2015-09-09 13:15:38 -0700 | [diff] [blame] | 311 | void GenerateClassInitializationCheck(SlowPathCode* slow_path, CpuRegister class_reg); |
Vladimir Marko | 175e786 | 2018-03-27 09:03:13 +0000 | [diff] [blame] | 312 | void GenerateBitstringTypeCheckCompare(HTypeCheckInstruction* check, CpuRegister temp); |
Nicolas Geoffray | 9574c4b | 2014-11-12 13:19:37 +0000 | [diff] [blame] | 313 | void HandleBitwiseOperation(HBinaryOperation* operation); |
Mark Mendell | c470193 | 2015-04-10 13:18:51 -0400 | [diff] [blame] | 314 | void GenerateRemFP(HRem* rem); |
Guillaume Sanchez | 0f88e87 | 2015-03-30 17:55:45 +0100 | [diff] [blame] | 315 | void DivRemOneOrMinusOne(HBinaryOperation* instruction); |
Guillaume Sanchez | b19930c | 2015-04-09 21:12:15 +0100 | [diff] [blame] | 316 | void DivByPowerOfTwo(HDiv* instruction); |
Shalini Salomi Bodapati | a66784b | 2018-11-06 13:05:44 +0530 | [diff] [blame] | 317 | void RemByPowerOfTwo(HRem* instruction); |
Guillaume Sanchez | 0f88e87 | 2015-03-30 17:55:45 +0100 | [diff] [blame] | 318 | void GenerateDivRemWithAnyConstant(HBinaryOperation* instruction); |
Calin Juravle | bacfec3 | 2014-11-14 15:54:36 +0000 | [diff] [blame] | 319 | void GenerateDivRemIntegral(HBinaryOperation* instruction); |
Vladimir Marko | 5f7b58e | 2015-11-23 19:49:34 +0000 | [diff] [blame] | 320 | void HandleCondition(HCondition* condition); |
Calin Juravle | 9aec02f | 2014-11-18 23:06:35 +0000 | [diff] [blame] | 321 | void HandleShift(HBinaryOperation* operation); |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 322 | |
Nicolas Geoffray | 07276db | 2015-05-18 14:22:09 +0100 | [diff] [blame] | 323 | void HandleFieldSet(HInstruction* instruction, |
| 324 | const FieldInfo& field_info, |
Santiago Aboy Solanes | d422960 | 2023-01-03 16:20:50 +0000 | [diff] [blame] | 325 | bool value_can_be_null, |
| 326 | WriteBarrierKind write_barrier_kind); |
Calin Juravle | 52c4896 | 2014-12-16 17:02:57 +0000 | [diff] [blame] | 327 | void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 328 | |
Aart Bik | 351df3e | 2018-03-07 11:54:57 -0800 | [diff] [blame] | 329 | void GenerateMinMaxInt(LocationSummary* locations, bool is_min, DataType::Type type); |
Aart Bik | 1f8d51b | 2018-02-15 10:42:37 -0800 | [diff] [blame] | 330 | void GenerateMinMaxFP(LocationSummary* locations, bool is_min, DataType::Type type); |
Aart Bik | 351df3e | 2018-03-07 11:54:57 -0800 | [diff] [blame] | 331 | void GenerateMinMax(HBinaryOperation* minmax, bool is_min); |
Mythri Alle | 5097f83 | 2021-11-02 14:52:30 +0000 | [diff] [blame] | 332 | void GenerateMethodEntryExitHook(HInstruction* instruction); |
Aart Bik | 1f8d51b | 2018-02-15 10:42:37 -0800 | [diff] [blame] | 333 | |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 334 | // Generate a heap reference load using one register `out`: |
| 335 | // |
| 336 | // out <- *(out + offset) |
| 337 | // |
| 338 | // while honoring heap poisoning and/or read barriers (if any). |
Roland Levillain | 95e7ffc | 2016-01-22 11:57:25 +0000 | [diff] [blame] | 339 | // |
| 340 | // Location `maybe_temp` is used when generating a read barrier and |
| 341 | // shall be a register in that case; it may be an invalid location |
| 342 | // otherwise. |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 343 | void GenerateReferenceLoadOneRegister(HInstruction* instruction, |
| 344 | Location out, |
| 345 | uint32_t offset, |
Mathieu Chartier | aa474eb | 2016-11-09 15:18:27 -0800 | [diff] [blame] | 346 | Location maybe_temp, |
Mathieu Chartier | 3af00dc | 2016-11-10 11:25:57 -0800 | [diff] [blame] | 347 | ReadBarrierOption read_barrier_option); |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 348 | // Generate a heap reference load using two different registers |
| 349 | // `out` and `obj`: |
| 350 | // |
| 351 | // out <- *(obj + offset) |
| 352 | // |
| 353 | // while honoring heap poisoning and/or read barriers (if any). |
Roland Levillain | 95e7ffc | 2016-01-22 11:57:25 +0000 | [diff] [blame] | 354 | // |
| 355 | // Location `maybe_temp` is used when generating a Baker's (fast |
| 356 | // path) read barrier and shall be a register in that case; it may |
| 357 | // be an invalid location otherwise. |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 358 | void GenerateReferenceLoadTwoRegisters(HInstruction* instruction, |
| 359 | Location out, |
| 360 | Location obj, |
Mathieu Chartier | cdba73b | 2016-11-03 19:23:06 -0700 | [diff] [blame] | 361 | uint32_t offset, |
Mathieu Chartier | 3af00dc | 2016-11-10 11:25:57 -0800 | [diff] [blame] | 362 | ReadBarrierOption read_barrier_option); |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 363 | |
Mark Mendell | 24f2dfa | 2015-01-14 19:51:45 -0500 | [diff] [blame] | 364 | void PushOntoFPStack(Location source, uint32_t temp_offset, |
| 365 | uint32_t stack_adjustment, bool is_float); |
Mark Mendell | 7c0b44f | 2016-02-01 10:08:35 -0500 | [diff] [blame] | 366 | void GenerateCompareTest(HCondition* condition); |
Mark Mendell | 152408f | 2015-12-31 12:28:50 -0500 | [diff] [blame] | 367 | template<class LabelType> |
Mingyao Yang | d43b3ac | 2015-04-01 14:03:04 -0700 | [diff] [blame] | 368 | void GenerateTestAndBranch(HInstruction* instruction, |
David Brazdil | 0debae7 | 2015-11-12 18:37:00 +0000 | [diff] [blame] | 369 | size_t condition_input_index, |
Mark Mendell | 152408f | 2015-12-31 12:28:50 -0500 | [diff] [blame] | 370 | LabelType* true_target, |
| 371 | LabelType* false_target); |
| 372 | template<class LabelType> |
David Brazdil | 0debae7 | 2015-11-12 18:37:00 +0000 | [diff] [blame] | 373 | void GenerateCompareTestAndBranch(HCondition* condition, |
Mark Mendell | 152408f | 2015-12-31 12:28:50 -0500 | [diff] [blame] | 374 | LabelType* true_target, |
| 375 | LabelType* false_target); |
| 376 | template<class LabelType> |
| 377 | void GenerateFPJumps(HCondition* cond, LabelType* true_label, LabelType* false_label); |
| 378 | |
David Brazdil | fc6a86a | 2015-06-26 10:33:45 +0000 | [diff] [blame] | 379 | void HandleGoto(HInstruction* got, HBasicBlock* successor); |
Nicolas Geoffray | 3c04974 | 2014-09-24 18:10:46 +0100 | [diff] [blame] | 380 | |
Shalini Salomi Bodapati | b45a435 | 2019-07-10 16:09:41 +0530 | [diff] [blame] | 381 | bool CpuHasAvxFeatureFlag(); |
| 382 | bool CpuHasAvx2FeatureFlag(); |
| 383 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 384 | X86_64Assembler* const assembler_; |
| 385 | CodeGeneratorX86_64* const codegen_; |
| 386 | |
| 387 | DISALLOW_COPY_AND_ASSIGN(InstructionCodeGeneratorX86_64); |
| 388 | }; |
| 389 | |
Mark Mendell | 9c86b48 | 2015-09-18 13:36:07 -0400 | [diff] [blame] | 390 | // Class for fixups to jump tables. |
| 391 | class JumpTableRIPFixup; |
| 392 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 393 | class CodeGeneratorX86_64 : public CodeGenerator { |
| 394 | public: |
Mark Mendell | fb8d279 | 2015-03-31 22:16:59 -0400 | [diff] [blame] | 395 | CodeGeneratorX86_64(HGraph* graph, |
Serban Constantinescu | ecc4366 | 2015-08-13 13:33:12 +0100 | [diff] [blame] | 396 | const CompilerOptions& compiler_options, |
| 397 | OptimizingCompilerStats* stats = nullptr); |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 398 | virtual ~CodeGeneratorX86_64() {} |
| 399 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 400 | void GenerateFrameEntry() override; |
| 401 | void GenerateFrameExit() override; |
| 402 | void Bind(HBasicBlock* block) override; |
| 403 | void MoveConstant(Location destination, int32_t value) override; |
| 404 | void MoveLocation(Location dst, Location src, DataType::Type dst_type) override; |
| 405 | void AddLocationAsTemp(Location location, LocationSummary* locations) override; |
Calin Juravle | e460d1d | 2015-09-29 04:52:17 +0100 | [diff] [blame] | 406 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 407 | size_t SaveCoreRegister(size_t stack_index, uint32_t reg_id) override; |
| 408 | size_t RestoreCoreRegister(size_t stack_index, uint32_t reg_id) override; |
| 409 | size_t SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) override; |
| 410 | size_t RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) override; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 411 | |
Alexandre Rames | 8158f28 | 2015-08-07 10:26:17 +0100 | [diff] [blame] | 412 | // Generate code to invoke a runtime entry point. |
Calin Juravle | 175dc73 | 2015-08-25 15:42:32 +0100 | [diff] [blame] | 413 | void InvokeRuntime(QuickEntrypointEnum entrypoint, |
| 414 | HInstruction* instruction, |
| 415 | uint32_t dex_pc, |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 416 | SlowPathCode* slow_path = nullptr) override; |
Alexandre Rames | 8158f28 | 2015-08-07 10:26:17 +0100 | [diff] [blame] | 417 | |
Roland Levillain | dec8f63 | 2016-07-22 17:10:06 +0100 | [diff] [blame] | 418 | // Generate code to invoke a runtime entry point, but do not record |
| 419 | // PC-related information in a stack map. |
| 420 | void InvokeRuntimeWithoutRecordingPcInfo(int32_t entry_point_offset, |
| 421 | HInstruction* instruction, |
| 422 | SlowPathCode* slow_path); |
| 423 | |
Serban Constantinescu | ba45db0 | 2016-07-12 22:53:02 +0100 | [diff] [blame] | 424 | void GenerateInvokeRuntime(int32_t entry_point_offset); |
| 425 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 426 | size_t GetWordSize() const override { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 427 | return kX86_64WordSize; |
| 428 | } |
| 429 | |
Artem Serov | 6a0b657 | 2019-07-26 20:38:37 +0100 | [diff] [blame] | 430 | size_t GetSlowPathFPWidth() const override { |
Aart Bik | b13c65b | 2017-03-21 20:14:07 -0700 | [diff] [blame] | 431 | return GetGraph()->HasSIMD() |
Artem Serov | c8150b5 | 2019-07-31 18:28:00 +0100 | [diff] [blame] | 432 | ? GetSIMDRegisterWidth() |
Aart Bik | b13c65b | 2017-03-21 20:14:07 -0700 | [diff] [blame] | 433 | : 1 * kX86_64WordSize; // 8 bytes == 1 x86_64 words for each spill |
Mark Mendell | f85a9ca | 2015-01-13 09:20:58 -0500 | [diff] [blame] | 434 | } |
| 435 | |
Artem Serov | 6a0b657 | 2019-07-26 20:38:37 +0100 | [diff] [blame] | 436 | size_t GetCalleePreservedFPWidth() const override { |
| 437 | return 1 * kX86_64WordSize; |
| 438 | } |
| 439 | |
Artem Serov | c8150b5 | 2019-07-31 18:28:00 +0100 | [diff] [blame] | 440 | size_t GetSIMDRegisterWidth() const override { |
| 441 | return 2 * kX86_64WordSize; |
| 442 | } |
| 443 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 444 | HGraphVisitor* GetLocationBuilder() override { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 445 | return &location_builder_; |
| 446 | } |
| 447 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 448 | HGraphVisitor* GetInstructionVisitor() override { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 449 | return &instruction_visitor_; |
| 450 | } |
| 451 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 452 | X86_64Assembler* GetAssembler() override { |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 453 | return &assembler_; |
| 454 | } |
| 455 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 456 | const X86_64Assembler& GetAssembler() const override { |
Alexandre Rames | eb7b739 | 2015-06-19 14:47:01 +0100 | [diff] [blame] | 457 | return assembler_; |
| 458 | } |
| 459 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 460 | ParallelMoveResolverX86_64* GetMoveResolver() override { |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 461 | return &move_resolver_; |
| 462 | } |
| 463 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 464 | uintptr_t GetAddressOf(HBasicBlock* block) override { |
Nicolas Geoffray | de58ab2 | 2014-11-05 12:46:03 +0000 | [diff] [blame] | 465 | return GetLabelOf(block)->Position(); |
| 466 | } |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 467 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 468 | void SetupBlockedRegisters() const override; |
| 469 | void DumpCoreRegister(std::ostream& stream, int reg) const override; |
| 470 | void DumpFloatingPointRegister(std::ostream& stream, int reg) const override; |
Nicolas Geoffray | 70bba9c | 2023-06-16 12:18:27 +0100 | [diff] [blame] | 471 | void Finalize() override; |
Nicolas Geoffray | de58ab2 | 2014-11-05 12:46:03 +0000 | [diff] [blame] | 472 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 473 | InstructionSet GetInstructionSet() const override { |
Nicolas Geoffray | 412f10c | 2014-06-19 10:00:34 +0100 | [diff] [blame] | 474 | return InstructionSet::kX86_64; |
| 475 | } |
| 476 | |
Ulya Trafimovich | 44a1dc7 | 2021-11-02 15:38:03 +0000 | [diff] [blame] | 477 | InstructionCodeGeneratorX86_64* GetInstructionCodegen() { |
| 478 | return down_cast<InstructionCodeGeneratorX86_64*>(GetInstructionVisitor()); |
| 479 | } |
| 480 | |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 481 | const X86_64InstructionSetFeatures& GetInstructionSetFeatures() const; |
| 482 | |
Nicolas Geoffray | 3c7bb98 | 2014-07-23 16:04:16 +0100 | [diff] [blame] | 483 | // Emit a write barrier. |
Nicolas Geoffray | 07276db | 2015-05-18 14:22:09 +0100 | [diff] [blame] | 484 | void MarkGCCard(CpuRegister temp, |
| 485 | CpuRegister card, |
| 486 | CpuRegister object, |
| 487 | CpuRegister value, |
Santiago Aboy Solanes | d422960 | 2023-01-03 16:20:50 +0000 | [diff] [blame] | 488 | bool emit_null_check); |
Nicolas Geoffray | 3c7bb98 | 2014-07-23 16:04:16 +0100 | [diff] [blame] | 489 | |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 490 | void GenerateMemoryBarrier(MemBarrierKind kind); |
| 491 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 492 | // Helper method to move a value between two locations. |
| 493 | void Move(Location destination, Location source); |
Ulya Trafimovich | 161911c | 2021-06-01 15:47:28 +0100 | [diff] [blame] | 494 | // Helper method to load a value of non-reference type from memory. |
| 495 | void LoadFromMemoryNoReference(DataType::Type type, Location dst, Address src); |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 496 | |
Nicolas Geoffray | 92a73ae | 2014-10-16 11:12:52 +0100 | [diff] [blame] | 497 | Label* GetLabelOf(HBasicBlock* block) const { |
Vladimir Marko | 225b646 | 2015-09-28 12:17:40 +0100 | [diff] [blame] | 498 | return CommonGetLabelOf<Label>(block_labels_, block); |
Nicolas Geoffray | 92a73ae | 2014-10-16 11:12:52 +0100 | [diff] [blame] | 499 | } |
| 500 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 501 | void Initialize() override { |
Vladimir Marko | 225b646 | 2015-09-28 12:17:40 +0100 | [diff] [blame] | 502 | block_labels_ = CommonInitializeLabels<Label>(); |
Nicolas Geoffray | 92a73ae | 2014-10-16 11:12:52 +0100 | [diff] [blame] | 503 | } |
| 504 | |
Stefano Cianciulli | 78f3c72 | 2023-05-16 10:32:54 +0000 | [diff] [blame] | 505 | bool NeedsTwoRegisters([[maybe_unused]] DataType::Type type) const override { return false; } |
Nicolas Geoffray | 840e546 | 2015-01-07 16:01:24 +0000 | [diff] [blame] | 506 | |
Vladimir Marko | cac5a7e | 2016-02-22 10:39:50 +0000 | [diff] [blame] | 507 | // Check if the desired_string_load_kind is supported. If it is, return it, |
| 508 | // otherwise return a fall-back kind that should be used instead. |
| 509 | HLoadString::LoadKind GetSupportedLoadStringKind( |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 510 | HLoadString::LoadKind desired_string_load_kind) override; |
Vladimir Marko | cac5a7e | 2016-02-22 10:39:50 +0000 | [diff] [blame] | 511 | |
Vladimir Marko | dbb7f5b | 2016-03-30 13:23:58 +0100 | [diff] [blame] | 512 | // Check if the desired_class_load_kind is supported. If it is, return it, |
| 513 | // otherwise return a fall-back kind that should be used instead. |
| 514 | HLoadClass::LoadKind GetSupportedLoadClassKind( |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 515 | HLoadClass::LoadKind desired_class_load_kind) override; |
Vladimir Marko | dbb7f5b | 2016-03-30 13:23:58 +0100 | [diff] [blame] | 516 | |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 517 | // Check if the desired_dispatch_info is supported. If it is, return it, |
| 518 | // otherwise return a fall-back info that should be used instead. |
| 519 | HInvokeStaticOrDirect::DispatchInfo GetSupportedInvokeStaticOrDirectDispatch( |
| 520 | const HInvokeStaticOrDirect::DispatchInfo& desired_dispatch_info, |
Nicolas Geoffray | bdb2ecc | 2018-09-18 14:33:55 +0100 | [diff] [blame] | 521 | ArtMethod* method) override; |
Vladimir Marko | dc151b2 | 2015-10-15 18:02:30 +0100 | [diff] [blame] | 522 | |
Nicolas Geoffray | 8d34a18 | 2020-09-16 09:46:58 +0100 | [diff] [blame] | 523 | void LoadMethod(MethodLoadKind load_kind, Location temp, HInvoke* invoke); |
Vladimir Marko | e7197bf | 2017-06-02 17:00:23 +0100 | [diff] [blame] | 524 | void GenerateStaticOrDirectCall( |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 525 | HInvokeStaticOrDirect* invoke, Location temp, SlowPathCode* slow_path = nullptr) override; |
Vladimir Marko | e7197bf | 2017-06-02 17:00:23 +0100 | [diff] [blame] | 526 | void GenerateVirtualCall( |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 527 | HInvokeVirtual* invoke, Location temp, SlowPathCode* slow_path = nullptr) override; |
Andreas Gampe | 85b62f2 | 2015-09-09 13:15:38 -0700 | [diff] [blame] | 528 | |
Vladimir Marko | 6fd1606 | 2018-06-26 11:02:04 +0100 | [diff] [blame] | 529 | void RecordBootImageIntrinsicPatch(uint32_t intrinsic_data); |
Vladimir Marko | b066d43 | 2018-01-03 13:14:37 +0000 | [diff] [blame] | 530 | void RecordBootImageRelRoPatch(uint32_t boot_image_offset); |
Nicolas Geoffray | 8d34a18 | 2020-09-16 09:46:58 +0100 | [diff] [blame] | 531 | void RecordBootImageMethodPatch(HInvoke* invoke); |
| 532 | void RecordMethodBssEntryPatch(HInvoke* invoke); |
Vladimir Marko | 9d31daa | 2022-04-14 10:48:44 +0100 | [diff] [blame] | 533 | void RecordBootImageTypePatch(const DexFile& dex_file, dex::TypeIndex type_index); |
Vladimir Marko | 6bec91c | 2017-01-09 15:03:12 +0000 | [diff] [blame] | 534 | Label* NewTypeBssEntryPatch(HLoadClass* load_class); |
Vladimir Marko | 59eb30f | 2018-02-20 11:52:34 +0000 | [diff] [blame] | 535 | void RecordBootImageStringPatch(HLoadString* load_string); |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 536 | Label* NewStringBssEntryPatch(HLoadString* load_string); |
Vladimir Marko | eb9eb00 | 2020-10-02 13:54:19 +0100 | [diff] [blame] | 537 | void RecordBootImageJniEntrypointPatch(HInvokeStaticOrDirect* invoke); |
Nicolas Geoffray | f0acfe7 | 2017-01-09 20:54:52 +0000 | [diff] [blame] | 538 | Label* NewJitRootStringPatch(const DexFile& dex_file, |
Vladimir Marko | 174b2e2 | 2017-10-12 13:34:49 +0100 | [diff] [blame] | 539 | dex::StringIndex string_index, |
Nicolas Geoffray | f0acfe7 | 2017-01-09 20:54:52 +0000 | [diff] [blame] | 540 | Handle<mirror::String> handle); |
Nicolas Geoffray | 5247c08 | 2017-01-13 14:17:29 +0000 | [diff] [blame] | 541 | Label* NewJitRootClassPatch(const DexFile& dex_file, |
Vladimir Marko | 174b2e2 | 2017-10-12 13:34:49 +0100 | [diff] [blame] | 542 | dex::TypeIndex type_index, |
Nicolas Geoffray | 5247c08 | 2017-01-13 14:17:29 +0000 | [diff] [blame] | 543 | Handle<mirror::Class> handle); |
Vladimir Marko | cac5a7e | 2016-02-22 10:39:50 +0000 | [diff] [blame] | 544 | |
Vladimir Marko | 6fd1606 | 2018-06-26 11:02:04 +0100 | [diff] [blame] | 545 | void LoadBootImageAddress(CpuRegister reg, uint32_t boot_image_reference); |
Vladimir Marko | de91ca9 | 2020-10-27 13:41:40 +0000 | [diff] [blame] | 546 | void LoadIntrinsicDeclaringClass(CpuRegister reg, HInvoke* invoke); |
Ulyana Trafimovich | 3693b2a | 2021-10-29 10:43:18 +0000 | [diff] [blame] | 547 | void LoadClassRootForIntrinsic(CpuRegister reg, ClassRoot class_root); |
Andreas Gampe | 71fb52f | 2014-12-29 17:43:08 -0800 | [diff] [blame] | 548 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 549 | void EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* linker_patches) override; |
Vladimir Marko | 5815501 | 2015-08-19 12:49:41 +0000 | [diff] [blame] | 550 | |
Nicolas Geoffray | 22384ae | 2016-12-12 22:33:36 +0000 | [diff] [blame] | 551 | void PatchJitRootUse(uint8_t* code, |
| 552 | const uint8_t* roots_data, |
| 553 | const PatchInfo<Label>& info, |
| 554 | uint64_t index_in_table) const; |
| 555 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 556 | void EmitJitRootPatches(uint8_t* code, const uint8_t* roots_data) override; |
Nicolas Geoffray | 132d836 | 2016-11-16 09:19:42 +0000 | [diff] [blame] | 557 | |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 558 | // Fast path implementation of ReadBarrier::Barrier for a heap |
| 559 | // reference field load when Baker's read barriers are used. |
| 560 | void GenerateFieldLoadWithBakerReadBarrier(HInstruction* instruction, |
Roland Levillain | e3f43ac | 2016-01-19 15:07:47 +0000 | [diff] [blame] | 561 | Location ref, |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 562 | CpuRegister obj, |
| 563 | uint32_t offset, |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 564 | bool needs_null_check); |
| 565 | // Fast path implementation of ReadBarrier::Barrier for a heap |
| 566 | // reference array load when Baker's read barriers are used. |
| 567 | void GenerateArrayLoadWithBakerReadBarrier(HInstruction* instruction, |
Roland Levillain | e3f43ac | 2016-01-19 15:07:47 +0000 | [diff] [blame] | 568 | Location ref, |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 569 | CpuRegister obj, |
| 570 | uint32_t data_offset, |
| 571 | Location index, |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 572 | bool needs_null_check); |
Roland Levillain | a1aa3b1 | 2016-10-26 13:03:38 +0100 | [diff] [blame] | 573 | // Factored implementation, used by GenerateFieldLoadWithBakerReadBarrier, |
| 574 | // GenerateArrayLoadWithBakerReadBarrier and some intrinsics. |
| 575 | // |
| 576 | // Load the object reference located at address `src`, held by |
| 577 | // object `obj`, into `ref`, and mark it if needed. The base of |
| 578 | // address `src` must be `obj`. |
| 579 | // |
| 580 | // If `always_update_field` is true, the value of the reference is |
| 581 | // atomically updated in the holder (`obj`). This operation |
| 582 | // requires two temporary registers, which must be provided as |
| 583 | // non-null pointers (`temp1` and `temp2`). |
Sang, Chunlei | 0fcd2b8 | 2016-04-05 17:12:59 +0800 | [diff] [blame] | 584 | void GenerateReferenceLoadWithBakerReadBarrier(HInstruction* instruction, |
| 585 | Location ref, |
| 586 | CpuRegister obj, |
| 587 | const Address& src, |
Roland Levillain | a1aa3b1 | 2016-10-26 13:03:38 +0100 | [diff] [blame] | 588 | bool needs_null_check, |
| 589 | bool always_update_field = false, |
| 590 | CpuRegister* temp1 = nullptr, |
| 591 | CpuRegister* temp2 = nullptr); |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 592 | |
| 593 | // Generate a read barrier for a heap reference within `instruction` |
| 594 | // using a slow path. |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 595 | // |
| 596 | // A read barrier for an object reference read from the heap is |
| 597 | // implemented as a call to the artReadBarrierSlow runtime entry |
| 598 | // point, which is passed the values in locations `ref`, `obj`, and |
| 599 | // `offset`: |
| 600 | // |
| 601 | // mirror::Object* artReadBarrierSlow(mirror::Object* ref, |
| 602 | // mirror::Object* obj, |
| 603 | // uint32_t offset); |
| 604 | // |
| 605 | // The `out` location contains the value returned by |
| 606 | // artReadBarrierSlow. |
| 607 | // |
| 608 | // When `index` provided (i.e., when it is different from |
| 609 | // Location::NoLocation()), the offset value passed to |
| 610 | // artReadBarrierSlow is adjusted to take `index` into account. |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 611 | void GenerateReadBarrierSlow(HInstruction* instruction, |
| 612 | Location out, |
| 613 | Location ref, |
| 614 | Location obj, |
| 615 | uint32_t offset, |
| 616 | Location index = Location::NoLocation()); |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 617 | |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 618 | // If read barriers are enabled, generate a read barrier for a heap |
| 619 | // reference using a slow path. If heap poisoning is enabled, also |
| 620 | // unpoison the reference in `out`. |
| 621 | void MaybeGenerateReadBarrierSlow(HInstruction* instruction, |
| 622 | Location out, |
| 623 | Location ref, |
| 624 | Location obj, |
| 625 | uint32_t offset, |
| 626 | Location index = Location::NoLocation()); |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 627 | |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 628 | // Generate a read barrier for a GC root within `instruction` using |
| 629 | // a slow path. |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 630 | // |
| 631 | // A read barrier for an object reference GC root is implemented as |
| 632 | // a call to the artReadBarrierForRootSlow runtime entry point, |
| 633 | // which is passed the value in location `root`: |
| 634 | // |
| 635 | // mirror::Object* artReadBarrierForRootSlow(GcRoot<mirror::Object>* root); |
| 636 | // |
| 637 | // The `out` location contains the value returned by |
| 638 | // artReadBarrierForRootSlow. |
Roland Levillain | 1e7f8db | 2015-12-15 10:54:19 +0000 | [diff] [blame] | 639 | void GenerateReadBarrierForRootSlow(HInstruction* instruction, Location out, Location root); |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 640 | |
Mark Mendell | f55c3e0 | 2015-03-26 21:07:46 -0400 | [diff] [blame] | 641 | int ConstantAreaStart() const { |
| 642 | return constant_area_start_; |
| 643 | } |
| 644 | |
| 645 | Address LiteralDoubleAddress(double v); |
| 646 | Address LiteralFloatAddress(float v); |
| 647 | Address LiteralInt32Address(int32_t v); |
| 648 | Address LiteralInt64Address(int64_t v); |
| 649 | |
Aart Bik | a19616e | 2016-02-01 18:57:58 -0800 | [diff] [blame] | 650 | // Load a 32/64-bit value into a register in the most efficient manner. |
Aart Bik | c5d4754 | 2016-01-27 17:00:35 -0800 | [diff] [blame] | 651 | void Load32BitValue(CpuRegister dest, int32_t value); |
Mark Mendell | 92e83bf | 2015-05-07 11:25:03 -0400 | [diff] [blame] | 652 | void Load64BitValue(CpuRegister dest, int64_t value); |
Mark Mendell | 7c0b44f | 2016-02-01 10:08:35 -0500 | [diff] [blame] | 653 | void Load32BitValue(XmmRegister dest, int32_t value); |
| 654 | void Load64BitValue(XmmRegister dest, int64_t value); |
| 655 | void Load32BitValue(XmmRegister dest, float value); |
| 656 | void Load64BitValue(XmmRegister dest, double value); |
Aart Bik | c5d4754 | 2016-01-27 17:00:35 -0800 | [diff] [blame] | 657 | |
Aart Bik | a19616e | 2016-02-01 18:57:58 -0800 | [diff] [blame] | 658 | // Compare a register with a 32/64-bit value in the most efficient manner. |
| 659 | void Compare32BitValue(CpuRegister dest, int32_t value); |
| 660 | void Compare64BitValue(CpuRegister dest, int64_t value); |
| 661 | |
jessicahandojo | 4877b79 | 2016-09-08 19:49:13 -0700 | [diff] [blame] | 662 | // Compare int values. Supports register locations for `lhs`. |
Vladimir Marko | 56f4bdd | 2016-09-16 11:32:36 +0100 | [diff] [blame] | 663 | void GenerateIntCompare(Location lhs, Location rhs); |
jessicahandojo | 4877b79 | 2016-09-08 19:49:13 -0700 | [diff] [blame] | 664 | void GenerateIntCompare(CpuRegister lhs, Location rhs); |
Vladimir Marko | 56f4bdd | 2016-09-16 11:32:36 +0100 | [diff] [blame] | 665 | |
| 666 | // Compare long values. Supports only register locations for `lhs`. |
| 667 | void GenerateLongCompare(Location lhs, Location rhs); |
| 668 | |
| 669 | // Construct address for array access. |
| 670 | static Address ArrayAddress(CpuRegister obj, |
| 671 | Location index, |
| 672 | ScaleFactor scale, |
| 673 | uint32_t data_offset); |
| 674 | |
Mark Mendell | 9c86b48 | 2015-09-18 13:36:07 -0400 | [diff] [blame] | 675 | Address LiteralCaseTable(HPackedSwitch* switch_instr); |
Mark Mendell | 92e83bf | 2015-05-07 11:25:03 -0400 | [diff] [blame] | 676 | |
Mark Mendell | cfa410b | 2015-05-25 16:02:44 -0400 | [diff] [blame] | 677 | // Store a 64 bit value into a DoubleStackSlot in the most efficient manner. |
| 678 | void Store64BitValueToStack(Location dest, int64_t value); |
| 679 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 680 | void MoveFromReturnRegister(Location trg, DataType::Type type) override; |
Vladimir Marko | eebb821 | 2018-06-05 14:57:24 +0100 | [diff] [blame] | 681 | |
Mark Mendell | ea5af68 | 2015-10-22 17:35:49 -0400 | [diff] [blame] | 682 | // Assign a 64 bit constant to an address. |
| 683 | void MoveInt64ToAddress(const Address& addr_low, |
| 684 | const Address& addr_high, |
| 685 | int64_t v, |
| 686 | HInstruction* instruction); |
| 687 | |
Mark P Mendell | 17077d8 | 2015-12-16 19:15:59 +0000 | [diff] [blame] | 688 | // Ensure that prior stores complete to memory before subsequent loads. |
| 689 | // The locked add implementation will avoid serializing device memory, but will |
Mark Mendell | 7aa04a1 | 2016-01-27 22:39:07 -0500 | [diff] [blame] | 690 | // touch (but not change) the top of the stack. |
| 691 | // The 'non_temporal' parameter should be used to ensure ordering of non-temporal stores. |
Mark P Mendell | 17077d8 | 2015-12-16 19:15:59 +0000 | [diff] [blame] | 692 | void MemoryFence(bool force_mfence = false) { |
Mark Mendell | 7aa04a1 | 2016-01-27 22:39:07 -0500 | [diff] [blame] | 693 | if (!force_mfence) { |
Mark P Mendell | 17077d8 | 2015-12-16 19:15:59 +0000 | [diff] [blame] | 694 | assembler_.lock()->addl(Address(CpuRegister(RSP), 0), Immediate(0)); |
| 695 | } else { |
| 696 | assembler_.mfence(); |
| 697 | } |
| 698 | } |
| 699 | |
Vladimir Marko | dec7817 | 2020-06-19 15:31:23 +0100 | [diff] [blame] | 700 | void IncreaseFrame(size_t adjustment) override; |
| 701 | void DecreaseFrame(size_t adjustment) override; |
| 702 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 703 | void GenerateNop() override; |
| 704 | void GenerateImplicitNullCheck(HNullCheck* instruction) override; |
| 705 | void GenerateExplicitNullCheck(HNullCheck* instruction) override; |
Nicolas Geoffray | 20036d8 | 2019-11-28 16:15:00 +0000 | [diff] [blame] | 706 | void MaybeGenerateInlineCacheCheck(HInstruction* instruction, CpuRegister cls); |
Nicolas Geoffray | e2a3aa9 | 2019-11-25 17:52:58 +0000 | [diff] [blame] | 707 | |
Nicolas Geoffray | a59af8a | 2019-11-27 17:42:32 +0000 | [diff] [blame] | 708 | void MaybeIncrementHotness(bool is_frame_entry); |
| 709 | |
Vladimir Marko | 86c8752 | 2020-05-11 16:55:55 +0100 | [diff] [blame] | 710 | static void BlockNonVolatileXmmRegisters(LocationSummary* locations); |
| 711 | |
Vladimir Marko | 4ef451a | 2020-07-23 09:54:27 +0000 | [diff] [blame] | 712 | // When we don't know the proper offset for the value, we use kPlaceholder32BitOffset. |
Vladimir Marko | cac5a7e | 2016-02-22 10:39:50 +0000 | [diff] [blame] | 713 | // We will fix this up in the linker later to have the right value. |
Vladimir Marko | 4ef451a | 2020-07-23 09:54:27 +0000 | [diff] [blame] | 714 | static constexpr int32_t kPlaceholder32BitOffset = 256; |
Vladimir Marko | cac5a7e | 2016-02-22 10:39:50 +0000 | [diff] [blame] | 715 | |
Nicolas Geoffray | 3c7bb98 | 2014-07-23 16:04:16 +0100 | [diff] [blame] | 716 | private: |
Vladimir Marko | d8dbc8d | 2017-09-20 13:37:47 +0100 | [diff] [blame] | 717 | template <linker::LinkerPatch (*Factory)(size_t, const DexFile*, uint32_t, uint32_t)> |
Vladimir Marko | aad75c6 | 2016-10-03 08:46:48 +0000 | [diff] [blame] | 718 | static void EmitPcRelativeLinkerPatches(const ArenaDeque<PatchInfo<Label>>& infos, |
Vladimir Marko | d8dbc8d | 2017-09-20 13:37:47 +0100 | [diff] [blame] | 719 | ArenaVector<linker::LinkerPatch>* linker_patches); |
Vladimir Marko | 5815501 | 2015-08-19 12:49:41 +0000 | [diff] [blame] | 720 | |
Nicolas Geoffray | 92a73ae | 2014-10-16 11:12:52 +0100 | [diff] [blame] | 721 | // Labels for each block that will be compiled. |
Vladimir Marko | 225b646 | 2015-09-28 12:17:40 +0100 | [diff] [blame] | 722 | Label* block_labels_; // Indexed by block id. |
Nicolas Geoffray | 1cf9528 | 2014-12-12 19:22:03 +0000 | [diff] [blame] | 723 | Label frame_entry_label_; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 724 | LocationsBuilderX86_64 location_builder_; |
| 725 | InstructionCodeGeneratorX86_64 instruction_visitor_; |
Nicolas Geoffray | ecb2f9b | 2014-06-13 08:59:59 +0000 | [diff] [blame] | 726 | ParallelMoveResolverX86_64 move_resolver_; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 727 | X86_64Assembler assembler_; |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 728 | |
Mark Mendell | 39dcf55 | 2015-04-09 20:42:42 -0400 | [diff] [blame] | 729 | // Offset to the start of the constant area in the assembled code. |
Mark Mendell | f55c3e0 | 2015-03-26 21:07:46 -0400 | [diff] [blame] | 730 | // Used for fixups to the constant area. |
| 731 | int constant_area_start_; |
| 732 | |
Vladimir Marko | 2d06e02 | 2019-07-08 15:45:19 +0100 | [diff] [blame] | 733 | // PC-relative method patch info for kBootImageLinkTimePcRelative. |
Vladimir Marko | 6597946 | 2017-05-19 17:25:12 +0100 | [diff] [blame] | 734 | ArenaDeque<PatchInfo<Label>> boot_image_method_patches_; |
Vladimir Marko | 0eb882b | 2017-05-15 13:39:18 +0100 | [diff] [blame] | 735 | // PC-relative method patch info for kBssEntry. |
| 736 | ArenaDeque<PatchInfo<Label>> method_bss_entry_patches_; |
Vladimir Marko | 764d454 | 2017-05-16 10:31:41 +0100 | [diff] [blame] | 737 | // PC-relative type patch info for kBootImageLinkTimePcRelative. |
Vladimir Marko | 1998cd0 | 2017-01-13 13:02:58 +0000 | [diff] [blame] | 738 | ArenaDeque<PatchInfo<Label>> boot_image_type_patches_; |
Vladimir Marko | e47f60c | 2018-02-21 13:43:28 +0000 | [diff] [blame] | 739 | // PC-relative type patch info for kBssEntry. |
Vladimir Marko | 1998cd0 | 2017-01-13 13:02:58 +0000 | [diff] [blame] | 740 | ArenaDeque<PatchInfo<Label>> type_bss_entry_patches_; |
Vladimir Marko | 8f63f10 | 2020-09-28 12:10:28 +0100 | [diff] [blame] | 741 | // PC-relative public type patch info for kBssEntryPublic. |
| 742 | ArenaDeque<PatchInfo<Label>> public_type_bss_entry_patches_; |
| 743 | // PC-relative package type patch info for kBssEntryPackage. |
| 744 | ArenaDeque<PatchInfo<Label>> package_type_bss_entry_patches_; |
Vladimir Marko | e47f60c | 2018-02-21 13:43:28 +0000 | [diff] [blame] | 745 | // PC-relative String patch info for kBootImageLinkTimePcRelative. |
Vladimir Marko | 59eb30f | 2018-02-20 11:52:34 +0000 | [diff] [blame] | 746 | ArenaDeque<PatchInfo<Label>> boot_image_string_patches_; |
Vladimir Marko | e47f60c | 2018-02-21 13:43:28 +0000 | [diff] [blame] | 747 | // PC-relative String patch info for kBssEntry. |
Vladimir Marko | 6cfbdbc | 2017-07-25 13:26:39 +0100 | [diff] [blame] | 748 | ArenaDeque<PatchInfo<Label>> string_bss_entry_patches_; |
Vladimir Marko | eb9eb00 | 2020-10-02 13:54:19 +0100 | [diff] [blame] | 749 | // PC-relative method patch info for kBootImageLinkTimePcRelative+kCallCriticalNative. |
| 750 | ArenaDeque<PatchInfo<Label>> boot_image_jni_entrypoint_patches_; |
Vladimir Marko | 2d06e02 | 2019-07-08 15:45:19 +0100 | [diff] [blame] | 751 | // PC-relative patch info for IntrinsicObjects for the boot image, |
| 752 | // and for method/type/string patches for kBootImageRelRo otherwise. |
| 753 | ArenaDeque<PatchInfo<Label>> boot_image_other_patches_; |
Mark Mendell | 9c86b48 | 2015-09-18 13:36:07 -0400 | [diff] [blame] | 754 | |
Nicolas Geoffray | 132d836 | 2016-11-16 09:19:42 +0000 | [diff] [blame] | 755 | // Patches for string literals in JIT compiled code. |
| 756 | ArenaDeque<PatchInfo<Label>> jit_string_patches_; |
Nicolas Geoffray | 22384ae | 2016-12-12 22:33:36 +0000 | [diff] [blame] | 757 | // Patches for class literals in JIT compiled code. |
| 758 | ArenaDeque<PatchInfo<Label>> jit_class_patches_; |
| 759 | |
Vladimir Marko | 6597946 | 2017-05-19 17:25:12 +0100 | [diff] [blame] | 760 | // Fixups for jump tables need to be handled specially. |
| 761 | ArenaVector<JumpTableRIPFixup*> fixups_to_jump_tables_; |
| 762 | |
Nicolas Geoffray | 9cf3552 | 2014-06-09 18:40:10 +0100 | [diff] [blame] | 763 | DISALLOW_COPY_AND_ASSIGN(CodeGeneratorX86_64); |
| 764 | }; |
| 765 | |
| 766 | } // namespace x86_64 |
| 767 | } // namespace art |
| 768 | |
| 769 | #endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_X86_64_H_ |