Add checks for pooled_mark_stacks in CC GC
Adding some CHECK regarding thread-local mark stacks.
Bug: 140119552
Test: art/test/testrunner/testrunner.py
Change-Id: I0b10851ff4cf94791da08363546647c2294524e5
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 01c032a..274fd32 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -2055,6 +2055,7 @@
{
MutexLock mu(thread_running_gc_, mark_stack_lock_);
CHECK(revoked_mark_stacks_.empty());
+ CHECK_EQ(pooled_mark_stacks_.size(), kMarkStackPoolSize);
}
while (true) {
std::vector<mirror::Object*> refs;
@@ -2081,6 +2082,7 @@
{
MutexLock mu(thread_running_gc_, mark_stack_lock_);
CHECK(revoked_mark_stacks_.empty());
+ CHECK_EQ(pooled_mark_stacks_.size(), kMarkStackPoolSize);
}
// Process the GC mark stack in the exclusive mode. No need to take the lock.
while (!gc_mark_stack_->IsEmpty()) {
@@ -2367,6 +2369,7 @@
MutexLock mu(thread_running_gc_, mark_stack_lock_);
CHECK(gc_mark_stack_->IsEmpty());
CHECK(revoked_mark_stacks_.empty());
+ CHECK_EQ(pooled_mark_stacks_.size(), kMarkStackPoolSize);
}
}
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 3aacfcb..31fc730 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2462,6 +2462,9 @@
CHECK(tlsPtr_.flip_function == nullptr);
CHECK_EQ(tls32_.is_transitioning_to_runnable, false);
+ if (kUseReadBarrier) {
+ CHECK(tlsPtr_.thread_local_mark_stack == nullptr);
+ }
// Make sure we processed all deoptimization requests.
CHECK(tlsPtr_.deoptimization_context_stack == nullptr) << "Missed deoptimization";
CHECK(tlsPtr_.frame_id_to_shadow_frame == nullptr) <<