Revert^2 "Better detect PrimitiveArrayCritical issues"
This reverts commit 3ba842dfa15bb51d6579b0ac4dc92f6fbc23db23.
Reason for revert: Re-land fixed version of original CL
PS1 is identical to aosp/2089666 .
PS2 performs the checks using the raw disable_thread_flip_count field
instead of the getter, so that it also works with the read barrier
disabled. In that case this field should always be zero, but it
doesn't hurt to check.
Bug: 231038541
Test: Build and boot AOSP
Change-Id: I78165d5fa8e82a8aed5a61da3d9a6a8ec8bfa69e
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 97cfb7a..e629b4e 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1981,6 +1981,9 @@
if (thread->IsStillStarting()) {
os << " (still starting up)";
}
+ if (thread->tls32_.disable_thread_flip_count != 0) {
+ os << " DisableFlipCount = " << thread->tls32_.disable_thread_flip_count;
+ }
os << "\n";
} else {
os << '"' << ::art::GetThreadName(tid) << '"'
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 6482e72..bfde711 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1291,6 +1291,10 @@
DCHECK_EQ(self, Thread::Current());
CHECK_NE(self->GetState(), ThreadState::kRunnable);
Locks::mutator_lock_->AssertNotHeld(self);
+ if (self->tls32_.disable_thread_flip_count != 0) {
+ LOG(FATAL) << "Incomplete PrimitiveArrayCritical section at exit: " << *self << "count = "
+ << self->tls32_.disable_thread_flip_count;
+ }
VLOG(threads) << "ThreadList::Unregister() " << *self;