Added new state and Soft/Hard error return to verifier for bad supers.
Market was failing because a superclass failed with a soft error, and
then its subclass would be rejected with a hard error. New states and
return values were added, and now ClassLinker::VerifyClass allows a
superclass to have either kStatusVerified or
kStatusRetryVerificationAtRuntime as valid states.
Change-Id: I72f23d25fa3bdcfd08f3113b091303535a327c14
diff --git a/src/object.h b/src/object.h
index 9ad02a8..cc1d28e 100644
--- a/src/object.h
+++ b/src/object.h
@@ -1165,6 +1165,14 @@
// it kStatusResolved. Java allows circularities of the form where a super
// class has a field that is of the type of the sub class. We need to be able
// to fully resolve super classes while resolving types for fields.
+ //
+ // kStatusRetryVerificationAtRuntime: The verifier sets a class to
+ // this state if it encounters a soft failure at compile time. This
+ // often happens when there are unresolved classes in other dex
+ // files, and this status marks a class as needing to be verified
+ // again at runtime.
+ //
+ // TODO: Explain the other states
enum Status {
kStatusError = -1,
@@ -1172,10 +1180,11 @@
kStatusIdx = 1, // loaded, DEX idx in super_class_type_idx_ and interfaces_type_idx_
kStatusLoaded = 2, // DEX idx values resolved
kStatusResolved = 3, // part of linking
- kStatusVerifying = 4, // in the process of being verified
- kStatusVerified = 5, // logically part of linking; done pre-init
- kStatusInitializing = 6, // class init in progress
- kStatusInitialized = 7, // ready to go
+ kStatusRetryVerificationAtRuntime = 4, // compile time verification failed, retry at runtime
+ kStatusVerifying = 5, // in the process of being verified
+ kStatusVerified = 6, // logically part of linking; done pre-init
+ kStatusInitializing = 7, // class init in progress
+ kStatusInitialized = 8, // ready to go
};
Status GetStatus() const {
@@ -1205,6 +1214,11 @@
return GetStatus() >= kStatusResolved;
}
+ // Returns true if the class was compile-time verified.
+ bool IsCompileTimeVerified() const {
+ return GetStatus() >= kStatusRetryVerificationAtRuntime;
+ }
+
// Returns true if the class has been verified.
bool IsVerified() const {
return GetStatus() >= kStatusVerified;