hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
changeset 5080 eff0cc882603
parent 5076 8b74a4b60b31
child 5547 f4b087cbb361
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Thu Mar 18 01:48:28 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Thu Mar 18 13:31:51 2010 -0700
@@ -217,21 +217,21 @@
 void ParCompactionManager::follow_marking_stacks() {
   do {
     // Drain the overflow stack first, to allow stealing from the marking stack.
+    oop obj;
     while (!overflow_stack()->is_empty()) {
       overflow_stack()->pop()->follow_contents(this);
     }
-    oop obj;
     while (marking_stack()->pop_local(obj)) {
       obj->follow_contents(this);
     }
 
+    // Process ObjArrays one at a time to avoid marking stack bloat.
     ObjArrayTask task;
-    while (!_objarray_overflow_stack->is_empty()) {
+    if (!_objarray_overflow_stack->is_empty()) {
       task = _objarray_overflow_stack->pop();
       objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint();
       k->oop_follow_contents(this, task.obj(), task.index());
-    }
-    while (_objarray_queue.pop_local(task)) {
+    } else if (_objarray_queue.pop_local(task)) {
       objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint();
       k->oop_follow_contents(this, task.obj(), task.index());
     }