From ef04ac6c05fa344428008ffa1eac7316c64a3467 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Thu, 11 Apr 2019 13:37:10 -0700 Subject: Fix correctness for fast path class loading For the fast path, we currently remove all exceptions and only return ClassNotFoundExceptions. This CL preserves exceptions that might occur such as linkage errors. The follow up is to add an additional fast path for faster class not found exception generation. Bug: 130310316 Bug: 130293184 Bug: 130209120 Test: test-art-host (cherry picked from commit ca19f9a8547999cb13de06458364d64ab143cb09) Merged-In: Iae55aaaae2be5b1330e8e54bee36e862cf9e12e0 Change-Id: I0fff3a748c07b5f3e05f4de24d56678a8b046844 --- runtime/native/java_lang_VMClassLoader.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/native/java_lang_VMClassLoader.cc') diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc index 46162c1989..11e02a2ce4 100644 --- a/runtime/native/java_lang_VMClassLoader.cc +++ b/runtime/native/java_lang_VMClassLoader.cc @@ -57,8 +57,12 @@ class VMClassLoader { REQUIRES_SHARED(Locks::mutator_lock_) { ObjPtr result; if (cl->FindClassInBaseDexClassLoader(soa, self, descriptor, hash, class_loader, &result)) { + DCHECK(!self->IsExceptionPending()); return result; } + if (self->IsExceptionPending()) { + self->ClearException(); + } return nullptr; } }; -- cgit v1.2.3-59-g8ed1b