From 81554d51bf181f341cf6fd50390103424954ac19 Mon Sep 17 00:00:00 2001 From: jcoomes Date: Thu, 18 Mar 2010 13:31:51 -0700 Subject: [PATCH] 6935839: excessive marking stack growth during full gcs Summary: process one item at a time from the objarray stack/queue Reviewed-by: apetrusenko, tonyp --- .../parallelScavenge/psCompactionManager.cpp | 8 ++++---- src/share/vm/gc_implementation/shared/markSweep.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp b/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp index a9723f3cd..c0dda2099 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp @@ -217,21 +217,21 @@ void ParCompactionManager::reset() { 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()); } diff --git a/src/share/vm/gc_implementation/shared/markSweep.cpp b/src/share/vm/gc_implementation/shared/markSweep.cpp index 776730da7..d200fee44 100644 --- a/src/share/vm/gc_implementation/shared/markSweep.cpp +++ b/src/share/vm/gc_implementation/shared/markSweep.cpp @@ -111,7 +111,8 @@ void MarkSweep::follow_stack() { assert (obj->is_gc_marked(), "p must be marked"); obj->follow_contents(); } - while (!_objarray_stack->is_empty()) { + // Process ObjArrays one at a time to avoid marking stack bloat. + if (!_objarray_stack->is_empty()) { ObjArrayTask task = _objarray_stack->pop(); objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint(); k->oop_follow_contents(task.obj(), task.index()); -- GitLab