< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp
Print this page
rev 52355 : Remove safepoint-cleanup piggybacking code
@@ -34,10 +34,11 @@
#include "gc/shenandoah/shenandoahStringDedup.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/vm_operations_shenandoah.hpp"
#include "gc/shared/weakProcessor.hpp"
#include "memory/allocation.inline.hpp"
+#include "memory/iterator.hpp"
#include "runtime/mutex.hpp"
#include "runtime/sweeper.hpp"
#include "runtime/vmThread.hpp"
#include "services/management.hpp"
@@ -46,22 +47,14 @@
_process_strong_tasks(new SubTasksDone(SHENANDOAH_RP_PS_NumElements)),
_srs(n_workers),
_par_state_string(StringTable::weak_storage()),
_phase(phase),
_coderoots_all_iterator(ShenandoahCodeRoots::iterator()),
- _om_iterator(ObjectSynchronizer::parallel_iterator()),
- _threads_nmethods_cl(NULL)
+ _om_iterator(ObjectSynchronizer::parallel_iterator())
{
heap->phase_timings()->record_workers_start(_phase);
- if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) {
- VM_ShenandoahOperation* op = (VM_ShenandoahOperation*) VMThread::vm_operation();
- if (op == NULL || !op->_safepoint_cleanup_done) {
- _threads_nmethods_cl = NMethodSweeper::prepare_mark_active_nmethods();
- }
- }
-
if (ShenandoahStringDedup::is_enabled()) {
StringDedup::gc_prologue(false);
}
}
@@ -70,17 +63,10 @@
if (ShenandoahStringDedup::is_enabled()) {
StringDedup::gc_epilogue();
}
ShenandoahHeap::heap()->phase_timings()->record_workers_end(_phase);
-
- if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) {
- VM_ShenandoahOperation* op = (VM_ShenandoahOperation*) VMThread::vm_operation();
- if (op != NULL) {
- op->_safepoint_cleanup_done = true;
- }
- }
}
void ShenandoahRootProcessor::process_all_roots_slow(OopClosure* oops) {
CLDToOopClosure clds(oops);
CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
@@ -112,11 +98,11 @@
CLDClosure* weak_clds,
CodeBlobClosure* blobs,
ThreadClosure* thread_cl,
uint worker_id) {
- process_java_roots(oops, clds, weak_clds, blobs, _threads_nmethods_cl, thread_cl, worker_id);
+ process_java_roots(oops, clds, weak_clds, blobs, thread_cl, worker_id);
process_vm_roots(oops, NULL, weak_oops, worker_id);
_process_strong_tasks->all_tasks_completed(n_workers());
}
@@ -126,26 +112,42 @@
CodeBlobClosure* blobs,
ThreadClosure* thread_cl,
uint worker_id) {
ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
- process_java_roots(oops, clds, clds, blobs, _threads_nmethods_cl, thread_cl, worker_id);
+ process_java_roots(oops, clds, clds, blobs, thread_cl, worker_id);
process_vm_roots(oops, oops, weak_oops, worker_id);
if (blobs != NULL) {
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
_coderoots_all_iterator.possibly_parallel_blobs_do(blobs);
}
_process_strong_tasks->all_tasks_completed(n_workers());
}
+class ShenandoahParallelOopsDoThreadClosure : public ThreadClosure {
+private:
+ OopClosure* _f;
+ CodeBlobClosure* _cf;
+ ThreadClosure* _thread_cl;
+public:
+ ShenandoahParallelOopsDoThreadClosure(OopClosure* f, CodeBlobClosure* cf, ThreadClosure* thread_cl) :
+ _f(f), _cf(cf), _thread_cl(thread_cl) {}
+
+ void do_thread(Thread* t) {
+ if (_thread_cl != NULL) {
+ _thread_cl->do_thread(t);
+ }
+ t->oops_do(_f, _cf);
+ }
+};
+
void ShenandoahRootProcessor::process_java_roots(OopClosure* strong_roots,
CLDClosure* strong_clds,
CLDClosure* weak_clds,
CodeBlobClosure* strong_code,
- CodeBlobClosure* nmethods_cl,
ThreadClosure* thread_cl,
uint worker_id)
{
ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
// Iterating over the CLDG and the Threads are done early to allow us to
@@ -158,11 +160,12 @@
{
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::ThreadRoots, worker_id);
bool is_par = n_workers() > 1;
ResourceMark rm;
- Threads::possibly_parallel_oops_do(is_par, strong_roots, strong_code, nmethods_cl, thread_cl);
+ ShenandoahParallelOopsDoThreadClosure cl(strong_roots, strong_code, thread_cl);
+ Threads::possibly_parallel_threads_do(is_par, &cl);
}
}
void ShenandoahRootProcessor::process_vm_roots(OopClosure* strong_roots,
OopClosure* weak_roots,
@@ -226,26 +229,17 @@
}
ShenandoahRootEvacuator::ShenandoahRootEvacuator(ShenandoahHeap* heap, uint n_workers, ShenandoahPhaseTimings::Phase phase) :
_srs(n_workers),
_phase(phase),
- _coderoots_cset_iterator(ShenandoahCodeRoots::cset_iterator()),
- _threads_nmethods_cl(NULL)
+ _coderoots_cset_iterator(ShenandoahCodeRoots::cset_iterator())
{
heap->phase_timings()->record_workers_start(_phase);
- VM_ShenandoahOperation* op = (VM_ShenandoahOperation*) VMThread::vm_operation();
- if (op == NULL || !op->_safepoint_cleanup_done) {
- _threads_nmethods_cl = NMethodSweeper::prepare_mark_active_nmethods();
- }
}
ShenandoahRootEvacuator::~ShenandoahRootEvacuator() {
ShenandoahHeap::heap()->phase_timings()->record_workers_end(_phase);
- VM_ShenandoahOperation* op = (VM_ShenandoahOperation*) VMThread::vm_operation();
- if (op != NULL) {
- op->_safepoint_cleanup_done = true;
- }
}
void ShenandoahRootEvacuator::process_evacuate_roots(OopClosure* oops,
CodeBlobClosure* blobs,
uint worker_id) {
@@ -254,11 +248,11 @@
{
bool is_par = n_workers() > 1;
ResourceMark rm;
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::ThreadRoots, worker_id);
- Threads::possibly_parallel_oops_do(is_par, oops, NULL, _threads_nmethods_cl);
+ Threads::possibly_parallel_oops_do(is_par, oops, NULL);
}
if (blobs != NULL) {
ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
_coderoots_cset_iterator.possibly_parallel_blobs_do(blobs);
< prev index next >