< prev index next >

src/hotspot/share/gc/shared/referenceProcessor.cpp

Print this page
rev 47223 : [mq]: heapz8
rev 47224 : [mq]: heap9a

@@ -33,10 +33,11 @@
 #include "gc/shared/referenceProcessor.inline.hpp"
 #include "logging/log.hpp"
 #include "memory/allocation.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/heapMonitoring.hpp"
 #include "runtime/java.hpp"
 #include "runtime/jniHandles.hpp"
 
 ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
 ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy      = NULL;

@@ -256,13 +257,21 @@
       task_executor->set_single_threaded_mode();
     }
     process_phaseJNI(is_alive, keep_alive, complete_gc);
   }
 
+  // Heap Monitoring references
+  size_t handled;
+  {
+    GCTraceTime(Debug, gc, ref) tt("Heap Sampler Weak Reference", phase_times->gc_timer());
+    handled = process_phaseHeapSampling(is_alive, keep_alive, complete_gc);
+  }
+
   phase_times->set_total_time_ms((os::elapsedTime() - start_time) * 1000);
 
   log_develop_trace(gc, ref)("JNI Weak Reference count: " SIZE_FORMAT, count_jni_refs());
+  log_develop_trace(gc, ref)("Heap Sampler Weak Reference handled: " SIZE_FORMAT, handled);
 
   return stats;
 }
 
 #ifndef PRODUCT

@@ -288,10 +297,22 @@
                                           VoidClosure*       complete_gc) {
   JNIHandles::weak_oops_do(is_alive, keep_alive);
   complete_gc->do_void();
 }
 
+size_t ReferenceProcessor::process_phaseHeapSampling(
+    BoolObjectClosure*           is_alive,
+    OopClosure*                  keep_alive,
+    VoidClosure*                 complete_gc) {
+  size_t count = 0;
+  if (HeapMonitoring::enabled()) {
+    count = HeapMonitoring::weak_oops_do(is_alive, keep_alive);
+    complete_gc->do_void();
+  }
+  return count;
+}
+
 void ReferenceProcessor::enqueue_discovered_references(AbstractRefProcTaskExecutor*  task_executor,
                                                        ReferenceProcessorPhaseTimes* phase_times) {
   // Enqueue references that are not made active again, and
   // clear the decks for the next collection (cycle).
   enqueue_discovered_reflists(task_executor, phase_times);
< prev index next >