Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8247820: ParallelGC: Process strong OopStorage entries in parallel
Reviewed-by: pliden, eosterlund, kbarrett, tschatzl
  • Loading branch information
stefank committed Jun 24, 2020
1 parent 3797364 commit 9d6aa42a7c1a9ed8d7932126738b07f989f914b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
@@ -50,7 +50,8 @@
#include "gc/shared/gcTraceTime.inline.hpp"
#include "gc/shared/isGCActiveMark.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/oopStorageSet.inline.hpp"
#include "gc/shared/oopStorageSetParState.inline.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "gc/shared/referenceProcessorPhaseTimes.hpp"
@@ -2015,10 +2016,6 @@ static void mark_from_roots_work(ParallelRootType::Value root_type, uint worker_
Universe::oops_do(&mark_and_push_closure);
break;

case ParallelRootType::jni_handles:
JNIHandles::oops_do(&mark_and_push_closure);
break;

case ParallelRootType::object_synchronizer:
ObjectSynchronizer::oops_do(&mark_and_push_closure);
break;
@@ -2031,10 +2028,6 @@ static void mark_from_roots_work(ParallelRootType::Value root_type, uint worker_
JvmtiExport::oops_do(&mark_and_push_closure);
break;

case ParallelRootType::vm_global:
OopStorageSet::vm_global()->oops_do(&mark_and_push_closure);
break;

case ParallelRootType::class_loader_data:
{
CLDToOopClosure cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
@@ -2081,6 +2074,7 @@ static void steal_marking_work(TaskTerminator& terminator, uint worker_id) {
class MarkFromRootsTask : public AbstractGangTask {
typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
StrongRootsScope _strong_roots_scope; // needed for Threads::possibly_parallel_threads_do
OopStorageSetStrongParState<false /* concurrent */, false /* is_const */> _oop_storage_set_par_state;
SequentialSubTasksDone _subtasks;
TaskTerminator _terminator;
uint _active_workers;
@@ -2105,6 +2099,15 @@ class MarkFromRootsTask : public AbstractGangTask {
PCAddThreadRootsMarkingTaskClosure closure(worker_id);
Threads::possibly_parallel_threads_do(true /*parallel */, &closure);

// Mark from OopStorages
{
ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(worker_id);
PCMarkAndPushClosure closure(cm);
_oop_storage_set_par_state.oops_do(&closure);
// Do the real work
cm->follow_marking_stacks();
}

if (_active_workers > 1) {
steal_marking_work(_terminator, worker_id);
}
@@ -2235,12 +2238,11 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {

// General strong roots.
Universe::oops_do(&oop_closure);
JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles
Threads::oops_do(&oop_closure, NULL);
ObjectSynchronizer::oops_do(&oop_closure);
Management::oops_do(&oop_closure);
JvmtiExport::oops_do(&oop_closure);
OopStorageSet::vm_global()->oops_do(&oop_closure);
OopStorageSet::strong_oops_do(&oop_closure);
CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::cld_do(&cld_closure);

@@ -35,10 +35,8 @@ class ParallelRootType : public AllStatic {
// We do not want any holes in the enum as we enumerate these values by incrementing them.
enum Value {
universe,
jni_handles,
object_synchronizer,
management,
vm_global,
class_loader_data,
jvmti,
code_cache,
@@ -44,7 +44,8 @@
#include "gc/shared/gcTraceTime.inline.hpp"
#include "gc/shared/isGCActiveMark.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/oopStorageSetParState.inline.hpp"
#include "gc/shared/oopStorageParState.inline.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "gc/shared/referenceProcessorPhaseTimes.hpp"
@@ -96,18 +97,10 @@ static void scavenge_roots_work(ParallelRootType::Value root_type, uint worker_i
Universe::oops_do(&roots_closure);
break;

case ParallelRootType::jni_handles:
JNIHandles::oops_do(&roots_closure);
break;

case ParallelRootType::object_synchronizer:
ObjectSynchronizer::oops_do(&roots_closure);
break;

case ParallelRootType::vm_global:
OopStorageSet::vm_global()->oops_do(&roots_closure);
break;

case ParallelRootType::class_loader_data:
{
PSScavengeCLDClosure cld_closure(pm);
@@ -312,6 +305,7 @@ class PSThreadRootsTaskClosure : public ThreadClosure {

class ScavengeRootsTask : public AbstractGangTask {
StrongRootsScope _strong_roots_scope; // needed for Threads::possibly_parallel_threads_do
OopStorageSetStrongParState<false /* concurrent */, false /* is_const */> _oop_storage_strong_par_state;
SequentialSubTasksDone _subtasks;
PSOldGen* _old_gen;
HeapWord* _gen_top;
@@ -373,6 +367,14 @@ class ScavengeRootsTask : public AbstractGangTask {
PSThreadRootsTaskClosure closure(worker_id);
Threads::possibly_parallel_threads_do(true /*parallel */, &closure);

// Scavenge OopStorages
{
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(worker_id);
PSScavengeRootsClosure closure(pm);
_oop_storage_strong_par_state.oops_do(&closure);
// Do the real work
pm->drain_stacks(false);
}

// If active_workers can exceed 1, add a steal_work().
// PSPromotionManager::drain_stacks_depth() does not fully drain its

0 comments on commit 9d6aa42

Please sign in to comment.