Disable bitstring type check runtime hooks.
Introduce a build flag for the bitstring type check, put
runtime hooks behind the flag and set the flag to false.
Also add bitstring initialization for proxy classes, a test
and a benchmark for the type checks.
Test: m test-art-host-gtest
Test: testrunner.py --host --interpreter
Test: Repeat with kBitstringSubtypeCheckEnabled = true.
Bug: 73299705
Change-Id: Ibcd88a828c7addc0473d8c428818734f80226b19
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 8a7defd..9246bae 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -156,9 +156,19 @@
self->AssertPendingException();
}
- {
+ if (kBitstringSubtypeCheckEnabled) {
+ // FIXME: This looks broken with respect to aborted transactions.
ObjPtr<mirror::Class> h_this_ptr = h_this.Get();
SubtypeCheck<ObjPtr<mirror::Class>>::WriteStatus(h_this_ptr, new_status);
+ } else {
+ // The ClassStatus is always in the 4 most-significant bits of status_.
+ static_assert(sizeof(status_) == sizeof(uint32_t), "Size of status_ not equal to uint32");
+ uint32_t new_status_value = static_cast<uint32_t>(new_status) << (32 - kClassStatusBitSize);
+ if (Runtime::Current()->IsActiveTransaction()) {
+ h_this->SetField32Volatile<true>(StatusOffset(), new_status_value);
+ } else {
+ h_this->SetField32Volatile<false>(StatusOffset(), new_status_value);
+ }
}
// Setting the object size alloc fast path needs to be after the status write so that if the