diff options
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index c2ae0e0632..23ac91b024 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -891,7 +891,6 @@ void CodeGenerator::GenerateLoadMethodTypeRuntimeCall(HLoadMethodType* method_ty static uint32_t GetBootImageOffsetImpl(const void* object, ImageHeader::ImageSections section) { Runtime* runtime = Runtime::Current(); - DCHECK(runtime->IsAotCompiler()); const std::vector<gc::space::ImageSpace*>& boot_image_spaces = runtime->GetHeap()->GetBootImageSpaces(); // Check that the `object` is in the expected section of one of the boot image files. @@ -907,6 +906,10 @@ static uint32_t GetBootImageOffsetImpl(const void* object, ImageHeader::ImageSec return dchecked_integral_cast<uint32_t>(offset); } +uint32_t CodeGenerator::GetBootImageOffset(ObjPtr<mirror::Object> object) { + return GetBootImageOffsetImpl(object.Ptr(), ImageHeader::kSectionObjects); +} + // NO_THREAD_SAFETY_ANALYSIS: Avoid taking the mutator lock, boot image classes are non-moveable. uint32_t CodeGenerator::GetBootImageOffset(HLoadClass* load_class) NO_THREAD_SAFETY_ANALYSIS { DCHECK_EQ(load_class->GetLoadKind(), HLoadClass::LoadKind::kBootImageRelRo); @@ -929,6 +932,16 @@ uint32_t CodeGenerator::GetBootImageOffset(HInvoke* invoke) { return GetBootImageOffsetImpl(method, ImageHeader::kSectionArtMethods); } +// NO_THREAD_SAFETY_ANALYSIS: Avoid taking the mutator lock, boot image classes are non-moveable. +uint32_t CodeGenerator::GetBootImageOffsetOfIntrinsicDeclaringClass(HInvoke* invoke) + NO_THREAD_SAFETY_ANALYSIS { + DCHECK_NE(invoke->GetIntrinsic(), Intrinsics::kNone); + ArtMethod* method = invoke->GetResolvedMethod(); + DCHECK(method != nullptr); + ObjPtr<mirror::Class> declaring_class = method->GetDeclaringClass<kWithoutReadBarrier>(); + return GetBootImageOffsetImpl(declaring_class.Ptr(), ImageHeader::kSectionObjects); +} + void CodeGenerator::BlockIfInRegister(Location location, bool is_out) const { // The DCHECKS below check that a register is not specified twice in // the summary. The out location can overlap with an input, so we need |