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.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime/class_linker.h') diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 29aac312c1..0d3bc1e2c3 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -246,11 +246,19 @@ class ClassLinker { SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); + // Determine whether a dex cache result should be trusted, or an IncompatibleClassChangeError + // check should be performed even after a hit. + enum ResolveMode { // private. + kNoICCECheckForCache, + kForceICCECheck + }; + // Resolve a method with a given ID from the DexFile, 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 determine if this method is a direct, static, or // virtual method. + template ArtMethod* ResolveMethod(const DexFile& dex_file, uint32_t method_idx, Handle dex_cache, @@ -262,6 +270,7 @@ class ClassLinker { ArtMethod* GetResolvedMethod(uint32_t method_idx, ArtMethod* referrer) SHARED_REQUIRES(Locks::mutator_lock_); + template ArtMethod* ResolveMethod(Thread* self, uint32_t method_idx, ArtMethod* referrer, InvokeType type) SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!dex_lock_, !Roles::uninterruptible_); -- cgit v1.2.3-59-g8ed1b