ART: Rewrite EnsureInitialized hit case
When an initialized class is found during EnsureInitialized, do
not check whether verification was attempted and fix up bits.
Instead, ensure that all class-loading paths have that done
when eventually getting here.
Special runtime-constructed classes (primitives, arrays, proxies)
need code to do this work. "Normal" classes have the work done
during VerifyClass.
Leave a DCHECK in as a state check. Protect state transfers with
additional checks.
This reduces the overhead of the interpreter which cannot elide
initialization checks for static accesses.
Bug: 115834172
Test: m test-art-host
Change-Id: Iacd6652583364509c37eafe81fed1198abb1b71a
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 18f7105..0039be0 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1742,6 +1742,9 @@
if (&cls->GetDexFile() == &accessor.GetDexFile()) {
ObjectLock<mirror::Class> lock(self, cls);
mirror::Class::SetStatus(cls, status, self);
+ if (status >= ClassStatus::kVerified) {
+ cls->SetVerificationAttempted();
+ }
}
} else {
DCHECK(self->IsExceptionPending());