Skip to content
Permalink
Browse files

8238160: Uniformize Parallel GC task queue variable names

Reviewed-by: kbarrett, sangheki
  • Loading branch information
Thomas Schatzl
Thomas Schatzl committed Feb 11, 2020
1 parent 1d42f08 commit c16040393ce7b004fb766be78843b0092f302315
@@ -40,15 +40,15 @@
#include "oops/objArrayKlass.inline.hpp"
#include "oops/oop.inline.hpp"

PSOldGen* ParCompactionManager::_old_gen = NULL;
PSOldGen* ParCompactionManager::_old_gen = NULL;
ParCompactionManager** ParCompactionManager::_manager_array = NULL;

OopTaskQueueSet* ParCompactionManager::_stack_array = NULL;
ParCompactionManager::ObjArrayTaskQueueSet*
ParCompactionManager::_objarray_queues = NULL;
ParCompactionManager::OopTaskQueueSet* ParCompactionManager::_oop_task_queues = NULL;
ParCompactionManager::ObjArrayTaskQueueSet* ParCompactionManager::_objarray_task_queues = NULL;
ParCompactionManager::RegionTaskQueueSet* ParCompactionManager::_region_task_queues = NULL;

ObjectStartArray* ParCompactionManager::_start_array = NULL;
ParMarkBitMap* ParCompactionManager::_mark_bitmap = NULL;
RegionTaskQueueSet* ParCompactionManager::_region_array = NULL;
GrowableArray<size_t >* ParCompactionManager::_shadow_region_array = NULL;
Monitor* ParCompactionManager::_shadow_region_monitor = NULL;

