8279700: Parallel: Simplify ScavengeRootsTask constructor API
Reviewed-by: tschatzl, sjohanss
This commit is contained in:
parent
cfee4512f7
commit
67141849d9
@ -283,37 +283,30 @@ class ScavengeRootsTask : public WorkerTask {
|
|||||||
PSOldGen* _old_gen;
|
PSOldGen* _old_gen;
|
||||||
HeapWord* _gen_top;
|
HeapWord* _gen_top;
|
||||||
uint _active_workers;
|
uint _active_workers;
|
||||||
bool _is_empty;
|
bool _is_old_gen_empty;
|
||||||
TaskTerminator _terminator;
|
TaskTerminator _terminator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScavengeRootsTask(PSOldGen* old_gen,
|
ScavengeRootsTask(PSOldGen* old_gen,
|
||||||
HeapWord* gen_top,
|
uint active_workers) :
|
||||||
uint active_workers,
|
|
||||||
bool is_empty) :
|
|
||||||
WorkerTask("ScavengeRootsTask"),
|
WorkerTask("ScavengeRootsTask"),
|
||||||
_strong_roots_scope(active_workers),
|
_strong_roots_scope(active_workers),
|
||||||
_subtasks(ParallelRootType::sentinel),
|
_subtasks(ParallelRootType::sentinel),
|
||||||
_old_gen(old_gen),
|
_old_gen(old_gen),
|
||||||
_gen_top(gen_top),
|
_gen_top(old_gen->object_space()->top()),
|
||||||
_active_workers(active_workers),
|
_active_workers(active_workers),
|
||||||
_is_empty(is_empty),
|
_is_old_gen_empty(old_gen->object_space()->is_empty()),
|
||||||
_terminator(active_workers, PSPromotionManager::vm_thread_promotion_manager()->stack_array_depth()) {
|
_terminator(active_workers, PSPromotionManager::vm_thread_promotion_manager()->stack_array_depth()) {
|
||||||
|
assert(_old_gen != NULL, "Sanity");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void work(uint worker_id) {
|
virtual void work(uint worker_id) {
|
||||||
|
assert(worker_id < _active_workers, "Sanity");
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
|
|
||||||
if (!_is_empty) {
|
if (!_is_old_gen_empty) {
|
||||||
// There are only old-to-young pointers if there are objects
|
// There are only old-to-young pointers if there are objects
|
||||||
// in the old gen.
|
// in the old gen.
|
||||||
|
|
||||||
assert(_old_gen != NULL, "Sanity");
|
|
||||||
// There are no old-to-young pointers if the old gen is empty.
|
|
||||||
assert(!_old_gen->object_space()->is_empty(), "Should not be called is there is no work");
|
|
||||||
assert(_old_gen->object_space()->contains(_gen_top) || _gen_top == _old_gen->object_space()->top(), "Sanity");
|
|
||||||
assert(worker_id < ParallelGCThreads, "Sanity");
|
|
||||||
|
|
||||||
{
|
{
|
||||||
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(worker_id);
|
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(worker_id);
|
||||||
PSCardTable* card_table = ParallelScavengeHeap::heap()->card_table();
|
PSCardTable* card_table = ParallelScavengeHeap::heap()->card_table();
|
||||||
@ -453,12 +446,6 @@ bool PSScavenge::invoke_no_policy() {
|
|||||||
// Reset our survivor overflow.
|
// Reset our survivor overflow.
|
||||||
set_survivor_overflow(false);
|
set_survivor_overflow(false);
|
||||||
|
|
||||||
// We need to save the old top values before
|
|
||||||
// creating the promotion_manager. We pass the top
|
|
||||||
// values to the card_table, to prevent it from
|
|
||||||
// straying into the promotion labs.
|
|
||||||
HeapWord* old_top = old_gen->object_space()->top();
|
|
||||||
|
|
||||||
const uint active_workers =
|
const uint active_workers =
|
||||||
WorkerPolicy::calc_active_workers(ParallelScavengeHeap::heap()->workers().max_workers(),
|
WorkerPolicy::calc_active_workers(ParallelScavengeHeap::heap()->workers().max_workers(),
|
||||||
ParallelScavengeHeap::heap()->workers().active_workers(),
|
ParallelScavengeHeap::heap()->workers().active_workers(),
|
||||||
@ -472,7 +459,7 @@ bool PSScavenge::invoke_no_policy() {
|
|||||||
{
|
{
|
||||||
GCTraceTime(Debug, gc, phases) tm("Scavenge", &_gc_timer);
|
GCTraceTime(Debug, gc, phases) tm("Scavenge", &_gc_timer);
|
||||||
|
|
||||||
ScavengeRootsTask task(old_gen, old_top, active_workers, old_gen->object_space()->is_empty());
|
ScavengeRootsTask task(old_gen, active_workers);
|
||||||
ParallelScavengeHeap::heap()->workers().run_task(&task);
|
ParallelScavengeHeap::heap()->workers().run_task(&task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user