src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp
changeset 54924 ba1eccda5450
parent 54344 8cd2af66ac7c
child 54940 2d90a0988c95
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp	Fri May 17 12:33:37 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp	Fri May 17 09:52:35 2019 -0400
@@ -25,22 +25,47 @@
 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
 
 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
+#include "gc/shenandoah/shenandoahTimingTracker.hpp"
 
-template <typename IsAlive>
-void ShenandoahRootProcessor::update_all_roots(OopClosure* oops,
-                                               CLDClosure* clds,
-                                               CodeBlobClosure* blobs,
-                                               ThreadClosure* thread_cl,
-                                               uint worker_id) {
-  process_all_roots(oops, clds, blobs, thread_cl, worker_id);
+template <typename IsAlive, typename KeepAlive>
+void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
+  _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
+}
+
+template <typename ITR>
+ShenandoahCodeCacheRoots<ITR>::ShenandoahCodeCacheRoots() {
+  nmethod::oops_do_marking_prologue();
+}
+
+template <typename ITR>
+void ShenandoahCodeCacheRoots<ITR>::code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id) {
+  ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+  ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
+  _coderoots_iterator.possibly_parallel_blobs_do(blob_cl);
+}
 
-  IsAlive is_alive;
-  _weak_processor_task.work<IsAlive, OopClosure>(worker_id, &is_alive, oops);
-  _processed_weak_roots = true;
+template <typename ITR>
+ShenandoahCodeCacheRoots<ITR>::~ShenandoahCodeCacheRoots() {
+  nmethod::oops_do_marking_epilogue();
+}
+
+template <typename IsAlive, typename KeepAlive>
+void ShenandoahRootUpdater::roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive) {
+  CodeBlobToOopClosure update_blobs(keep_alive, CodeBlobToOopClosure::FixRelocations);
+  CLDToOopClosure clds(keep_alive, ClassLoaderData::_claim_strong);
+  CLDToOopClosure* weak_clds = ShenandoahHeap::heap()->unload_classes() ? NULL : &clds;
 
-  if (ShenandoahStringDedup::is_enabled()) {
-    ShenandoahStringDedup::parallel_oops_do(&is_alive, oops, worker_id);
+  _serial_roots.oops_do(keep_alive, worker_id);
+
+  _thread_roots.oops_do(keep_alive, NULL, worker_id);
+  _cld_roots.clds_do(&clds, weak_clds, worker_id);
+
+  if(_update_code_cache) {
+    _code_roots.code_blobs_do(&update_blobs, worker_id);
   }
+
+  _weak_roots.oops_do<IsAlive, KeepAlive>(is_alive, keep_alive, worker_id);
+  _dedup_roots.oops_do(is_alive, keep_alive, worker_id);
 }
 
 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP