--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Tue Sep 28 09:51:37 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Tue Sep 28 15:56:15 2010 -0700
@@ -2170,6 +2170,16 @@
heap->update_counters();
}
+#ifdef ASSERT
+ for (size_t i = 0; i < ParallelGCThreads + 1; ++i) {
+ ParCompactionManager* const cm =
+ ParCompactionManager::manager_array(int(i));
+ assert(cm->marking_stack()->is_empty(), "should be empty");
+ assert(cm->region_stack()->is_empty(), "should be empty");
+ assert(cm->revisit_klass_stack()->is_empty(), "should be empty");
+ }
+#endif // ASSERT
+
if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
HandleMark hm; // Discard invalid handles created during verification
gclog_or_tty->print(" VerifyAfterGC:");
@@ -2711,21 +2721,22 @@
// All klasses on the revisit stack are marked at this point.
// Update and follow all subklass, sibling and implementor links.
if (PrintRevisitStats) {
- gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes());
+ gclog_or_tty->print_cr("#classes in system dictionary = %d",
+ SystemDictionary::number_of_classes());
}
for (uint i = 0; i < ParallelGCThreads + 1; i++) {
ParCompactionManager* cm = ParCompactionManager::manager_array(i);
KeepAliveClosure keep_alive_closure(cm);
- int length = cm->revisit_klass_stack()->length();
+ Stack<Klass*>* const rks = cm->revisit_klass_stack();
if (PrintRevisitStats) {
- gclog_or_tty->print_cr("Revisit klass stack[%d] length = %d", i, length);
+ gclog_or_tty->print_cr("Revisit klass stack[%u] length = " SIZE_FORMAT,
+ i, rks->size());
}
- for (int j = 0; j < length; j++) {
- cm->revisit_klass_stack()->at(j)->follow_weak_klass_links(
- is_alive_closure(),
- &keep_alive_closure);
+ while (!rks->is_empty()) {
+ Klass* const k = rks->pop();
+ k->follow_weak_klass_links(is_alive_closure(), &keep_alive_closure);
}
- // revisit_klass_stack is cleared in reset()
+
cm->follow_marking_stacks();
}
}
@@ -2744,19 +2755,20 @@
// we can visit and clear any weak references from MDO's which
// we memoized during the strong marking phase.
if (PrintRevisitStats) {
- gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes());
+ gclog_or_tty->print_cr("#classes in system dictionary = %d",
+ SystemDictionary::number_of_classes());
}
for (uint i = 0; i < ParallelGCThreads + 1; i++) {
ParCompactionManager* cm = ParCompactionManager::manager_array(i);
- GrowableArray<DataLayout*>* rms = cm->revisit_mdo_stack();
- int length = rms->length();
+ Stack<DataLayout*>* rms = cm->revisit_mdo_stack();
if (PrintRevisitStats) {
- gclog_or_tty->print_cr("Revisit MDO stack[%d] length = %d", i, length);
+ gclog_or_tty->print_cr("Revisit MDO stack[%u] size = " SIZE_FORMAT,
+ i, rms->size());
}
- for (int j = 0; j < length; j++) {
- rms->at(j)->follow_weak_refs(is_alive_closure());
+ while (!rms->is_empty()) {
+ rms->pop()->follow_weak_refs(is_alive_closure());
}
- // revisit_mdo_stack is cleared in reset()
+
cm->follow_marking_stacks();
}
}