8220444: Shenandoah should use parallel version of WeakProcessor in root processor for weak roots
Reviewed-by: rkennke, shade
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp Mon Mar 11 13:37:56 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp Mon Mar 11 14:06:05 2019 -0400
@@ -34,7 +34,7 @@
#include "gc/shenandoah/shenandoahTimingTracker.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/shenandoahVMOperations.hpp"
-#include "gc/shared/weakProcessor.hpp"
+#include "gc/shared/weakProcessor.inline.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
@@ -47,7 +47,8 @@
_srs(n_workers),
_par_state_string(StringTable::weak_storage()),
_phase(phase),
- _coderoots_all_iterator(ShenandoahCodeRoots::iterator())
+ _coderoots_all_iterator(ShenandoahCodeRoots::iterator()),
+ _weak_processor_task(n_workers)
{
heap->phase_timings()->record_workers_start(_phase);
@@ -192,10 +193,9 @@
SystemDictionary::oops_do(strong_roots);
}
if (jni_weak_roots != NULL) {
- if (_process_strong_tasks->try_claim_task(SHENANDOAH_RP_PS_JNIHandles_weak_oops_do)) {
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIWeakRoots, worker_id);
- WeakProcessor::oops_do(jni_weak_roots);
- }
+ AlwaysTrueClosure always_true;
+ _weak_processor_task.work<AlwaysTrueClosure, OopClosure>(worker_id, &always_true, jni_weak_roots);
}
if (ShenandoahStringDedup::is_enabled() && weak_roots != NULL) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp Mon Mar 11 13:37:56 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp Mon Mar 11 14:06:05 2019 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
@@ -30,6 +30,7 @@
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shared/strongRootsScope.hpp"
+#include "gc/shared/weakProcessor.hpp"
#include "gc/shared/workgroup.hpp"
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
@@ -43,7 +44,6 @@
enum Shenandoah_process_roots_tasks {
SHENANDOAH_RP_PS_Universe_oops_do,
SHENANDOAH_RP_PS_JNIHandles_oops_do,
- SHENANDOAH_RP_PS_JNIHandles_weak_oops_do,
SHENANDOAH_RP_PS_ObjectSynchronizer_oops_do,
SHENANDOAH_RP_PS_Management_oops_do,
SHENANDOAH_RP_PS_SystemDictionary_oops_do,
@@ -60,6 +60,7 @@
ParallelCLDRootIterator _cld_iterator;
ShenandoahAllCodeRootsIterator _coderoots_all_iterator;
CodeBlobClosure* _threads_nmethods_cl;
+ WeakProcessor::Task _weak_processor_task;
void process_java_roots(OopClosure* scan_non_heap_roots,
CLDClosure* scan_strong_clds,