summaryrefslogtreecommitdiff
path: root/runtime/class_linker-inl.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2015-12-03 17:27:32 -0800
committer Andreas Gampe <agampe@google.com> 2015-12-10 13:52:33 -0800
commit42ef8ab151a3d0cbb42cb43f6841c3708d65fca3 (patch)
treeba8eb3fdecd226a8c516a86ac418f73f6c0ff254 /runtime/class_linker-inl.h
parent170e01a6b59b3242a5afc76c3a03c00ce288150f (diff)
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
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r--runtime/class_linker-inl.h13
1 files changed, 7 insertions, 6 deletions
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 <ClassLinker::ResolveMode kResolveMode>
inline ArtMethod* ClassLinker::ResolveMethod(Thread* self,
uint32_t method_idx,
ArtMethod* referrer,
@@ -127,12 +128,12 @@ inline ArtMethod* ClassLinker::ResolveMethod(Thread* self,
Handle<mirror::DexCache> h_dex_cache(hs.NewHandle(declaring_class->GetDexCache()));
Handle<mirror::ClassLoader> 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<kResolveMode>(*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.