Refactor method resolution in class linker.
Rewrite all runtime callers of DexCache::SetResolvedMethod
to call a shared method that will do the dex cache update.
bug: 64759619
Test: test-art-host
Test: device boots, runs
Change-Id: Icc1aca121030e2864de09667bdbc793b502e3802
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 16fa1ce..6bb924f 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -312,6 +312,13 @@
ObjPtr<mirror::ClassLoader> class_loader)
REQUIRES_SHARED(Locks::mutator_lock_);
+ // Find a method with the given index from class `klass`, and update the dex cache.
+ ArtMethod* FindResolvedMethod(ObjPtr<mirror::Class> klass,
+ ObjPtr<mirror::DexCache> dex_cache,
+ ObjPtr<mirror::ClassLoader> class_loader,
+ uint32_t method_idx)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
// Resolve a method with a given ID from the DexFile associated with the given DexCache
// and ClassLoader, storing the result in DexCache. The ClassLinker and ClassLoader are
// used as in ResolveType. What is unique is the method type argument which is used to