summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-11-04 17:19:31 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2024-11-05 14:04:28 +0000
commit96dc77238e2b5a962911a6da06d5e1b869dc92f8 (patch)
tree4a96efaca4f14d4ae488903bb622b25399887ab2
parent4d6fdd9fb379ac6e3575c3ec5406d808e0290636 (diff)
Rename ResolveMethodWithoutInvokeType and use it more.
Rename it to ResolveMethodId as a more precise name, and use it in places where that's the thing we need. Test: test.py Change-Id: I906371585e9fa208093eed9affba552fd135a184
-rw-r--r--compiler/common_compiler_test.cc1
-rw-r--r--compiler/compiler.h1
-rw-r--r--compiler/optimizing/optimizing_compiler.cc6
-rw-r--r--compiler/optimizing/reference_type_propagation.cc3
-rw-r--r--dex2oat/driver/compiler_driver.cc7
-rw-r--r--dex2oat/verifier_deps_test.cc6
-rw-r--r--oatdump/oatdump.cc2
-rw-r--r--runtime/class_linker.cc12
-rw-r--r--runtime/class_linker.h6
-rw-r--r--runtime/dex/dex_file_annotations.cc4
-rw-r--r--runtime/jit/jit.cc3
11 files changed, 17 insertions, 34 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index d627af8158..f24406e599 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -291,7 +291,6 @@ void CommonCompilerTestImpl::CompileMethod(ArtMethod* method) {
} else {
compiled_method = compiler->Compile(method->GetCodeItem(),
method->GetAccessFlags(),
- method->GetInvokeType(),
method->GetClassDefIndex(),
method->GetDexMethodIndex(),
class_loader,
diff --git a/compiler/compiler.h b/compiler/compiler.h
index 843bbbb083..196b729b91 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -55,7 +55,6 @@ class Compiler {
virtual CompiledMethod* Compile(const dex::CodeItem* code_item,
uint32_t access_flags,
- InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
Handle<mirror::ClassLoader> class_loader,
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index b15657355f..cb9933c9c0 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -256,7 +256,6 @@ class OptimizingCompiler final : public Compiler {
CompiledMethod* Compile(const dex::CodeItem* code_item,
uint32_t access_flags,
- InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
Handle<mirror::ClassLoader> class_loader,
@@ -1068,7 +1067,6 @@ CodeGenerator* OptimizingCompiler::TryCompileIntrinsic(
CompiledMethod* OptimizingCompiler::Compile(const dex::CodeItem* code_item,
uint32_t access_flags,
- InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
Handle<mirror::ClassLoader> jclass_loader,
@@ -1086,9 +1084,7 @@ CompiledMethod* OptimizingCompiler::Compile(const dex::CodeItem* code_item,
{
ScopedObjectAccess soa(Thread::Current());
ArtMethod* method =
- runtime->GetClassLinker()->ResolveMethod<ClassLinker::ResolveMode::kCheckICCEAndIAE>(
- method_idx, dex_cache, jclass_loader, /*referrer=*/ nullptr, invoke_type);
- DCHECK_EQ(method == nullptr, soa.Self()->IsExceptionPending());
+ runtime->GetClassLinker()->ResolveMethodId(method_idx, dex_cache, jclass_loader);
soa.Self()->ClearException(); // Suppress exception if any.
VariableSizedHandleScope handles(soa.Self());
Handle<mirror::Class> compiling_class =
diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc
index b647a14407..1eef0ce6d5 100644
--- a/compiler/optimizing/reference_type_propagation.cc
+++ b/compiler/optimizing/reference_type_propagation.cc
@@ -502,8 +502,7 @@ void ReferenceTypePropagation::RTPVisitor::SetClassAsTypeInfo(HInstruction* inst
hs.NewHandle(FindDexCacheWithHint(self, dex_file, hint_dex_cache_)));
// Use a null loader, the target method is in a boot classpath dex file.
Handle<mirror::ClassLoader> loader(hs.NewHandle<mirror::ClassLoader>(nullptr));
- ArtMethod* method = cl->ResolveMethod<ClassLinker::ResolveMode::kNoChecks>(
- dex_method_index, dex_cache, loader, /* referrer= */ nullptr, kDirect);
+ ArtMethod* method = cl->ResolveMethodId(dex_method_index, dex_cache, loader);
DCHECK(method != nullptr);
ObjPtr<mirror::Class> declaring_class = method->GetDeclaringClass();
DCHECK(declaring_class != nullptr);
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index 5399f1cd7e..0491b2b797 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -370,7 +370,6 @@ static void CompileMethodHarness(
CompilerDriver* driver,
const dex::CodeItem* code_item,
uint32_t access_flags,
- InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
Handle<mirror::ClassLoader> class_loader,
@@ -386,7 +385,6 @@ static void CompileMethodHarness(
driver,
code_item,
access_flags,
- invoke_type,
class_def_idx,
method_idx,
class_loader,
@@ -456,7 +454,6 @@ static void CompileMethodQuick(
CompilerDriver* driver,
const dex::CodeItem* code_item,
uint32_t access_flags,
- InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
Handle<mirror::ClassLoader> class_loader,
@@ -467,7 +464,6 @@ static void CompileMethodQuick(
CompilerDriver* driver,
const dex::CodeItem* code_item,
uint32_t access_flags,
- InvokeType invoke_type,
uint16_t class_def_idx,
uint32_t method_idx,
Handle<mirror::ClassLoader> class_loader,
@@ -523,7 +519,6 @@ static void CompileMethodQuick(
// NOTE: if compiler declines to compile this method, it will return null.
compiled_method = driver->GetCompiler()->Compile(code_item,
access_flags,
- invoke_type,
class_def_idx,
method_idx,
class_loader,
@@ -559,7 +554,6 @@ static void CompileMethodQuick(
driver,
code_item,
access_flags,
- invoke_type,
class_def_idx,
method_idx,
class_loader,
@@ -2737,7 +2731,6 @@ static void CompileDexFile(CompilerDriver* driver,
driver,
method.GetCodeItem(),
method.GetAccessFlags(),
- method.GetInvokeType(class_def.access_flags_),
class_def_index,
method_idx,
class_loader,
diff --git a/dex2oat/verifier_deps_test.cc b/dex2oat/verifier_deps_test.cc
index 686f18803c..a79bad2944 100644
--- a/dex2oat/verifier_deps_test.cc
+++ b/dex2oat/verifier_deps_test.cc
@@ -154,12 +154,10 @@ class VerifierDepsTest : public CommonCompilerDriverTest {
for (const ClassAccessor::Method& method : accessor.GetMethods()) {
ArtMethod* resolved_method =
- class_linker_->ResolveMethod<ClassLinker::ResolveMode::kNoChecks>(
+ class_linker_->ResolveMethodId(
method.GetIndex(),
dex_cache_handle,
- class_loader_handle,
- /* referrer= */ nullptr,
- method.GetInvokeType(class_def->access_flags_));
+ class_loader_handle);
CHECK(resolved_method != nullptr);
if (method_name == resolved_method->GetName()) {
ArenaPool* arena_pool = Runtime::Current()->GetArenaPool();
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 06d9e98218..2c97f92636 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1508,7 +1508,7 @@ class OatDumper {
Handle<mirror::DexCache> dex_cache = hs->NewHandle(
runtime->GetClassLinker()->RegisterDexFile(*dex_file, options_.class_loader_->Get()));
CHECK(dex_cache != nullptr);
- ArtMethod* method = runtime->GetClassLinker()->ResolveMethodWithoutInvokeType(
+ ArtMethod* method = runtime->GetClassLinker()->ResolveMethodId(
dex_method_idx, dex_cache, *options_.class_loader_);
if (method == nullptr) {
soa.Self()->ClearException();
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 02528293b3..991673f966 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -10053,9 +10053,9 @@ ArtMethod* ClassLinker::FindIncompatibleMethod(ObjPtr<mirror::Class> klass,
}
}
-ArtMethod* ClassLinker::ResolveMethodWithoutInvokeType(uint32_t method_idx,
- Handle<mirror::DexCache> dex_cache,
- Handle<mirror::ClassLoader> class_loader) {
+ArtMethod* ClassLinker::ResolveMethodId(uint32_t method_idx,
+ Handle<mirror::DexCache> dex_cache,
+ Handle<mirror::ClassLoader> class_loader) {
DCHECK(dex_cache->GetClassLoader() == class_loader.Get());
ArtMethod* resolved = dex_cache->GetResolvedMethod(method_idx);
Thread::PoisonObjectPointersIfDebug();
@@ -10436,9 +10436,9 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForMethod(
// the invocation type to determine if the method is private. We
// then resolve again specifying the intended invocation type to
// force the appropriate checks.
- target_method = ResolveMethodWithoutInvokeType(method_handle.field_or_method_idx_,
- hs.NewHandle(referrer->GetDexCache()),
- hs.NewHandle(referrer->GetClassLoader()));
+ target_method = ResolveMethodId(method_handle.field_or_method_idx_,
+ hs.NewHandle(referrer->GetDexCache()),
+ hs.NewHandle(referrer->GetClassLoader()));
if (UNLIKELY(target_method == nullptr)) {
break;
}
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index ebaf383809..35cdfbcdd3 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -371,9 +371,9 @@ class ClassLinker {
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::dex_lock_, !Roles::uninterruptible_);
- EXPORT ArtMethod* ResolveMethodWithoutInvokeType(uint32_t method_idx,
- Handle<mirror::DexCache> dex_cache,
- Handle<mirror::ClassLoader> class_loader)
+ EXPORT ArtMethod* ResolveMethodId(uint32_t method_idx,
+ Handle<mirror::DexCache> dex_cache,
+ Handle<mirror::ClassLoader> class_loader)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::dex_lock_, !Roles::uninterruptible_);
diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc
index f44077655b..efcc4a0a38 100644
--- a/runtime/dex/dex_file_annotations.cc
+++ b/runtime/dex/dex_file_annotations.cc
@@ -521,7 +521,7 @@ bool ProcessAnnotationValue(const ClassData& klass,
} else {
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
StackHandleScope<2> hs(self);
- ArtMethod* method = class_linker->ResolveMethodWithoutInvokeType(
+ ArtMethod* method = class_linker->ResolveMethodId(
index,
hs.NewHandle(klass.GetDexCache()),
hs.NewHandle(klass.GetClassLoader()));
@@ -1616,7 +1616,7 @@ ObjPtr<mirror::Class> GetEnclosingClass(Handle<mirror::Class> klass) {
return nullptr;
}
StackHandleScope<2> hs(Thread::Current());
- ArtMethod* method = Runtime::Current()->GetClassLinker()->ResolveMethodWithoutInvokeType(
+ ArtMethod* method = Runtime::Current()->GetClassLinker()->ResolveMethodId(
annotation_value.value_.GetI(),
hs.NewHandle(data.GetDexCache()),
hs.NewHandle(data.GetClassLoader()));
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index eb572c5c0c..29f01e137b 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1222,8 +1222,7 @@ bool Jit::CompileMethodFromProfile(Thread* self,
Handle<mirror::ClassLoader> class_loader,
bool add_to_queue,
bool compile_after_boot) {
- ArtMethod* method = class_linker->ResolveMethodWithoutInvokeType(
- method_idx, dex_cache, class_loader);
+ ArtMethod* method = class_linker->ResolveMethodId(method_idx, dex_cache, class_loader);
if (method == nullptr) {
self->ClearException();
return false;