@@ -77,20 +77,20 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) {
assert(_manager_array == NULL, "Attempt to initialize twice");
_manager_array = NEW_C_HEAP_ARRAY(ParCompactionManager*, parallel_gc_threads+1, mtGC);

_stack_array = new OopTaskQueueSet(parallel_gc_threads);
guarantee(_stack_array != NULL, "Could not allocate stack_array");
_objarray_queues = new ObjArrayTaskQueueSet(parallel_gc_threads);
guarantee(_objarray_queues != NULL, "Could not allocate objarray_queues");
_region_array = new RegionTaskQueueSet(parallel_gc_threads);
guarantee(_region_array != NULL, "Could not allocate region_array");
_oop_task_queues = new OopTaskQueueSet(parallel_gc_threads);
guarantee(_oop_task_queues != NULL, "Could not allocate oop task queues");
_objarray_task_queues = new ObjArrayTaskQueueSet(parallel_gc_threads);
guarantee(_objarray_task_queues != NULL, "Could not allocate objarray task queues");
_region_task_queues = new RegionTaskQueueSet(parallel_gc_threads);
guarantee(_region_task_queues != NULL, "Could not allocate region task queues");

// Create and register the ParCompactionManager(s) for the worker threads.
for(uint i=0; i<parallel_gc_threads; i++) {
_manager_array[i] = new ParCompactionManager();
guarantee(_manager_array[i] != NULL, "Could not create ParCompactionManager");
stack_array()->register_queue(i, _manager_array[i]->marking_stack());
_objarray_queues->register_queue(i, &_manager_array[i]->_objarray_stack);
region_array()->register_queue(i, _manager_array[i]->region_stack());
oop_task_queues()->register_queue(i, _manager_array[i]->marking_stack());
_objarray_task_queues->register_queue(i, &_manager_array[i]->_objarray_stack);
region_task_queues()->register_queue(i, _manager_array[i]->region_stack());
}

// The VMThread gets its own ParCompactionManager, which is not available
@@ -51,17 +51,22 @@ class ParCompactionManager : public CHeapObj<mtGC> {


private:
typedef GenericTaskQueue<oop, mtGC> OopTaskQueue;
typedef GenericTaskQueueSet<OopTaskQueue, mtGC> OopTaskQueueSet;

// 32-bit: 4K * 8 = 32KiB; 64-bit: 8K * 16 = 128KiB
#define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13))
typedef OverflowTaskQueue<ObjArrayTask, mtGC, QUEUE_SIZE> ObjArrayTaskQueue;
typedef GenericTaskQueueSet<ObjArrayTaskQueue, mtGC> ObjArrayTaskQueueSet;
#undef QUEUE_SIZE
typedef OverflowTaskQueue<size_t, mtGC> RegionTaskQueue;
typedef GenericTaskQueueSet<RegionTaskQueue, mtGC> RegionTaskQueueSet;

static ParCompactionManager** _manager_array;
static OopTaskQueueSet* _stack_array;
static ObjArrayTaskQueueSet* _objarray_queues;
static OopTaskQueueSet* _oop_task_queues;
static ObjArrayTaskQueueSet* _objarray_task_queues;
static ObjectStartArray* _start_array;
static RegionTaskQueueSet* _region_array;
static RegionTaskQueueSet* _region_task_queues;
static PSOldGen* _old_gen;

private:
@@ -90,13 +95,13 @@ class ParCompactionManager : public CHeapObj<mtGC> {

static PSOldGen* old_gen() { return _old_gen; }
static ObjectStartArray* start_array() { return _start_array; }
static OopTaskQueueSet* stack_array() { return _stack_array; }
static OopTaskQueueSet* oop_task_queues() { return _oop_task_queues; }

static void initialize(ParMarkBitMap* mbm);

protected:
// Array of task queues. Needed by the task terminator.
static RegionTaskQueueSet* region_array() { return _region_array; }
static RegionTaskQueueSet* region_task_queues() { return _region_task_queues; }
OverflowTaskQueue<oop, mtGC>* marking_stack() { return &_marking_stack; }

// Pushes onto the marking stack. If the marking stack is full,
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,15 +70,15 @@ class PCIterateMarkAndPushClosure: public MetadataVisitingOopIterateClosure {
};

inline bool ParCompactionManager::steal(int queue_num, oop& t) {
return stack_array()->steal(queue_num, t);
return oop_task_queues()->steal(queue_num, t);
}

inline bool ParCompactionManager::steal_objarray(int queue_num, ObjArrayTask& t) {
return _objarray_queues->steal(queue_num, t);
return _objarray_task_queues->steal(queue_num, t);
}

inline bool ParCompactionManager::steal(int queue_num, size_t& region) {
return region_array()->steal(queue_num, region);
return region_task_queues()->steal(queue_num, region);
}

inline void ParCompactionManager::push(oop obj) {
@@ -2178,7 +2178,7 @@ class MarkFromRootsTask : public AbstractGangTask {
AbstractGangTask("MarkFromRootsTask"),
_strong_roots_scope(active_workers),
_subtasks(),
_terminator(active_workers, ParCompactionManager::stack_array()),
_terminator(active_workers, ParCompactionManager::oop_task_queues()),
_active_workers(active_workers) {
_subtasks.set_n_threads(active_workers);
_subtasks.set_n_tasks(ParallelRootType::sentinel);
@@ -2210,7 +2210,7 @@ class PCRefProcTask : public AbstractGangTask {
AbstractGangTask("PCRefProcTask"),
_task(task),
_ergo_workers(ergo_workers),
_terminator(_ergo_workers, ParCompactionManager::stack_array()) {
_terminator(_ergo_workers, ParCompactionManager::oop_task_queues()) {
}

virtual void work(uint worker_id) {
@@ -2626,7 +2626,7 @@ class UpdateDensePrefixAndCompactionTask: public AbstractGangTask {
UpdateDensePrefixAndCompactionTask(TaskQueue& tq, uint active_workers) :
AbstractGangTask("UpdateDensePrefixAndCompactionTask"),
_tq(tq),
_terminator(active_workers, ParCompactionManager::region_array()),
_terminator(active_workers, ParCompactionManager::region_task_queues()),
_active_workers(active_workers) {
}
virtual void work(uint worker_id) {
@@ -43,7 +43,7 @@
#include "oops/compressedOops.inline.hpp"

PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL;
PSPromotionManager::OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL;
PreservedMarksSet* PSPromotionManager::_preserved_marks_set = NULL;
PSOldGen* PSPromotionManager::_old_gen = NULL;
MutableSpace* PSPromotionManager::_young_space = NULL;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,9 @@ class PSPromotionManager {
friend class PSRefProcTask;

private:
typedef OverflowTaskQueue<StarTask, mtGC> OopStarTaskQueue;
typedef GenericTaskQueueSet<OopStarTaskQueue, mtGC> OopStarTaskQueueSet;

static PaddedEnd<PSPromotionManager>* _manager_array;
static OopStarTaskQueueSet* _stack_array_depth;
static PreservedMarksSet* _preserved_marks_set;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -443,9 +443,6 @@ class TerminatorTerminator: public CHeapObj<mtInternal> {
virtual bool should_exit_termination() = 0;
};

typedef GenericTaskQueue<oop, mtGC> OopTaskQueue;
typedef GenericTaskQueueSet<OopTaskQueue, mtGC> OopTaskQueueSet;

#ifdef _MSC_VER
#pragma warning(push)
// warning C4522: multiple assignment operators specified
@@ -524,10 +521,4 @@ class ObjArrayTask
#pragma warning(pop)
#endif

typedef OverflowTaskQueue<StarTask, mtGC> OopStarTaskQueue;
typedef GenericTaskQueueSet<OopStarTaskQueue, mtGC> OopStarTaskQueueSet;

typedef OverflowTaskQueue<size_t, mtGC> RegionTaskQueue;
typedef GenericTaskQueueSet<RegionTaskQueue, mtGC> RegionTaskQueueSet;

#endif // SHARE_GC_SHARED_TASKQUEUE_HPP

0 comments on commit c160403

Please sign in to comment.