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/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index fe45b9e..061c788 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -114,7 +114,8 @@
EXPECT_EQ(0, primitive->GetIfTableCount());
EXPECT_TRUE(primitive->GetIfTable() != nullptr);
EXPECT_EQ(primitive->GetIfTable()->Count(), 0u);
- EXPECT_EQ(kAccPublic | kAccFinal | kAccAbstract, primitive->GetAccessFlags());
+ EXPECT_EQ(kAccPublic | kAccFinal | kAccAbstract | kAccVerificationAttempted,
+ primitive->GetAccessFlags());
}
void AssertObjectClass(ObjPtr<mirror::Class> JavaLangObject)