summaryrefslogtreecommitdiff
path: root/compiler/optimizing/sharpening.cc
diff options
context:
space:
mode:
author Almaz Mingaleev <mingaleev@google.com> 2024-05-30 15:42:20 +0000
committer Almaz Mingaleev <mingaleev@google.com> 2024-06-21 15:16:44 +0000
commitd92a43f4310e2d634d6e8f24103fc1e27557d784 (patch)
tree7994a8b199c76327544ee4623aeab93bcca6a916 /compiler/optimizing/sharpening.cc
parentfc87179fb4998acdc32b3d326c101638e45b7211 (diff)
Revert^2 "x86_64: Add JIT support for LoadMethodType."
This reverts commit 69c9ea4f93a688ff50e08060be37bcfd3f3e9910. Instead of storing reversed method_code_map_, now just keep MethodType-s associated with a compiled code. Increasing constant in 979/Main.java to trigger jit more reliably. Bug: 297147201 Test: CtsPerfettoTestCases Test: ./art/test/testrunner/testrunner.py --host --64 --jit -b Test: ./art/test/testrunner/testrunner.py --host --64 -b Test: ./art/test.py --host -b Change-Id: I5ece80b63cd0d6dac2805c94649726dc62fe85db
Diffstat (limited to 'compiler/optimizing/sharpening.cc')
-rw-r--r--compiler/optimizing/sharpening.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc
index cb94491b8e..1b6a9fb601 100644
--- a/compiler/optimizing/sharpening.cc
+++ b/compiler/optimizing/sharpening.cc
@@ -471,4 +471,45 @@ void HSharpening::ProcessLoadString(
load_string->SetLoadKind(load_kind);
}
+void HSharpening::ProcessLoadMethodType(
+ HLoadMethodType* load_method_type,
+ CodeGenerator* codegen,
+ const DexCompilationUnit& dex_compilation_unit,
+ VariableSizedHandleScope* handles) {
+ const CompilerOptions& compiler_options = codegen->GetCompilerOptions();
+
+ HLoadMethodType::LoadKind desired_load_kind = static_cast<HLoadMethodType::LoadKind>(-1);
+
+ if (compiler_options.IsJitCompiler()) {
+ DCHECK(!compiler_options.GetCompilePic());
+ Runtime* runtime = Runtime::Current();
+ ClassLinker* class_linker = runtime->GetClassLinker();
+ ScopedObjectAccess soa(Thread::Current());
+ ObjPtr<mirror::MethodType> method_type =
+ class_linker->ResolveMethodType(Thread::Current(),
+ load_method_type->GetProtoIndex(),
+ dex_compilation_unit.GetDexCache(),
+ dex_compilation_unit.GetClassLoader());
+
+ if (method_type != nullptr) {
+ load_method_type->SetMethodType(handles->NewHandle(method_type));
+ desired_load_kind = HLoadMethodType::LoadKind::kJitTableAddress;
+ } else {
+ DCHECK_EQ(load_method_type->GetLoadKind(), HLoadMethodType::LoadKind::kRuntimeCall);
+ desired_load_kind = HLoadMethodType::LoadKind::kRuntimeCall;
+ Thread::Current()->ClearException();
+ }
+ } else {
+ if (compiler_options.GetCompilePic()) {
+ desired_load_kind = HLoadMethodType::LoadKind::kBssEntry;
+ } else {
+ // Test configuration, do not sharpen.
+ desired_load_kind = HLoadMethodType::LoadKind::kRuntimeCall;
+ }
+ }
+
+ DCHECK_NE(desired_load_kind, static_cast<HLoadMethodType::LoadKind>(-1));
+ load_method_type->SetLoadKind(desired_load_kind);
+}
+
} // namespace art