diff options
| author | Vladimir Marko <vmarko@google.com> | 2018-02-20 11:52:34 +0000 |
|---|---|---|
| committer | Vladimir Marko <vmarko@google.com> | 2018-02-20 14:27:43 +0000 |
| commit | 59eb30f96d87e3e72a060099a292ae14dd5fe1c8 (patch) | |
| tree | 49f9334a44a28eef8d0c35c6061c61743d4db4a8 /compiler/optimizing/code_generator_arm_vixl.h | |
| parent | 5919f737facdebbe8b738272e681ae33e085de98 (diff) | |
| download | art-59eb30f96d87e3e72a060099a292ae14dd5fe1c8.tar.gz art-59eb30f96d87e3e72a060099a292ae14dd5fe1c8.tar.bz2 art-59eb30f96d87e3e72a060099a292ae14dd5fe1c8.zip | |
ART: Clean up patching data in codegens.
Reuse PatchInfo<> for additional architectures and make the
naming more consistent across architectures. Change the
DexFile reference to pointer in preparation for patching
references to the upcoming .data.bimg.rel.ro section.
Update obsolete comments; instead of referencing dex cache
arrays which were used in the past, reference the .bss and
the .data.bimg.rel.ro which shall be used in upcoming CLs.
Test: Rely on TreeHugger.
Change-Id: I03be4c4118918189e55c62105bb594500c6a42c1
Diffstat (limited to 'compiler/optimizing/code_generator_arm_vixl.h')
| -rw-r--r-- | compiler/optimizing/code_generator_arm_vixl.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/compiler/optimizing/code_generator_arm_vixl.h b/compiler/optimizing/code_generator_arm_vixl.h index 38570bb0fe..bbc715c59d 100644 --- a/compiler/optimizing/code_generator_arm_vixl.h +++ b/compiler/optimizing/code_generator_arm_vixl.h @@ -552,32 +552,34 @@ class CodeGeneratorARMVIXL : public CodeGenerator { void MoveFromReturnRegister(Location trg, DataType::Type type) OVERRIDE; - // The PcRelativePatchInfo is used for PC-relative addressing of dex cache arrays - // and boot image strings/types. The only difference is the interpretation of the - // offset_or_index. The PC-relative address is loaded with three instructions, + // The PcRelativePatchInfo is used for PC-relative addressing of methods/strings/types, + // whether through .data.bimg.rel.ro, .bss, or directly in the boot image. + // + // The PC-relative address is loaded with three instructions, // MOVW+MOVT to load the offset to base_reg and then ADD base_reg, PC. The offset // is calculated from the ADD's effective PC, i.e. PC+4 on Thumb2. Though we // currently emit these 3 instructions together, instruction scheduling could // split this sequence apart, so we keep separate labels for each of them. struct PcRelativePatchInfo { - PcRelativePatchInfo(const DexFile& dex_file, uint32_t off_or_idx) + PcRelativePatchInfo(const DexFile* dex_file, uint32_t off_or_idx) : target_dex_file(dex_file), offset_or_index(off_or_idx) { } PcRelativePatchInfo(PcRelativePatchInfo&& other) = default; - const DexFile& target_dex_file; - // Either the dex cache array element offset or the string/type index. + // Target dex file or null for .data.bmig.rel.ro patches. + const DexFile* target_dex_file; + // Either the boot image offset (to write to .data.bmig.rel.ro) or string/type/method index. uint32_t offset_or_index; vixl::aarch32::Label movw_label; vixl::aarch32::Label movt_label; vixl::aarch32::Label add_pc_label; }; - PcRelativePatchInfo* NewPcRelativeMethodPatch(MethodReference target_method); + PcRelativePatchInfo* NewBootImageMethodPatch(MethodReference target_method); PcRelativePatchInfo* NewMethodBssEntryPatch(MethodReference target_method); - PcRelativePatchInfo* NewPcRelativeTypePatch(const DexFile& dex_file, dex::TypeIndex type_index); + PcRelativePatchInfo* NewBootImageTypePatch(const DexFile& dex_file, dex::TypeIndex type_index); PcRelativePatchInfo* NewTypeBssEntryPatch(const DexFile& dex_file, dex::TypeIndex type_index); - PcRelativePatchInfo* NewPcRelativeStringPatch(const DexFile& dex_file, - dex::StringIndex string_index); + PcRelativePatchInfo* NewBootImageStringPatch(const DexFile& dex_file, + dex::StringIndex string_index); PcRelativePatchInfo* NewStringBssEntryPatch(const DexFile& dex_file, dex::StringIndex string_index); @@ -774,7 +776,7 @@ class CodeGeneratorARMVIXL : public CodeGenerator { }; VIXLUInt32Literal* DeduplicateUint32Literal(uint32_t value, Uint32ToLiteralMap* map); - PcRelativePatchInfo* NewPcRelativePatch(const DexFile& dex_file, + PcRelativePatchInfo* NewPcRelativePatch(const DexFile* dex_file, uint32_t offset_or_index, ArenaDeque<PcRelativePatchInfo>* patches); template <linker::LinkerPatch (*Factory)(size_t, const DexFile*, uint32_t, uint32_t)> @@ -797,15 +799,15 @@ class CodeGeneratorARMVIXL : public CodeGenerator { // Deduplication map for 32-bit literals, used for non-patchable boot image addresses. Uint32ToLiteralMap uint32_literals_; // PC-relative method patch info for kBootImageLinkTimePcRelative. - ArenaDeque<PcRelativePatchInfo> pc_relative_method_patches_; + ArenaDeque<PcRelativePatchInfo> boot_image_method_patches_; // PC-relative method patch info for kBssEntry. ArenaDeque<PcRelativePatchInfo> method_bss_entry_patches_; // PC-relative type patch info for kBootImageLinkTimePcRelative. - ArenaDeque<PcRelativePatchInfo> pc_relative_type_patches_; + ArenaDeque<PcRelativePatchInfo> boot_image_type_patches_; // PC-relative type patch info for kBssEntry. ArenaDeque<PcRelativePatchInfo> type_bss_entry_patches_; // PC-relative String patch info; type depends on configuration (intern table or boot image PIC). - ArenaDeque<PcRelativePatchInfo> pc_relative_string_patches_; + ArenaDeque<PcRelativePatchInfo> boot_image_string_patches_; // PC-relative String patch info for kBssEntry. ArenaDeque<PcRelativePatchInfo> string_bss_entry_patches_; // Baker read barrier patch info. |
