diff options
author | Vladimir Marko <vmarko@google.com> | 2018-06-22 02:16:08 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-22 02:16:08 -0700 |
commit | 5f7748b6ec5b51afe8314f2c169f99a1f93a2053 (patch) | |
tree | 25879b7002fd0601f9ed0ac9b6ef0b7d84134f55 /compiler/optimizing/code_generator_arm64.cc | |
parent | 0ad09c4b396d37f57eecca8b1f841fb99a1a0baf (diff) | |
parent | 077cc1c59c32f08c752c603bf991160c22eae9bb (diff) |
Merge "Implement Integer.valueOf() intrinsic for PIC." am: ccfc88af4a am: 8e73527acf
am: 077cc1c59c
Change-Id: If3a8ed8679e4fa8ef851b0c92e303473ef74a910
Diffstat (limited to 'compiler/optimizing/code_generator_arm64.cc')
-rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 7775eb942e3..ad4b5cf339d 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -27,6 +27,7 @@ #include "entrypoints/quick/quick_entrypoints.h" #include "entrypoints/quick/quick_entrypoints_enum.h" #include "gc/accounting/card_table.h" +#include "gc/space/image_space.h" #include "heap_poisoning.h" #include "intrinsics.h" #include "intrinsics_arm64.h" @@ -4787,6 +4788,25 @@ void CodeGeneratorARM64::EmitLdrOffsetPlaceholder(vixl::aarch64::Label* fixup_la __ ldr(out, MemOperand(base, /* offset placeholder */ 0)); } +void CodeGeneratorARM64::LoadBootImageAddress(vixl::aarch64::Register reg, + uint32_t boot_image_offset) { + DCHECK(!GetCompilerOptions().IsBootImage()); + if (GetCompilerOptions().GetCompilePic()) { + DCHECK(Runtime::Current()->IsAotCompiler()); + // Add ADRP with its PC-relative .data.bimg.rel.ro patch. + vixl::aarch64::Label* adrp_label = NewBootImageRelRoPatch(boot_image_offset); + EmitAdrpPlaceholder(adrp_label, reg.X()); + // Add LDR with its PC-relative .data.bimg.rel.ro patch. + vixl::aarch64::Label* ldr_label = NewBootImageRelRoPatch(boot_image_offset, adrp_label); + EmitLdrOffsetPlaceholder(ldr_label, reg.W(), reg.X()); + } else { + gc::Heap* heap = Runtime::Current()->GetHeap(); + DCHECK(!heap->GetBootImageSpaces().empty()); + const uint8_t* address = heap->GetBootImageSpaces()[0]->Begin() + boot_image_offset; + __ Ldr(reg.W(), DeduplicateBootImageAddressLiteral(reinterpret_cast<uintptr_t>(address))); + } +} + template <linker::LinkerPatch (*Factory)(size_t, const DexFile*, uint32_t, uint32_t)> inline void CodeGeneratorARM64::EmitPcRelativeLinkerPatches( const ArenaDeque<PcRelativePatchInfo>& infos, |