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
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index dac04a5..b8496db 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -1254,25 +1254,20 @@
}
}
-void CodeGeneratorX86_64::AllocateInstanceForIntrinsic(HInvokeStaticOrDirect* invoke,
- uint32_t boot_image_offset) {
- DCHECK(invoke->IsStatic());
- InvokeRuntimeCallingConvention calling_convention;
- CpuRegister argument = CpuRegister(calling_convention.GetRegisterAt(0));
+void CodeGeneratorX86_64::LoadIntrinsicDeclaringClass(CpuRegister reg, HInvoke* invoke) {
+ DCHECK_NE(invoke->GetIntrinsic(), Intrinsics::kNone);
if (GetCompilerOptions().IsBootImage()) {
- DCHECK_EQ(boot_image_offset, IntrinsicVisitor::IntegerValueOfInfo::kInvalidReference);
// Load the class the same way as for HLoadClass::LoadKind::kBootImageLinkTimePcRelative.
- __ leal(argument,
+ __ leal(reg,
Address::Absolute(CodeGeneratorX86_64::kPlaceholder32BitOffset, /* no_rip= */ false));
MethodReference target_method = invoke->GetResolvedMethodReference();
dex::TypeIndex type_idx = target_method.dex_file->GetMethodId(target_method.index).class_idx_;
boot_image_type_patches_.emplace_back(target_method.dex_file, type_idx.index_);
__ Bind(&boot_image_type_patches_.back().label);
} else {
- LoadBootImageAddress(argument, boot_image_offset);
+ uint32_t boot_image_offset = GetBootImageOffsetOfIntrinsicDeclaringClass(invoke);
+ LoadBootImageAddress(reg, boot_image_offset);
}
- InvokeRuntime(kQuickAllocObjectInitialized, invoke, invoke->GetDexPc());
- CheckEntrypointTypes<kQuickAllocObjectWithChecks, void*, mirror::Class*>();
}
// The label points to the end of the "movl" or another instruction but the literal offset
@@ -6274,7 +6269,7 @@
DCHECK(!codegen_->GetCompilerOptions().IsBootImage());
__ movl(out,
Address::Absolute(CodeGeneratorX86_64::kPlaceholder32BitOffset, /* no_rip= */ false));
- codegen_->RecordBootImageRelRoPatch(codegen_->GetBootImageOffset(cls));
+ codegen_->RecordBootImageRelRoPatch(CodeGenerator::GetBootImageOffset(cls));
break;
}
case HLoadClass::LoadKind::kBssEntry:
@@ -6433,7 +6428,7 @@
DCHECK(!codegen_->GetCompilerOptions().IsBootImage());
__ movl(out,
Address::Absolute(CodeGeneratorX86_64::kPlaceholder32BitOffset, /* no_rip= */ false));
- codegen_->RecordBootImageRelRoPatch(codegen_->GetBootImageOffset(load));
+ codegen_->RecordBootImageRelRoPatch(CodeGenerator::GetBootImageOffset(load));
return;
}
case HLoadString::LoadKind::kBssEntry: {