< prev index next >
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
Print this page
*** 2425,2442 ****
// Mark from roots one level into CMS
MarkRefsIntoClosure notOlder(_span, verification_mark_bm());
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! gch->gen_process_roots(_cmsGen->level(),
true, // younger gens are roots
- true, // activate StrongRootsScope
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
NULL,
! NULL); // SSS: Provide correct closure
// Now mark from the roots
MarkFromRootsClosure markFromRootsClosure(this, _span,
verification_mark_bm(), verification_mark_stack(),
false /* don't yield */, true /* verifying */);
--- 2425,2446 ----
// Mark from roots one level into CMS
MarkRefsIntoClosure notOlder(_span, verification_mark_bm());
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! {
! StrongRootsScope srs(1);
!
! gch->gen_process_roots(&srs,
! _cmsGen->level(),
true, // younger gens are roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
NULL,
! NULL);
! }
// Now mark from the roots
MarkFromRootsClosure markFromRootsClosure(this, _span,
verification_mark_bm(), verification_mark_stack(),
false /* don't yield */, true /* verifying */);
*** 2493,2510 ****
markBitMap());
CLDToOopClosure cld_closure(¬Older, true);
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! gch->gen_process_roots(_cmsGen->level(),
true, // younger gens are roots
- true, // activate StrongRootsScope
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
NULL,
&cld_closure);
// Now mark from the roots
MarkFromRootsVerifyClosure markFromRootsClosure(this, _span,
verification_mark_bm(), markBitMap(), verification_mark_stack());
assert(_restart_addr == NULL, "Expected pre-condition");
--- 2497,2518 ----
markBitMap());
CLDToOopClosure cld_closure(¬Older, true);
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! {
! StrongRootsScope srs(1);
!
! gch->gen_process_roots(&srs,
! _cmsGen->level(),
true, // younger gens are roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
NULL,
&cld_closure);
+ }
// Now mark from the roots
MarkFromRootsVerifyClosure markFromRootsClosure(this, _span,
verification_mark_bm(), markBitMap(), verification_mark_stack());
assert(_restart_addr == NULL, "Expected pre-condition");
*** 2910,2923 ****
void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl);
};
// Parallel initial mark task
class CMSParInitialMarkTask: public CMSParMarkTask {
public:
! CMSParInitialMarkTask(CMSCollector* collector, uint n_workers) :
! CMSParMarkTask("Scan roots and young gen for initial mark in parallel",
! collector, n_workers) {}
void work(uint worker_id);
};
// Checkpoint the roots into this generation from outside
// this generation. [Note this initial checkpoint need only
--- 2918,2932 ----
void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl);
};
// Parallel initial mark task
class CMSParInitialMarkTask: public CMSParMarkTask {
+ StrongRootsScope* _strong_roots_scope;
public:
! CMSParInitialMarkTask(CMSCollector* collector, StrongRootsScope* strong_roots_scope, uint n_workers) :
! CMSParMarkTask("Scan roots and young gen for initial mark in parallel", collector, n_workers),
! _strong_roots_scope(strong_roots_scope) {}
void work(uint worker_id);
};
// Checkpoint the roots into this generation from outside
// this generation. [Note this initial checkpoint need only
*** 3001,3028 ****
if (CMSParallelInitialMarkEnabled) {
// The parallel version.
FlexibleWorkGang* workers = gch->workers();
assert(workers != NULL, "Need parallel worker threads.");
uint n_workers = workers->active_workers();
! CMSParInitialMarkTask tsk(this, n_workers);
gch->set_par_threads(n_workers);
initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
if (n_workers > 1) {
- StrongRootsScope srs;
workers->run_task(&tsk);
} else {
- StrongRootsScope srs;
tsk.work(0);
}
gch->set_par_threads(0);
} else {
// The serial version.
CLDToOopClosure cld_closure(¬Older, true);
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! gch->gen_process_roots(_cmsGen->level(),
true, // younger gens are roots
- true, // activate StrongRootsScope
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
NULL,
&cld_closure);
--- 3010,3041 ----
if (CMSParallelInitialMarkEnabled) {
// The parallel version.
FlexibleWorkGang* workers = gch->workers();
assert(workers != NULL, "Need parallel worker threads.");
uint n_workers = workers->active_workers();
!
! StrongRootsScope srs(n_workers);
!
! CMSParInitialMarkTask tsk(this, &srs, n_workers);
gch->set_par_threads(n_workers);
initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
if (n_workers > 1) {
workers->run_task(&tsk);
} else {
tsk.work(0);
}
gch->set_par_threads(0);
} else {
// The serial version.
CLDToOopClosure cld_closure(¬Older, true);
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
!
! StrongRootsScope srs(1);
!
! gch->gen_process_roots(&srs,
! _cmsGen->level(),
true, // younger gens are roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
NULL,
&cld_closure);
*** 4449,4461 ****
_timer.reset();
_timer.start();
CLDToOopClosure cld_closure(&par_mri_cl, true);
! gch->gen_process_roots(_collector->_cmsGen->level(),
false, // yg was scanned above
- false, // this is parallel code
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
_collector->should_unload_classes(),
&par_mri_cl,
NULL,
&cld_closure);
--- 4462,4474 ----
_timer.reset();
_timer.start();
CLDToOopClosure cld_closure(&par_mri_cl, true);
! gch->gen_process_roots(_strong_roots_scope,
! _collector->_cmsGen->level(),
false, // yg was scanned above
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
_collector->should_unload_classes(),
&par_mri_cl,
NULL,
&cld_closure);
*** 4475,4497 ****
CompactibleFreeListSpace* _cms_space;
// The per-thread work queues, available here for stealing.
OopTaskQueueSet* _task_queues;
ParallelTaskTerminator _term;
public:
// A value of 0 passed to n_workers will cause the number of
// workers to be taken from the active workers in the work gang.
CMSParRemarkTask(CMSCollector* collector,
CompactibleFreeListSpace* cms_space,
uint n_workers, FlexibleWorkGang* workers,
! OopTaskQueueSet* task_queues):
CMSParMarkTask("Rescan roots and grey objects in parallel",
collector, n_workers),
_cms_space(cms_space),
_task_queues(task_queues),
! _term(n_workers, task_queues) { }
OopTaskQueueSet* task_queues() { return _task_queues; }
OopTaskQueue* work_queue(int i) { return task_queues()->queue(i); }
--- 4488,4513 ----
CompactibleFreeListSpace* _cms_space;
// The per-thread work queues, available here for stealing.
OopTaskQueueSet* _task_queues;
ParallelTaskTerminator _term;
+ StrongRootsScope* _strong_roots_scope;
public:
// A value of 0 passed to n_workers will cause the number of
// workers to be taken from the active workers in the work gang.
CMSParRemarkTask(CMSCollector* collector,
CompactibleFreeListSpace* cms_space,
uint n_workers, FlexibleWorkGang* workers,
! OopTaskQueueSet* task_queues,
! StrongRootsScope* strong_roots_scope):
CMSParMarkTask("Rescan roots and grey objects in parallel",
collector, n_workers),
_cms_space(cms_space),
_task_queues(task_queues),
! _term(n_workers, task_queues),
! _strong_roots_scope(strong_roots_scope) { }
OopTaskQueueSet* task_queues() { return _task_queues; }
OopTaskQueue* work_queue(int i) { return task_queues()->queue(i); }
*** 4585,4597 ****
}
// ---------- remaining roots --------------
_timer.reset();
_timer.start();
! gch->gen_process_roots(_collector->_cmsGen->level(),
false, // yg was scanned above
- false, // this is parallel code
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
_collector->should_unload_classes(),
&par_mrias_cl,
NULL,
NULL); // The dirty klasses will be handled below
--- 4601,4613 ----
}
// ---------- remaining roots --------------
_timer.reset();
_timer.start();
! gch->gen_process_roots(_strong_roots_scope,
! _collector->_cmsGen->level(),
false, // yg was scanned above
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
_collector->should_unload_classes(),
&par_mrias_cl,
NULL,
NULL); // The dirty klasses will be handled below
*** 5065,5077 ****
n_workers = ParallelGCThreads;
workers->set_active_workers(n_workers);
}
CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
! CMSParRemarkTask tsk(this,
! cms_space,
! n_workers, workers, task_queues());
// Set up for parallel process_roots work.
gch->set_par_threads(n_workers);
// We won't be iterating over the cards in the card table updating
// the younger_gen cards, so we shouldn't call the following else
--- 5081,5093 ----
n_workers = ParallelGCThreads;
workers->set_active_workers(n_workers);
}
CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
! StrongRootsScope srs(n_workers);
!
! CMSParRemarkTask tsk(this, cms_space, n_workers, workers, task_queues(), &srs);
// Set up for parallel process_roots work.
gch->set_par_threads(n_workers);
// We won't be iterating over the cards in the card table updating
// the younger_gen cards, so we shouldn't call the following else
*** 5102,5116 ****
if (n_workers > 1) {
// Make refs discovery MT-safe, if it isn't already: it may not
// necessarily be so, since it's possible that we are doing
// ST marking.
ReferenceProcessorMTDiscoveryMutator mt(ref_processor(), true);
- StrongRootsScope srs;
workers->run_task(&tsk);
} else {
ReferenceProcessorMTDiscoveryMutator mt(ref_processor(), false);
- StrongRootsScope srs;
tsk.work(0);
}
gch->set_par_threads(0); // 0 ==> non-parallel.
// restore, single-threaded for now, any preserved marks
--- 5118,5130 ----
*** 5174,5188 ****
GCTraceTime t("root rescan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
verify_work_stacks_empty();
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! StrongRootsScope srs;
! gch->gen_process_roots(_cmsGen->level(),
true, // younger gens as roots
- false, // use the local StrongRootsScope
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
&mrias_cl,
NULL,
NULL); // The dirty klasses will be handled below
--- 5188,5202 ----
GCTraceTime t("root rescan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
verify_work_stacks_empty();
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
! StrongRootsScope srs(1);
! gch->gen_process_roots(&srs,
! _cmsGen->level(),
true, // younger gens as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
&mrias_cl,
NULL,
NULL); // The dirty klasses will be handled below
< prev index next >