diff options
author | Vladimir Marko <vmarko@google.com> | 2017-01-20 19:32:50 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2017-01-24 12:05:02 +0000 |
commit | 72ab684871f870aead76b23cb67deb046107b380 (patch) | |
tree | d4bb40cab65df449246b35ae582234238676b7bb /runtime/oat_file.h | |
parent | e36c51aee58e61e9fc89851b767379c587f050e3 (diff) | |
download | art-72ab684871f870aead76b23cb67deb046107b380.tar.gz art-72ab684871f870aead76b23cb67deb046107b380.tar.bz2 art-72ab684871f870aead76b23cb67deb046107b380.zip |
Add class status for resolved erroneous classes.
Split the old ambiguous status mirror::Class::kStatusError
into kStatusErrorUnresolved and kStatusErrorResolved. Once
a class has been resolved, IsResolved() shall return true
even if the class later becomes erroneous. Allow returning
erroneous class from ClassLinker::EnsureResolved() if it has
been previously resolved. This allows consistent behavior
for retrieving classes, immune to multi-threaded races and
multi-dex weirdness. It also allows JVMTI to properly report
"prepared" (i.e. resolved) classes that are also erroneous.
The new behavior is consistent with the RI.
Add regression tests to 008-exceptions for inconsistent
behavior for multi-dex retrieval of erroneous resolved class
(wrapping or not wrapping the old exception based on which
dex file is used for lookup) and for a CHECK(IsResolved())
crash in ClassLinker::LoadSuperAndInterfaces() (without any
tests for similar checks that could have previously failed
only due to extremely unlikely race conditions; these should
now also be fixed).
Inconsistency still remains for class verification as shown
by the new exceptionsForSuperClassInitFailure() test in
008-exceptions, where interpreter and Optimizing still
cause different exceptions to be thrown.
Note: This is partially changing behavior implemented for
bug 28787733. Since we allow the class loader to retrieve an
erroneous resolved class, the ExceptionInInitializerError is
not thrown at all from VMClassLoader_findLoadedClass(), so
there is nothing to wrap in ClassNotFoundException.
Test: m test-art-host
Bug: 30627598
Bug: 28787733
Change-Id: I86cdca00f35a0d6221d2559e3026ac0428a3613c
Diffstat (limited to 'runtime/oat_file.h')
-rw-r--r-- | runtime/oat_file.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/oat_file.h b/runtime/oat_file.h index 62d99fb51c..111755e7a1 100644 --- a/runtime/oat_file.h +++ b/runtime/oat_file.h @@ -201,8 +201,12 @@ class OatFile { // A representation of an invalid OatClass, used when an OatClass can't be found. // See FindOatClass(). static OatClass Invalid() { - return OatClass(nullptr, mirror::Class::kStatusError, kOatClassNoneCompiled, 0, nullptr, - nullptr); + return OatClass(/* oat_file */ nullptr, + mirror::Class::kStatusErrorUnresolved, + kOatClassNoneCompiled, + /* bitmap_size */ 0, + /* bitmap_pointer */ nullptr, + /* methods_pointer */ nullptr); } private: |