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/entrypoints/entrypoint_utils-inl.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/entrypoints/entrypoint_utils-inl.h') diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index dccb1dad3b..ba2fb9493f 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -68,7 +68,7 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method, class_loader.Assign(caller->GetClassLoader()); } - return class_linker->ResolveMethod( + return class_linker->ResolveMethod( *outer_method->GetDexFile(), method_index, dex_cache, class_loader, nullptr, invoke_type); } @@ -401,7 +401,10 @@ inline ArtMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object** this_ mirror::Object* null_this = nullptr; HandleWrapper h_this( hs.NewHandleWrapper(type == kStatic ? &null_this : this_object)); - resolved_method = class_linker->ResolveMethod(self, method_idx, referrer, type); + constexpr ClassLinker::ResolveMode resolve_mode = + access_check ? ClassLinker::kForceICCECheck + : ClassLinker::kNoICCECheckForCache; + resolved_method = class_linker->ResolveMethod(self, method_idx, referrer, type); } if (UNLIKELY(resolved_method == nullptr)) { DCHECK(self->IsExceptionPending()); // Throw exception and unwind. -- cgit v1.2.3-59-g8ed1b