1 /* 2 * Copyright (C) 2016 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_ARM_VIXL_H_ 18 #define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_ARM_VIXL_H_ 19 20 #include "base/enums.h" 21 #include "class_root.h" 22 #include "code_generator.h" 23 #include "common_arm.h" 24 #include "dex/string_reference.h" 25 #include "dex/type_reference.h" 26 #include "driver/compiler_options.h" 27 #include "nodes.h" 28 #include "parallel_move_resolver.h" 29 #include "utils/arm/assembler_arm_vixl.h" 30 31 // TODO(VIXL): make vixl clean wrt -Wshadow. 32 #pragma GCC diagnostic push 33 #pragma GCC diagnostic ignored "-Wshadow" 34 #include "aarch32/constants-aarch32.h" 35 #include "aarch32/instructions-aarch32.h" 36 #include "aarch32/macro-assembler-aarch32.h" 37 #pragma GCC diagnostic pop 38 39 namespace art { 40 41 namespace linker { 42 class Thumb2RelativePatcherTest; 43 } // namespace linker 44 45 namespace arm { 46 47 // This constant is used as an approximate margin when emission of veneer and literal pools 48 // must be blocked. 49 static constexpr int kMaxMacroInstructionSizeInBytes = 50 15 * vixl::aarch32::kMaxInstructionSizeInBytes; 51 52 static const vixl::aarch32::Register kParameterCoreRegistersVIXL[] = { 53 vixl::aarch32::r1, 54 vixl::aarch32::r2, 55 vixl::aarch32::r3 56 }; 57 static const size_t kParameterCoreRegistersLengthVIXL = arraysize(kParameterCoreRegistersVIXL); 58 static const vixl::aarch32::SRegister kParameterFpuRegistersVIXL[] = { 59 vixl::aarch32::s0, 60 vixl::aarch32::s1, 61 vixl::aarch32::s2, 62 vixl::aarch32::s3, 63 vixl::aarch32::s4, 64 vixl::aarch32::s5, 65 vixl::aarch32::s6, 66 vixl::aarch32::s7, 67 vixl::aarch32::s8, 68 vixl::aarch32::s9, 69 vixl::aarch32::s10, 70 vixl::aarch32::s11, 71 vixl::aarch32::s12, 72 vixl::aarch32::s13, 73 vixl::aarch32::s14, 74 vixl::aarch32::s15 75 }; 76 static const size_t kParameterFpuRegistersLengthVIXL = arraysize(kParameterFpuRegistersVIXL); 77 78 static const vixl::aarch32::Register kMethodRegister = vixl::aarch32::r0; 79 80 // Callee saves core registers r5, r6, r7, r8 (except when emitting Baker 81 // read barriers, where it is used as Marking Register), r10, r11, and lr. 82 static const vixl::aarch32::RegisterList kCoreCalleeSaves = vixl::aarch32::RegisterList::Union( 83 vixl::aarch32::RegisterList(vixl::aarch32::r5, 84 vixl::aarch32::r6, 85 vixl::aarch32::r7), 86 // Do not consider r8 as a callee-save register with Baker read barriers. 87 ((kEmitCompilerReadBarrier && kUseBakerReadBarrier) 88 ? vixl::aarch32::RegisterList() 89 : vixl::aarch32::RegisterList(vixl::aarch32::r8)), 90 vixl::aarch32::RegisterList(vixl::aarch32::r10, 91 vixl::aarch32::r11, 92 vixl::aarch32::lr)); 93 94 // Callee saves FP registers s16 to s31 inclusive. 95 static const vixl::aarch32::SRegisterList kFpuCalleeSaves = 96 vixl::aarch32::SRegisterList(vixl::aarch32::s16, 16); 97 98 static const vixl::aarch32::Register kRuntimeParameterCoreRegistersVIXL[] = { 99 vixl::aarch32::r0, 100 vixl::aarch32::r1, 101 vixl::aarch32::r2, 102 vixl::aarch32::r3 103 }; 104 static const size_t kRuntimeParameterCoreRegistersLengthVIXL = 105 arraysize(kRuntimeParameterCoreRegistersVIXL); 106 static const vixl::aarch32::SRegister kRuntimeParameterFpuRegistersVIXL[] = { 107 vixl::aarch32::s0, 108 vixl::aarch32::s1, 109 vixl::aarch32::s2, 110 vixl::aarch32::s3 111 }; 112 static const size_t kRuntimeParameterFpuRegistersLengthVIXL = 113 arraysize(kRuntimeParameterFpuRegistersVIXL); 114 115 class LoadClassSlowPathARMVIXL; 116 class CodeGeneratorARMVIXL; 117 118 using VIXLInt32Literal = vixl::aarch32::Literal<int32_t>; 119 using VIXLUInt32Literal = vixl::aarch32::Literal<uint32_t>; 120 121 class JumpTableARMVIXL : public DeletableArenaObject<kArenaAllocSwitchTable> { 122 public: JumpTableARMVIXL(HPackedSwitch * switch_instr)123 explicit JumpTableARMVIXL(HPackedSwitch* switch_instr) 124 : switch_instr_(switch_instr), 125 table_start_(), 126 bb_addresses_(switch_instr->GetAllocator()->Adapter(kArenaAllocCodeGenerator)) { 127 uint32_t num_entries = switch_instr_->GetNumEntries(); 128 for (uint32_t i = 0; i < num_entries; i++) { 129 VIXLInt32Literal *lit = new VIXLInt32Literal(0, vixl32::RawLiteral::kManuallyPlaced); 130 bb_addresses_.emplace_back(lit); 131 } 132 } 133 GetTableStartLabel()134 vixl::aarch32::Label* GetTableStartLabel() { return &table_start_; } 135 136 void EmitTable(CodeGeneratorARMVIXL* codegen); 137 void FixTable(CodeGeneratorARMVIXL* codegen); 138 139 private: 140 HPackedSwitch* const switch_instr_; 141 vixl::aarch32::Label table_start_; 142 ArenaVector<std::unique_ptr<VIXLInt32Literal>> bb_addresses_; 143 144 DISALLOW_COPY_AND_ASSIGN(JumpTableARMVIXL); 145 }; 146 147 class InvokeRuntimeCallingConventionARMVIXL 148 : public CallingConvention<vixl::aarch32::Register, vixl::aarch32::SRegister> { 149 public: InvokeRuntimeCallingConventionARMVIXL()150 InvokeRuntimeCallingConventionARMVIXL() 151 : CallingConvention(kRuntimeParameterCoreRegistersVIXL, 152 kRuntimeParameterCoreRegistersLengthVIXL, 153 kRuntimeParameterFpuRegistersVIXL, 154 kRuntimeParameterFpuRegistersLengthVIXL, 155 kArmPointerSize) {} 156 157 private: 158 DISALLOW_COPY_AND_ASSIGN(InvokeRuntimeCallingConventionARMVIXL); 159 }; 160 161 class InvokeDexCallingConventionARMVIXL 162 : public CallingConvention<vixl::aarch32::Register, vixl::aarch32::SRegister> { 163 public: InvokeDexCallingConventionARMVIXL()164 InvokeDexCallingConventionARMVIXL() 165 : CallingConvention(kParameterCoreRegistersVIXL, 166 kParameterCoreRegistersLengthVIXL, 167 kParameterFpuRegistersVIXL, 168 kParameterFpuRegistersLengthVIXL, 169 kArmPointerSize) {} 170 171 private: 172 DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionARMVIXL); 173 }; 174 175 class InvokeDexCallingConventionVisitorARMVIXL : public InvokeDexCallingConventionVisitor { 176 public: InvokeDexCallingConventionVisitorARMVIXL()177 InvokeDexCallingConventionVisitorARMVIXL() {} ~InvokeDexCallingConventionVisitorARMVIXL()178 virtual ~InvokeDexCallingConventionVisitorARMVIXL() {} 179 180 Location GetNextLocation(DataType::Type type) override; 181 Location GetReturnLocation(DataType::Type type) const override; 182 Location GetMethodLocation() const override; 183 184 private: 185 InvokeDexCallingConventionARMVIXL calling_convention; 186 uint32_t double_index_ = 0; 187 188 DISALLOW_COPY_AND_ASSIGN(InvokeDexCallingConventionVisitorARMVIXL); 189 }; 190 191 class CriticalNativeCallingConventionVisitorARMVIXL : public InvokeDexCallingConventionVisitor { 192 public: CriticalNativeCallingConventionVisitorARMVIXL(bool for_register_allocation)193 explicit CriticalNativeCallingConventionVisitorARMVIXL(bool for_register_allocation) 194 : for_register_allocation_(for_register_allocation) {} 195 ~CriticalNativeCallingConventionVisitorARMVIXL()196 virtual ~CriticalNativeCallingConventionVisitorARMVIXL() {} 197 198 Location GetNextLocation(DataType::Type type) override; 199 Location GetReturnLocation(DataType::Type type) const override; 200 Location GetMethodLocation() const override; 201 GetStackOffset()202 size_t GetStackOffset() const { return stack_offset_; } 203 204 private: 205 // Register allocator does not support adjusting frame size, so we cannot provide final locations 206 // of stack arguments for register allocation. We ask the register allocator for any location and 207 // move these arguments to the right place after adjusting the SP when generating the call. 208 const bool for_register_allocation_; 209 size_t gpr_index_ = 0u; 210 size_t stack_offset_ = 0u; 211 212 DISALLOW_COPY_AND_ASSIGN(CriticalNativeCallingConventionVisitorARMVIXL); 213 }; 214 215 class FieldAccessCallingConventionARMVIXL : public FieldAccessCallingConvention { 216 public: FieldAccessCallingConventionARMVIXL()217 FieldAccessCallingConventionARMVIXL() {} 218 GetObjectLocation()219 Location GetObjectLocation() const override { 220 return helpers::LocationFrom(vixl::aarch32::r1); 221 } GetFieldIndexLocation()222 Location GetFieldIndexLocation() const override { 223 return helpers::LocationFrom(vixl::aarch32::r0); 224 } GetReturnLocation(DataType::Type type)225 Location GetReturnLocation(DataType::Type type) const override { 226 return DataType::Is64BitType(type) 227 ? helpers::LocationFrom(vixl::aarch32::r0, vixl::aarch32::r1) 228 : helpers::LocationFrom(vixl::aarch32::r0); 229 } GetSetValueLocation(DataType::Type type,bool is_instance)230 Location GetSetValueLocation(DataType::Type type, bool is_instance) const override { 231 return DataType::Is64BitType(type) 232 ? helpers::LocationFrom(vixl::aarch32::r2, vixl::aarch32::r3) 233 : (is_instance 234 ? helpers::LocationFrom(vixl::aarch32::r2) 235 : helpers::LocationFrom(vixl::aarch32::r1)); 236 } GetFpuLocation(DataType::Type type)237 Location GetFpuLocation(DataType::Type type) const override { 238 return DataType::Is64BitType(type) 239 ? helpers::LocationFrom(vixl::aarch32::s0, vixl::aarch32::s1) 240 : helpers::LocationFrom(vixl::aarch32::s0); 241 } 242 243 private: 244 DISALLOW_COPY_AND_ASSIGN(FieldAccessCallingConventionARMVIXL); 245 }; 246 247 class SlowPathCodeARMVIXL : public SlowPathCode { 248 public: SlowPathCodeARMVIXL(HInstruction * instruction)249 explicit SlowPathCodeARMVIXL(HInstruction* instruction) 250 : SlowPathCode(instruction), entry_label_(), exit_label_() {} 251 GetEntryLabel()252 vixl::aarch32::Label* GetEntryLabel() { return &entry_label_; } GetExitLabel()253 vixl::aarch32::Label* GetExitLabel() { return &exit_label_; } 254 255 void SaveLiveRegisters(CodeGenerator* codegen, LocationSummary* locations) override; 256 void RestoreLiveRegisters(CodeGenerator* codegen, LocationSummary* locations) override; 257 258 private: 259 vixl::aarch32::Label entry_label_; 260 vixl::aarch32::Label exit_label_; 261 262 DISALLOW_COPY_AND_ASSIGN(SlowPathCodeARMVIXL); 263 }; 264 265 class ParallelMoveResolverARMVIXL : public ParallelMoveResolverWithSwap { 266 public: ParallelMoveResolverARMVIXL(ArenaAllocator * allocator,CodeGeneratorARMVIXL * codegen)267 ParallelMoveResolverARMVIXL(ArenaAllocator* allocator, CodeGeneratorARMVIXL* codegen) 268 : ParallelMoveResolverWithSwap(allocator), codegen_(codegen) {} 269 270 void EmitMove(size_t index) override; 271 void EmitSwap(size_t index) override; 272 void SpillScratch(int reg) override; 273 void RestoreScratch(int reg) override; 274 275 ArmVIXLAssembler* GetAssembler() const; 276 277 private: 278 void Exchange(vixl32::Register reg, int mem); 279 void Exchange(int mem1, int mem2); 280 281 CodeGeneratorARMVIXL* const codegen_; 282 283 DISALLOW_COPY_AND_ASSIGN(ParallelMoveResolverARMVIXL); 284 }; 285 286 class LocationsBuilderARMVIXL : public HGraphVisitor { 287 public: LocationsBuilderARMVIXL(HGraph * graph,CodeGeneratorARMVIXL * codegen)288 LocationsBuilderARMVIXL(HGraph* graph, CodeGeneratorARMVIXL* codegen) 289 : HGraphVisitor(graph), codegen_(codegen) {} 290 291 #define DECLARE_VISIT_INSTRUCTION(name, super) \ 292 void Visit##name(H##name* instr) override; 293 294 FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) FOR_EACH_CONCRETE_INSTRUCTION_ARM(DECLARE_VISIT_INSTRUCTION)295 FOR_EACH_CONCRETE_INSTRUCTION_ARM(DECLARE_VISIT_INSTRUCTION) 296 FOR_EACH_CONCRETE_INSTRUCTION_SHARED(DECLARE_VISIT_INSTRUCTION) 297 298 #undef DECLARE_VISIT_INSTRUCTION 299 300 void VisitInstruction(HInstruction* instruction) override { 301 LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() 302 << " (id " << instruction->GetId() << ")"; 303 } 304 305 private: 306 void HandleInvoke(HInvoke* invoke); 307 void HandleBitwiseOperation(HBinaryOperation* operation, Opcode opcode); 308 void HandleCondition(HCondition* condition); 309 void HandleIntegerRotate(LocationSummary* locations); 310 void HandleLongRotate(LocationSummary* locations); 311 void HandleShift(HBinaryOperation* operation); 312 void HandleFieldSet(HInstruction* instruction, const FieldInfo& field_info); 313 void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); 314 315 Location ArithmeticZeroOrFpuRegister(HInstruction* input); 316 Location ArmEncodableConstantOrRegister(HInstruction* constant, Opcode opcode); 317 bool CanEncodeConstantAsImmediate(HConstant* input_cst, Opcode opcode); 318 319 CodeGeneratorARMVIXL* const codegen_; 320 InvokeDexCallingConventionVisitorARMVIXL parameter_visitor_; 321 322 DISALLOW_COPY_AND_ASSIGN(LocationsBuilderARMVIXL); 323 }; 324 325 class InstructionCodeGeneratorARMVIXL : public InstructionCodeGenerator { 326 public: 327 InstructionCodeGeneratorARMVIXL(HGraph* graph, CodeGeneratorARMVIXL* codegen); 328 329 #define DECLARE_VISIT_INSTRUCTION(name, super) \ 330 void Visit##name(H##name* instr) override; 331 332 FOR_EACH_CONCRETE_INSTRUCTION_COMMON(DECLARE_VISIT_INSTRUCTION) FOR_EACH_CONCRETE_INSTRUCTION_ARM(DECLARE_VISIT_INSTRUCTION)333 FOR_EACH_CONCRETE_INSTRUCTION_ARM(DECLARE_VISIT_INSTRUCTION) 334 FOR_EACH_CONCRETE_INSTRUCTION_SHARED(DECLARE_VISIT_INSTRUCTION) 335 336 #undef DECLARE_VISIT_INSTRUCTION 337 338 void VisitInstruction(HInstruction* instruction) override { 339 LOG(FATAL) << "Unreachable instruction " << instruction->DebugName() 340 << " (id " << instruction->GetId() << ")"; 341 } 342 GetAssembler()343 ArmVIXLAssembler* GetAssembler() const { return assembler_; } GetVIXLAssembler()344 ArmVIXLMacroAssembler* GetVIXLAssembler() { return GetAssembler()->GetVIXLAssembler(); } 345 346 void GenerateAndConst(vixl::aarch32::Register out, vixl::aarch32::Register first, uint32_t value); 347 348 private: 349 // Generate code for the given suspend check. If not null, `successor` 350 // is the block to branch to if the suspend check is not needed, and after 351 // the suspend call. 352 void GenerateSuspendCheck(HSuspendCheck* instruction, HBasicBlock* successor); 353 void GenerateClassInitializationCheck(LoadClassSlowPathARMVIXL* slow_path, 354 vixl32::Register class_reg); 355 void GenerateBitstringTypeCheckCompare(HTypeCheckInstruction* check, 356 vixl::aarch32::Register temp, 357 vixl::aarch32::FlagsUpdate flags_update); 358 void GenerateOrrConst(vixl::aarch32::Register out, vixl::aarch32::Register first, uint32_t value); 359 void GenerateEorConst(vixl::aarch32::Register out, vixl::aarch32::Register first, uint32_t value); 360 void GenerateAddLongConst(Location out, Location first, uint64_t value); 361 void HandleBitwiseOperation(HBinaryOperation* operation); 362 void HandleCondition(HCondition* condition); 363 void HandleIntegerRotate(HRor* ror); 364 void HandleLongRotate(HRor* ror); 365 void HandleShift(HBinaryOperation* operation); 366 367 void GenerateWideAtomicStore(vixl::aarch32::Register addr, 368 uint32_t offset, 369 vixl::aarch32::Register value_lo, 370 vixl::aarch32::Register value_hi, 371 vixl::aarch32::Register temp1, 372 vixl::aarch32::Register temp2, 373 HInstruction* instruction); 374 void GenerateWideAtomicLoad(vixl::aarch32::Register addr, 375 uint32_t offset, 376 vixl::aarch32::Register out_lo, 377 vixl::aarch32::Register out_hi); 378 379 void HandleFieldSet(HInstruction* instruction, 380 const FieldInfo& field_info, 381 bool value_can_be_null); 382 void HandleFieldGet(HInstruction* instruction, const FieldInfo& field_info); 383 384 void GenerateMinMaxInt(LocationSummary* locations, bool is_min); 385 void GenerateMinMaxLong(LocationSummary* locations, bool is_min); 386 void GenerateMinMaxFloat(HInstruction* minmax, bool is_min); 387 void GenerateMinMaxDouble(HInstruction* minmax, bool is_min); 388 void GenerateMinMax(HBinaryOperation* minmax, bool is_min); 389 390 // Generate a heap reference load using one register `out`: 391 // 392 // out <- *(out + offset) 393 // 394 // while honoring heap poisoning and/or read barriers (if any). 395 // 396 // Location `maybe_temp` is used when generating a read barrier and 397 // shall be a register in that case; it may be an invalid location 398 // otherwise. 399 void GenerateReferenceLoadOneRegister(HInstruction* instruction, 400 Location out, 401 uint32_t offset, 402 Location maybe_temp, 403 ReadBarrierOption read_barrier_option); 404 // Generate a heap reference load using two different registers 405 // `out` and `obj`: 406 // 407 // out <- *(obj + offset) 408 // 409 // while honoring heap poisoning and/or read barriers (if any). 410 // 411 // Location `maybe_temp` is used when generating a Baker's (fast 412 // path) read barrier and shall be a register in that case; it may 413 // be an invalid location otherwise. 414 void GenerateReferenceLoadTwoRegisters(HInstruction* instruction, 415 Location out, 416 Location obj, 417 uint32_t offset, 418 Location maybe_temp, 419 ReadBarrierOption read_barrier_option); 420 void GenerateTestAndBranch(HInstruction* instruction, 421 size_t condition_input_index, 422 vixl::aarch32::Label* true_target, 423 vixl::aarch32::Label* false_target, 424 bool far_target = true); 425 void GenerateCompareTestAndBranch(HCondition* condition, 426 vixl::aarch32::Label* true_target, 427 vixl::aarch32::Label* false_target, 428 bool is_far_target = true); 429 void DivRemOneOrMinusOne(HBinaryOperation* instruction); 430 void DivRemByPowerOfTwo(HBinaryOperation* instruction); 431 void GenerateDivRemWithAnyConstant(HBinaryOperation* instruction); 432 void GenerateDivRemConstantIntegral(HBinaryOperation* instruction); 433 void HandleGoto(HInstruction* got, HBasicBlock* successor); 434 void GenerateMethodEntryExitHook(HInstruction* instruction); 435 436 vixl::aarch32::MemOperand VecAddress( 437 HVecMemoryOperation* instruction, 438 // This function may acquire a scratch register. 439 vixl::aarch32::UseScratchRegisterScope* temps_scope, 440 /*out*/ vixl32::Register* scratch); 441 vixl::aarch32::AlignedMemOperand VecAddressUnaligned( 442 HVecMemoryOperation* instruction, 443 // This function may acquire a scratch register. 444 vixl::aarch32::UseScratchRegisterScope* temps_scope, 445 /*out*/ vixl32::Register* scratch); 446 447 ArmVIXLAssembler* const assembler_; 448 CodeGeneratorARMVIXL* const codegen_; 449 450 DISALLOW_COPY_AND_ASSIGN(InstructionCodeGeneratorARMVIXL); 451 }; 452 453 class CodeGeneratorARMVIXL : public CodeGenerator { 454 public: 455 CodeGeneratorARMVIXL(HGraph* graph, 456 const CompilerOptions& compiler_options, 457 OptimizingCompilerStats* stats = nullptr); ~CodeGeneratorARMVIXL()458 virtual ~CodeGeneratorARMVIXL() {} 459 460 void GenerateFrameEntry() override; 461 void GenerateFrameExit() override; 462 void Bind(HBasicBlock* block) override; 463 void MoveConstant(Location destination, int32_t value) override; 464 void MoveLocation(Location dst, Location src, DataType::Type dst_type) override; 465 void AddLocationAsTemp(Location location, LocationSummary* locations) override; 466 467 size_t SaveCoreRegister(size_t stack_index, uint32_t reg_id) override; 468 size_t RestoreCoreRegister(size_t stack_index, uint32_t reg_id) override; 469 size_t SaveFloatingPointRegister(size_t stack_index, uint32_t reg_id) override; 470 size_t RestoreFloatingPointRegister(size_t stack_index, uint32_t reg_id) override; 471 GetWordSize()472 size_t GetWordSize() const override { 473 return static_cast<size_t>(kArmPointerSize); 474 } 475 GetCalleePreservedFPWidth()476 size_t GetCalleePreservedFPWidth() const override { 477 return vixl::aarch32::kSRegSizeInBytes; 478 } 479 GetSIMDRegisterWidth()480 size_t GetSIMDRegisterWidth() const override { 481 // ARM 32-bit backend doesn't support Q registers in vectorizer, only D 482 // registers (due to register allocator restrictions: overlapping s/d/q 483 // registers). 484 return vixl::aarch32::kDRegSizeInBytes; 485 } 486 GetLocationBuilder()487 HGraphVisitor* GetLocationBuilder() override { return &location_builder_; } 488 GetInstructionVisitor()489 HGraphVisitor* GetInstructionVisitor() override { return &instruction_visitor_; } 490 GetAssembler()491 ArmVIXLAssembler* GetAssembler() override { return &assembler_; } 492 GetAssembler()493 const ArmVIXLAssembler& GetAssembler() const override { return assembler_; } 494 GetVIXLAssembler()495 ArmVIXLMacroAssembler* GetVIXLAssembler() { return GetAssembler()->GetVIXLAssembler(); } 496 GetAddressOf(HBasicBlock * block)497 uintptr_t GetAddressOf(HBasicBlock* block) override { 498 vixl::aarch32::Label* block_entry_label = GetLabelOf(block); 499 DCHECK(block_entry_label->IsBound()); 500 return block_entry_label->GetLocation(); 501 } 502 503 void FixJumpTables(); 504 void SetupBlockedRegisters() const override; 505 506 void DumpCoreRegister(std::ostream& stream, int reg) const override; 507 void DumpFloatingPointRegister(std::ostream& stream, int reg) const override; 508 GetMoveResolver()509 ParallelMoveResolver* GetMoveResolver() override { return &move_resolver_; } GetInstructionSet()510 InstructionSet GetInstructionSet() const override { return InstructionSet::kThumb2; } 511 512 const ArmInstructionSetFeatures& GetInstructionSetFeatures() const; 513 514 // Helper method to move a 32-bit value between two locations. 515 void Move32(Location destination, Location source); 516 517 void LoadFromShiftedRegOffset(DataType::Type type, 518 Location out_loc, 519 vixl::aarch32::Register base, 520 vixl::aarch32::Register reg_index, 521 vixl::aarch32::Condition cond = vixl::aarch32::al); 522 void StoreToShiftedRegOffset(DataType::Type type, 523 Location out_loc, 524 vixl::aarch32::Register base, 525 vixl::aarch32::Register reg_index, 526 vixl::aarch32::Condition cond = vixl::aarch32::al); 527 528 // Generate code to invoke a runtime entry point. 529 void InvokeRuntime(QuickEntrypointEnum entrypoint, 530 HInstruction* instruction, 531 uint32_t dex_pc, 532 SlowPathCode* slow_path = nullptr) override; 533 534 // Generate code to invoke a runtime entry point, but do not record 535 // PC-related information in a stack map. 536 void InvokeRuntimeWithoutRecordingPcInfo(int32_t entry_point_offset, 537 HInstruction* instruction, 538 SlowPathCode* slow_path); 539 540 // Emit a write barrier. 541 void MarkGCCard(vixl::aarch32::Register temp, 542 vixl::aarch32::Register card, 543 vixl::aarch32::Register object, 544 vixl::aarch32::Register value, 545 bool value_can_be_null); 546 547 void GenerateMemoryBarrier(MemBarrierKind kind); 548 GetLabelOf(HBasicBlock * block)549 vixl::aarch32::Label* GetLabelOf(HBasicBlock* block) { 550 block = FirstNonEmptyBlock(block); 551 return &(block_labels_[block->GetBlockId()]); 552 } 553 554 vixl32::Label* GetFinalLabel(HInstruction* instruction, vixl32::Label* final_label); 555 Initialize()556 void Initialize() override { 557 block_labels_.resize(GetGraph()->GetBlocks().size()); 558 } 559 560 void Finalize(CodeAllocator* allocator) override; 561 NeedsTwoRegisters(DataType::Type type)562 bool NeedsTwoRegisters(DataType::Type type) const override { 563 return type == DataType::Type::kFloat64 || type == DataType::Type::kInt64; 564 } 565 566 void ComputeSpillMask() override; 567 GetFrameEntryLabel()568 vixl::aarch32::Label* GetFrameEntryLabel() { return &frame_entry_label_; } 569 570 // Check if the desired_string_load_kind is supported. If it is, return it, 571 // otherwise return a fall-back kind that should be used instead. 572 HLoadString::LoadKind GetSupportedLoadStringKind( 573 HLoadString::LoadKind desired_string_load_kind) override; 574 575 // Check if the desired_class_load_kind is supported. If it is, return it, 576 // otherwise return a fall-back kind that should be used instead. 577 HLoadClass::LoadKind GetSupportedLoadClassKind( 578 HLoadClass::LoadKind desired_class_load_kind) override; 579 580 // Check if the desired_dispatch_info is supported. If it is, return it, 581 // otherwise return a fall-back info that should be used instead. 582 HInvokeStaticOrDirect::DispatchInfo GetSupportedInvokeStaticOrDirectDispatch( 583 const HInvokeStaticOrDirect::DispatchInfo& desired_dispatch_info, 584 ArtMethod* method) override; 585 586 void LoadMethod(MethodLoadKind load_kind, Location temp, HInvoke* invoke); 587 void GenerateStaticOrDirectCall( 588 HInvokeStaticOrDirect* invoke, Location temp, SlowPathCode* slow_path = nullptr) override; 589 void GenerateVirtualCall( 590 HInvokeVirtual* invoke, Location temp, SlowPathCode* slow_path = nullptr) override; 591 592 void MoveFromReturnRegister(Location trg, DataType::Type type) override; 593 594 // The PcRelativePatchInfo is used for PC-relative addressing of methods/strings/types, 595 // whether through .data.bimg.rel.ro, .bss, or directly in the boot image. 596 // 597 // The PC-relative address is loaded with three instructions, 598 // MOVW+MOVT to load the offset to base_reg and then ADD base_reg, PC. The offset 599 // is calculated from the ADD's effective PC, i.e. PC+4 on Thumb2. Though we 600 // currently emit these 3 instructions together, instruction scheduling could 601 // split this sequence apart, so we keep separate labels for each of them. 602 struct PcRelativePatchInfo { PcRelativePatchInfoPcRelativePatchInfo603 PcRelativePatchInfo(const DexFile* dex_file, uint32_t off_or_idx) 604 : target_dex_file(dex_file), offset_or_index(off_or_idx) { } 605 PcRelativePatchInfo(PcRelativePatchInfo&& other) = default; 606 607 // Target dex file or null for .data.bmig.rel.ro patches. 608 const DexFile* target_dex_file; 609 // Either the boot image offset (to write to .data.bmig.rel.ro) or string/type/method index. 610 uint32_t offset_or_index; 611 vixl::aarch32::Label movw_label; 612 vixl::aarch32::Label movt_label; 613 vixl::aarch32::Label add_pc_label; 614 }; 615 616 PcRelativePatchInfo* NewBootImageIntrinsicPatch(uint32_t intrinsic_data); 617 PcRelativePatchInfo* NewBootImageRelRoPatch(uint32_t boot_image_offset); 618 PcRelativePatchInfo* NewBootImageMethodPatch(MethodReference target_method); 619 PcRelativePatchInfo* NewMethodBssEntryPatch(MethodReference target_method); 620 PcRelativePatchInfo* NewBootImageTypePatch(const DexFile& dex_file, dex::TypeIndex type_index); 621 PcRelativePatchInfo* NewTypeBssEntryPatch(HLoadClass* load_class); 622 PcRelativePatchInfo* NewBootImageStringPatch(const DexFile& dex_file, 623 dex::StringIndex string_index); 624 PcRelativePatchInfo* NewStringBssEntryPatch(const DexFile& dex_file, 625 dex::StringIndex string_index); 626 627 // Emit the BL instruction for entrypoint thunk call and record the associated patch for AOT. 628 void EmitEntrypointThunkCall(ThreadOffset32 entrypoint_offset); 629 630 // Emit the BNE instruction for baker read barrier and record 631 // the associated patch for AOT or slow path for JIT. 632 void EmitBakerReadBarrierBne(uint32_t custom_data); 633 634 VIXLUInt32Literal* DeduplicateBootImageAddressLiteral(uint32_t address); 635 VIXLUInt32Literal* DeduplicateJitStringLiteral(const DexFile& dex_file, 636 dex::StringIndex string_index, 637 Handle<mirror::String> handle); 638 VIXLUInt32Literal* DeduplicateJitClassLiteral(const DexFile& dex_file, 639 dex::TypeIndex type_index, 640 Handle<mirror::Class> handle); 641 642 void LoadBootImageRelRoEntry(vixl::aarch32::Register reg, uint32_t boot_image_offset); 643 void LoadBootImageAddress(vixl::aarch32::Register reg, uint32_t boot_image_reference); 644 void LoadTypeForBootImageIntrinsic(vixl::aarch32::Register reg, TypeReference type_reference); 645 void LoadIntrinsicDeclaringClass(vixl::aarch32::Register reg, HInvoke* invoke); 646 void LoadClassRootForIntrinsic(vixl::aarch32::Register reg, ClassRoot class_root); 647 648 void EmitLinkerPatches(ArenaVector<linker::LinkerPatch>* linker_patches) override; 649 bool NeedsThunkCode(const linker::LinkerPatch& patch) const override; 650 void EmitThunkCode(const linker::LinkerPatch& patch, 651 /*out*/ ArenaVector<uint8_t>* code, 652 /*out*/ std::string* debug_name) override; 653 654 void EmitJitRootPatches(uint8_t* code, const uint8_t* roots_data) override; 655 656 // Generate a GC root reference load: 657 // 658 // root <- *(obj + offset) 659 // 660 // while honoring read barriers based on read_barrier_option. 661 void GenerateGcRootFieldLoad(HInstruction* instruction, 662 Location root, 663 vixl::aarch32::Register obj, 664 uint32_t offset, 665 ReadBarrierOption read_barrier_option); 666 // Generate MOV for an intrinsic CAS to mark the old value with Baker read barrier. 667 void GenerateIntrinsicCasMoveWithBakerReadBarrier(vixl::aarch32::Register marked_old_value, 668 vixl::aarch32::Register old_value); 669 // Fast path implementation of ReadBarrier::Barrier for a heap 670 // reference field load when Baker's read barriers are used. 671 // Overload suitable for Unsafe.getObject/-Volatile() intrinsic. 672 void GenerateFieldLoadWithBakerReadBarrier(HInstruction* instruction, 673 Location ref, 674 vixl::aarch32::Register obj, 675 const vixl::aarch32::MemOperand& src, 676 bool needs_null_check); 677 // Fast path implementation of ReadBarrier::Barrier for a heap 678 // reference field load when Baker's read barriers are used. 679 void GenerateFieldLoadWithBakerReadBarrier(HInstruction* instruction, 680 Location ref, 681 vixl::aarch32::Register obj, 682 uint32_t offset, 683 Location maybe_temp, 684 bool needs_null_check); 685 // Fast path implementation of ReadBarrier::Barrier for a heap 686 // reference array load when Baker's read barriers are used. 687 void GenerateArrayLoadWithBakerReadBarrier(Location ref, 688 vixl::aarch32::Register obj, 689 uint32_t data_offset, 690 Location index, 691 Location temp, 692 bool needs_null_check); 693 694 // Emit code checking the status of the Marking Register, and 695 // aborting the program if MR does not match the value stored in the 696 // art::Thread object. Code is only emitted in debug mode and if 697 // CompilerOptions::EmitRunTimeChecksInDebugMode returns true. 698 // 699 // Argument `code` is used to identify the different occurrences of 700 // MaybeGenerateMarkingRegisterCheck in the code generator, and is 701 // used together with kMarkingRegisterCheckBreakCodeBaseCode to 702 // create the value passed to the BKPT instruction. Note that unlike 703 // in the ARM64 code generator, where `__LINE__` is passed as `code` 704 // argument to 705 // CodeGeneratorARM64::MaybeGenerateMarkingRegisterCheck, we cannot 706 // realistically do that here, as Encoding T1 for the BKPT 707 // instruction only accepts 8-bit immediate values. 708 // 709 // If `temp_loc` is a valid location, it is expected to be a 710 // register and will be used as a temporary to generate code; 711 // otherwise, a temporary will be fetched from the core register 712 // scratch pool. 713 virtual void MaybeGenerateMarkingRegisterCheck(int code, 714 Location temp_loc = Location::NoLocation()); 715 716 // Create slow path for a read barrier for a heap reference within `instruction`. 717 // 718 // This is a helper function for GenerateReadBarrierSlow() that has the same 719 // arguments. The creation and adding of the slow path is exposed for intrinsics 720 // that cannot use GenerateReadBarrierSlow() from their own slow paths. 721 SlowPathCodeARMVIXL* AddReadBarrierSlowPath(HInstruction* instruction, 722 Location out, 723 Location ref, 724 Location obj, 725 uint32_t offset, 726 Location index); 727 728 // Generate a read barrier for a heap reference within `instruction` 729 // using a slow path. 730 // 731 // A read barrier for an object reference read from the heap is 732 // implemented as a call to the artReadBarrierSlow runtime entry 733 // point, which is passed the values in locations `ref`, `obj`, and 734 // `offset`: 735 // 736 // mirror::Object* artReadBarrierSlow(mirror::Object* ref, 737 // mirror::Object* obj, 738 // uint32_t offset); 739 // 740 // The `out` location contains the value returned by 741 // artReadBarrierSlow. 742 // 743 // When `index` is provided (i.e. for array accesses), the offset 744 // value passed to artReadBarrierSlow is adjusted to take `index` 745 // into account. 746 void GenerateReadBarrierSlow(HInstruction* instruction, 747 Location out, 748 Location ref, 749 Location obj, 750 uint32_t offset, 751 Location index = Location::NoLocation()); 752 753 // If read barriers are enabled, generate a read barrier for a heap 754 // reference using a slow path. If heap poisoning is enabled, also 755 // unpoison the reference in `out`. 756 void MaybeGenerateReadBarrierSlow(HInstruction* instruction, 757 Location out, 758 Location ref, 759 Location obj, 760 uint32_t offset, 761 Location index = Location::NoLocation()); 762 763 // Generate a read barrier for a GC root within `instruction` using 764 // a slow path. 765 // 766 // A read barrier for an object reference GC root is implemented as 767 // a call to the artReadBarrierForRootSlow runtime entry point, 768 // which is passed the value in location `root`: 769 // 770 // mirror::Object* artReadBarrierForRootSlow(GcRoot<mirror::Object>* root); 771 // 772 // The `out` location contains the value returned by 773 // artReadBarrierForRootSlow. 774 void GenerateReadBarrierForRootSlow(HInstruction* instruction, Location out, Location root); 775 776 void IncreaseFrame(size_t adjustment) override; 777 void DecreaseFrame(size_t adjustment) override; 778 779 void GenerateNop() override; 780 781 void GenerateImplicitNullCheck(HNullCheck* instruction) override; 782 void GenerateExplicitNullCheck(HNullCheck* instruction) override; 783 CreateJumpTable(HPackedSwitch * switch_instr)784 JumpTableARMVIXL* CreateJumpTable(HPackedSwitch* switch_instr) { 785 jump_tables_.emplace_back(new (GetGraph()->GetAllocator()) JumpTableARMVIXL(switch_instr)); 786 return jump_tables_.back().get(); 787 } 788 void EmitJumpTables(); 789 790 void EmitMovwMovtPlaceholder(CodeGeneratorARMVIXL::PcRelativePatchInfo* labels, 791 vixl::aarch32::Register out); 792 793 // `temp` is an extra temporary register that is used for some conditions; 794 // callers may not specify it, in which case the method will use a scratch 795 // register instead. 796 void GenerateConditionWithZero(IfCondition condition, 797 vixl::aarch32::Register out, 798 vixl::aarch32::Register in, 799 vixl::aarch32::Register temp = vixl32::Register()); 800 MaybeRecordImplicitNullCheck(HInstruction * instr)801 void MaybeRecordImplicitNullCheck(HInstruction* instr) final { 802 // The function must be only be called within special scopes 803 // (EmissionCheckScope, ExactAssemblyScope) which prevent generation of 804 // veneer/literal pools by VIXL assembler. 805 CHECK_EQ(GetVIXLAssembler()->ArePoolsBlocked(), true) 806 << "The function must only be called within EmissionCheckScope or ExactAssemblyScope"; 807 CodeGenerator::MaybeRecordImplicitNullCheck(instr); 808 } 809 810 void MaybeGenerateInlineCacheCheck(HInstruction* instruction, vixl32::Register klass); 811 void MaybeIncrementHotness(bool is_frame_entry); 812 813 private: 814 // Encoding of thunk type and data for link-time generated thunks for Baker read barriers. 815 816 enum class BakerReadBarrierKind : uint8_t { 817 kField, // Field get or array get with constant offset (i.e. constant index). 818 kArray, // Array get with index in register. 819 kGcRoot, // GC root load. 820 kIntrinsicCas, // Unsafe/VarHandle CAS intrinsic. 821 kLast = kIntrinsicCas 822 }; 823 824 enum class BakerReadBarrierWidth : uint8_t { 825 kWide, // 32-bit LDR (and 32-bit NEG if heap poisoning is enabled). 826 kNarrow, // 16-bit LDR (and 16-bit NEG if heap poisoning is enabled). 827 kLast = kNarrow 828 }; 829 830 static constexpr uint32_t kBakerReadBarrierInvalidEncodedReg = /* pc is invalid */ 15u; 831 832 static constexpr size_t kBitsForBakerReadBarrierKind = 833 MinimumBitsToStore(static_cast<size_t>(BakerReadBarrierKind::kLast)); 834 static constexpr size_t kBakerReadBarrierBitsForRegister = 835 MinimumBitsToStore(kBakerReadBarrierInvalidEncodedReg); 836 using BakerReadBarrierKindField = 837 BitField<BakerReadBarrierKind, 0, kBitsForBakerReadBarrierKind>; 838 using BakerReadBarrierFirstRegField = 839 BitField<uint32_t, kBitsForBakerReadBarrierKind, kBakerReadBarrierBitsForRegister>; 840 using BakerReadBarrierSecondRegField = 841 BitField<uint32_t, 842 kBitsForBakerReadBarrierKind + kBakerReadBarrierBitsForRegister, 843 kBakerReadBarrierBitsForRegister>; 844 static constexpr size_t kBitsForBakerReadBarrierWidth = 845 MinimumBitsToStore(static_cast<size_t>(BakerReadBarrierWidth::kLast)); 846 using BakerReadBarrierWidthField = 847 BitField<BakerReadBarrierWidth, 848 kBitsForBakerReadBarrierKind + 2 * kBakerReadBarrierBitsForRegister, 849 kBitsForBakerReadBarrierWidth>; 850 CheckValidReg(uint32_t reg)851 static void CheckValidReg(uint32_t reg) { 852 DCHECK(reg < vixl::aarch32::ip.GetCode() && reg != mr.GetCode()) << reg; 853 } 854 EncodeBakerReadBarrierFieldData(uint32_t base_reg,uint32_t holder_reg,bool narrow)855 static uint32_t EncodeBakerReadBarrierFieldData(uint32_t base_reg, 856 uint32_t holder_reg, 857 bool narrow) { 858 CheckValidReg(base_reg); 859 CheckValidReg(holder_reg); 860 DCHECK_IMPLIES(narrow, base_reg < 8u) << base_reg; 861 BakerReadBarrierWidth width = 862 narrow ? BakerReadBarrierWidth::kNarrow : BakerReadBarrierWidth::kWide; 863 return BakerReadBarrierKindField::Encode(BakerReadBarrierKind::kField) | 864 BakerReadBarrierFirstRegField::Encode(base_reg) | 865 BakerReadBarrierSecondRegField::Encode(holder_reg) | 866 BakerReadBarrierWidthField::Encode(width); 867 } 868 EncodeBakerReadBarrierArrayData(uint32_t base_reg)869 static uint32_t EncodeBakerReadBarrierArrayData(uint32_t base_reg) { 870 CheckValidReg(base_reg); 871 return BakerReadBarrierKindField::Encode(BakerReadBarrierKind::kArray) | 872 BakerReadBarrierFirstRegField::Encode(base_reg) | 873 BakerReadBarrierSecondRegField::Encode(kBakerReadBarrierInvalidEncodedReg) | 874 BakerReadBarrierWidthField::Encode(BakerReadBarrierWidth::kWide); 875 } 876 EncodeBakerReadBarrierGcRootData(uint32_t root_reg,bool narrow)877 static uint32_t EncodeBakerReadBarrierGcRootData(uint32_t root_reg, bool narrow) { 878 CheckValidReg(root_reg); 879 DCHECK_IMPLIES(narrow, root_reg < 8u) << root_reg; 880 BakerReadBarrierWidth width = 881 narrow ? BakerReadBarrierWidth::kNarrow : BakerReadBarrierWidth::kWide; 882 return BakerReadBarrierKindField::Encode(BakerReadBarrierKind::kGcRoot) | 883 BakerReadBarrierFirstRegField::Encode(root_reg) | 884 BakerReadBarrierSecondRegField::Encode(kBakerReadBarrierInvalidEncodedReg) | 885 BakerReadBarrierWidthField::Encode(width); 886 } 887 EncodeBakerReadBarrierIntrinsicCasData(uint32_t root_reg)888 static uint32_t EncodeBakerReadBarrierIntrinsicCasData(uint32_t root_reg) { 889 CheckValidReg(root_reg); 890 return BakerReadBarrierKindField::Encode(BakerReadBarrierKind::kIntrinsicCas) | 891 BakerReadBarrierFirstRegField::Encode(root_reg) | 892 BakerReadBarrierSecondRegField::Encode(kBakerReadBarrierInvalidEncodedReg) | 893 BakerReadBarrierWidthField::Encode(BakerReadBarrierWidth::kWide); 894 } 895 896 void CompileBakerReadBarrierThunk(ArmVIXLAssembler& assembler, 897 uint32_t encoded_data, 898 /*out*/ std::string* debug_name); 899 900 using Uint32ToLiteralMap = ArenaSafeMap<uint32_t, VIXLUInt32Literal*>; 901 using StringToLiteralMap = ArenaSafeMap<StringReference, 902 VIXLUInt32Literal*, 903 StringReferenceValueComparator>; 904 using TypeToLiteralMap = ArenaSafeMap<TypeReference, 905 VIXLUInt32Literal*, 906 TypeReferenceValueComparator>; 907 908 struct BakerReadBarrierPatchInfo { BakerReadBarrierPatchInfoBakerReadBarrierPatchInfo909 explicit BakerReadBarrierPatchInfo(uint32_t data) : label(), custom_data(data) { } 910 911 vixl::aarch32::Label label; 912 uint32_t custom_data; 913 }; 914 915 VIXLUInt32Literal* DeduplicateUint32Literal(uint32_t value, Uint32ToLiteralMap* map); 916 PcRelativePatchInfo* NewPcRelativePatch(const DexFile* dex_file, 917 uint32_t offset_or_index, 918 ArenaDeque<PcRelativePatchInfo>* patches); 919 template <linker::LinkerPatch (*Factory)(size_t, const DexFile*, uint32_t, uint32_t)> 920 static void EmitPcRelativeLinkerPatches(const ArenaDeque<PcRelativePatchInfo>& infos, 921 ArenaVector<linker::LinkerPatch>* linker_patches); 922 923 // Labels for each block that will be compiled. 924 // We use a deque so that the `vixl::aarch32::Label` objects do not move in memory. 925 ArenaDeque<vixl::aarch32::Label> block_labels_; // Indexed by block id. 926 vixl::aarch32::Label frame_entry_label_; 927 928 ArenaVector<std::unique_ptr<JumpTableARMVIXL>> jump_tables_; 929 LocationsBuilderARMVIXL location_builder_; 930 InstructionCodeGeneratorARMVIXL instruction_visitor_; 931 ParallelMoveResolverARMVIXL move_resolver_; 932 933 ArmVIXLAssembler assembler_; 934 935 // PC-relative method patch info for kBootImageLinkTimePcRelative. 936 ArenaDeque<PcRelativePatchInfo> boot_image_method_patches_; 937 // PC-relative method patch info for kBssEntry. 938 ArenaDeque<PcRelativePatchInfo> method_bss_entry_patches_; 939 // PC-relative type patch info for kBootImageLinkTimePcRelative. 940 ArenaDeque<PcRelativePatchInfo> boot_image_type_patches_; 941 // PC-relative type patch info for kBssEntry. 942 ArenaDeque<PcRelativePatchInfo> type_bss_entry_patches_; 943 // PC-relative public type patch info for kBssEntryPublic. 944 ArenaDeque<PcRelativePatchInfo> public_type_bss_entry_patches_; 945 // PC-relative package type patch info for kBssEntryPackage. 946 ArenaDeque<PcRelativePatchInfo> package_type_bss_entry_patches_; 947 // PC-relative String patch info for kBootImageLinkTimePcRelative. 948 ArenaDeque<PcRelativePatchInfo> boot_image_string_patches_; 949 // PC-relative String patch info for kBssEntry. 950 ArenaDeque<PcRelativePatchInfo> string_bss_entry_patches_; 951 // PC-relative patch info for IntrinsicObjects for the boot image, 952 // and for method/type/string patches for kBootImageRelRo otherwise. 953 ArenaDeque<PcRelativePatchInfo> boot_image_other_patches_; 954 // Patch info for calls to entrypoint dispatch thunks. Used for slow paths. 955 ArenaDeque<PatchInfo<vixl::aarch32::Label>> call_entrypoint_patches_; 956 // Baker read barrier patch info. 957 ArenaDeque<BakerReadBarrierPatchInfo> baker_read_barrier_patches_; 958 959 // Deduplication map for 32-bit literals, used for JIT for boot image addresses. 960 Uint32ToLiteralMap uint32_literals_; 961 // Patches for string literals in JIT compiled code. 962 StringToLiteralMap jit_string_patches_; 963 // Patches for class literals in JIT compiled code. 964 TypeToLiteralMap jit_class_patches_; 965 966 // Baker read barrier slow paths, mapping custom data (uint32_t) to label. 967 // Wrap the label to work around vixl::aarch32::Label being non-copyable 968 // and non-moveable and as such unusable in ArenaSafeMap<>. 969 struct LabelWrapper { LabelWrapperLabelWrapper970 LabelWrapper(const LabelWrapper& src) 971 : label() { 972 DCHECK(!src.label.IsReferenced() && !src.label.IsBound()); 973 } 974 LabelWrapper() = default; 975 vixl::aarch32::Label label; 976 }; 977 ArenaSafeMap<uint32_t, LabelWrapper> jit_baker_read_barrier_slow_paths_; 978 979 friend class linker::Thumb2RelativePatcherTest; 980 DISALLOW_COPY_AND_ASSIGN(CodeGeneratorARMVIXL); 981 }; 982 983 } // namespace arm 984 } // namespace art 985 986 #endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_ARM_VIXL_H_ 987