8220444: Shenandoah should use parallel version of WeakProcessor in root processor for weak roots

Reviewed-by: rkennke, shade
This commit is contained in:
Zhengyu Gu 2019-03-11 14:06:05 -04:00
parent 7c49914df1
commit b5b1fe042a
2 changed files with 8 additions and 7 deletions

View file

@ -34,7 +34,7 @@
#include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp" #include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/shenandoahVMOperations.hpp" #include "gc/shenandoah/shenandoahVMOperations.hpp"
#include "gc/shared/weakProcessor.hpp" #include "gc/shared/weakProcessor.inline.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
@ -47,7 +47,8 @@ ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahHeap* heap, uint n_wo
_srs(n_workers), _srs(n_workers),
_par_state_string(StringTable::weak_storage()), _par_state_string(StringTable::weak_storage()),
_phase(phase), _phase(phase),
_coderoots_all_iterator(ShenandoahCodeRoots::iterator()) _coderoots_all_iterator(ShenandoahCodeRoots::iterator()),
_weak_processor_task(n_workers)
{ {
heap->phase_timings()->record_workers_start(_phase); heap->phase_timings()->record_workers_start(_phase);
@ -192,10 +193,9 @@ void ShenandoahRootProcessor::process_vm_roots(OopClosure* strong_roots,
SystemDictionary::oops_do(strong_roots); SystemDictionary::oops_do(strong_roots);
} }
if (jni_weak_roots != NULL) { 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); 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) { if (ShenandoahStringDedup::is_enabled() && weak_roots != NULL) {

View file

@ -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 * 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 * 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/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp" #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shared/strongRootsScope.hpp" #include "gc/shared/strongRootsScope.hpp"
#include "gc/shared/weakProcessor.hpp"
#include "gc/shared/workgroup.hpp" #include "gc/shared/workgroup.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
@ -43,7 +44,6 @@ public:
enum Shenandoah_process_roots_tasks { enum Shenandoah_process_roots_tasks {
SHENANDOAH_RP_PS_Universe_oops_do, SHENANDOAH_RP_PS_Universe_oops_do,
SHENANDOAH_RP_PS_JNIHandles_oops_do, SHENANDOAH_RP_PS_JNIHandles_oops_do,
SHENANDOAH_RP_PS_JNIHandles_weak_oops_do,
SHENANDOAH_RP_PS_ObjectSynchronizer_oops_do, SHENANDOAH_RP_PS_ObjectSynchronizer_oops_do,
SHENANDOAH_RP_PS_Management_oops_do, SHENANDOAH_RP_PS_Management_oops_do,
SHENANDOAH_RP_PS_SystemDictionary_oops_do, SHENANDOAH_RP_PS_SystemDictionary_oops_do,
@ -60,6 +60,7 @@ class ShenandoahRootProcessor : public StackObj {
ParallelCLDRootIterator _cld_iterator; ParallelCLDRootIterator _cld_iterator;
ShenandoahAllCodeRootsIterator _coderoots_all_iterator; ShenandoahAllCodeRootsIterator _coderoots_all_iterator;
CodeBlobClosure* _threads_nmethods_cl; CodeBlobClosure* _threads_nmethods_cl;
WeakProcessor::Task _weak_processor_task;
void process_java_roots(OopClosure* scan_non_heap_roots, void process_java_roots(OopClosure* scan_non_heap_roots,
CLDClosure* scan_strong_clds, CLDClosure* scan_strong_clds,