From 42ef8ab151a3d0cbb42cb43f6841c3708d65fca3 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 3 Dec 2015 17:27:32 -0800 Subject: ART: Stash a resolved method late in the verifier Invoke-interface should only be called on an interface method. We cannot move the check earlier, as there are other checks that must be done that can fail a class hard. So postpone a push to the dex cache. Clean up the test a bit. Also templatize ResolveMethod with a version always checking the invoke type, and on a cache miss check whether type target type is an interface when an interface invoke type was given. Bug: 21869691 Change-Id: I94cbb23339cbbb3cb6be9995775e4dcefacce7fd --- runtime/class_linker-inl.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'runtime/class_linker-inl.h') diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index 88a3996577..a5d10b265f 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -116,6 +116,7 @@ inline ArtMethod* ClassLinker::GetResolvedMethod(uint32_t method_idx, ArtMethod* return resolved_method; } +template inline ArtMethod* ClassLinker::ResolveMethod(Thread* self, uint32_t method_idx, ArtMethod* referrer, @@ -127,12 +128,12 @@ inline ArtMethod* ClassLinker::ResolveMethod(Thread* self, Handle h_dex_cache(hs.NewHandle(declaring_class->GetDexCache())); Handle h_class_loader(hs.NewHandle(declaring_class->GetClassLoader())); const DexFile* dex_file = h_dex_cache->GetDexFile(); - resolved_method = ResolveMethod(*dex_file, - method_idx, - h_dex_cache, - h_class_loader, - referrer, - type); + resolved_method = ResolveMethod(*dex_file, + method_idx, + h_dex_cache, + h_class_loader, + referrer, + type); } // Note: We cannot check here to see whether we added the method to the cache. It // might be an erroneous class, which results in it being hidden from us. -- cgit v1.2.3-59-g8ed1b