diff options
author | Vladimir Marko <vmarko@google.com> | 2020-10-27 13:41:40 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2020-10-29 15:42:52 +0000 |
commit | de91ca90389e4b41ed27b320a6c43ff56a6d75ff (patch) | |
tree | 2e18ff33d30fce88d578ea68b8b1037755aececc /compiler/optimizing/code_generator.cc | |
parent | 9ca92fb4646eccff9f972f6a2a21709676b65460 (diff) |
Refactor Integer.valueOf() intrinsic implementation.
Prepare for Reference.getReferent() intrinsic implementation
by a refactoring to separate the retrieval of an intrinsic
method's declaring class to its own helper function, rather
than being a part of a larger one.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit
Test: aosp_blueline-userdebug boots.
Test: run-gtests.sh
Test: testrunner.py --target --optimizing --jit
Bug: 170286013
Change-Id: Ib6c0e55d0c6fcc932999428f21c51afe32ab7ef2
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 |