void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { assert(Universe::heap()->is_gc_active(), "called outside gc"); NOT_PRODUCT(GCTraceTime tm("StealMarkingTask", PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); oop obj = NULL; ObjArrayTask task; int random_seed = 17; do { while (ParCompactionManager::steal_objarray(which, &random_seed, task)) { objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint(); k->oop_follow_contents(cm, task.obj(), task.index()); cm->follow_marking_stacks(); } while (ParCompactionManager::steal(which, &random_seed, obj)) { obj->follow_contents(cm); cm->follow_marking_stacks(); } } while (!terminator()->offer_termination()); }
void ParCompactionManager::follow_marking_stacks() { do { // Drain the overflow stack first, to allow stealing from the marking stack. oop obj; while (marking_stack()->pop_overflow(obj)) { obj->follow_contents(this); } while (marking_stack()->pop_local(obj)) { obj->follow_contents(this); } // Process ObjArrays one at a time to avoid marking stack bloat. ObjArrayTask task; if (_objarray_stack.pop_overflow(task)) { objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint(); k->oop_follow_contents(this, task.obj(), task.index()); } else if (_objarray_stack.pop_local(task)) { objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint(); k->oop_follow_contents(this, task.obj(), task.index()); } } while (!marking_stacks_empty()); assert(marking_stacks_empty(), "Sanity"); }
void MarkSweep::follow_stack() { do { while (!_marking_stack.is_empty()) { oop obj = _marking_stack.pop(); assert (obj->is_gc_marked(), "p must be marked"); obj->follow_contents(); } // Process ObjArrays one at a time to avoid marking stack bloat. if (!_objarray_stack.is_empty()) { ObjArrayTask task = _objarray_stack.pop(); ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass(); k->oop_follow_contents(task.obj(), task.index()); } } while (!_marking_stack.is_empty() || !_objarray_stack.is_empty()); }
void ParCompactionManager::follow_marking_stacks() { do { // Drain the overflow stack first, to allow stealing from the marking stack. oop obj; while (marking_stack()->pop_overflow(obj)) { follow_contents(obj); } while (marking_stack()->pop_local(obj)) { follow_contents(obj); } // Process ObjArrays one at a time to avoid marking stack bloat. ObjArrayTask task; if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) { follow_contents((objArrayOop)task.obj(), task.index()); } } while (!marking_stacks_empty()); assert(marking_stacks_empty(), "Sanity"); }