Check and expand GC mark stack
GC mark stack could be full,
check and expand before pushing onto it.
Bug: 134981304
Test: MTBF auto stress test for 72 hours
Change-Id: I8676e1a1bf19f04f06664d77cea5d5b885c1278c
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 81bc445..9428a0b 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1208,6 +1208,9 @@
DCHECK(self->GetThreadLocalMarkStack() == nullptr);
}
DCHECK_EQ(mark_stack_mode_.load(std::memory_order_relaxed), kMarkStackModeThreadLocal);
+ if (UNLIKELY(gc_mark_stack_->IsFull())) {
+ ExpandGcMarkStack();
+ }
gc_mark_stack_->PushBack(ref);
}