< prev index next >

src/share/vm/gc/shenandoah/shenandoahConcurrentMark.inline.hpp

Print this page
rev 13055 : Implement barriers for maintaining connection matrix.

@@ -204,11 +204,11 @@
   }
 
   void do_buffer(void** buffer, size_t size) {
     for (size_t i = 0; i < size; ++i) {
       oop* p = (oop*) &buffer[i];
-      ShenandoahConcurrentMark::mark_through_ref<oop, RESOLVE>(p, _heap, _queue);
+      ShenandoahConcurrentMark::mark_through_ref<oop, RESOLVE, false>(p, _heap, _queue, NULL);
     }
   }
 };
 
 inline bool ShenandoahConcurrentMark::try_draining_satb_buffer(SCMObjToScanQueue *q, SCMTask &task) {

@@ -216,12 +216,12 @@
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
   bool had_refs = satb_mq_set.apply_closure_to_completed_buffer(&cl);
   return had_refs && try_queue(q, task);
 }
 
-template<class T, UpdateRefsMode UPDATE_REFS>
-inline void ShenandoahConcurrentMark::mark_through_ref(T *p, ShenandoahHeap* heap, SCMObjToScanQueue* q) {
+template<class T, UpdateRefsMode UPDATE_REFS, bool UPDATE_MATRIX>
+inline void ShenandoahConcurrentMark::mark_through_ref(T *p, ShenandoahHeap* heap, SCMObjToScanQueue* q, ShenandoahConnectionMatrix* conn_matrix) {
   T o = oopDesc::load_heap_oop(p);
   if (! oopDesc::is_null(o)) {
     oop obj = oopDesc::decode_heap_oop_not_null(o);
     switch (UPDATE_REFS) {
     case NONE:

@@ -246,10 +246,19 @@
     // case we don't need to do anything else.
     if (UPDATE_REFS != CONCURRENT || !oopDesc::is_null(obj)) {
       assert(!oopDesc::is_null(obj), "Must not be null here");
       assert(heap->is_in(obj), "We shouldn't be calling this on objects not in the heap: " PTR_FORMAT, p2i(obj));
       assert(oopDesc::bs()->is_safe(obj), "Only mark objects in from-space");
+
+      if (UPDATE_MATRIX) {
+        if (heap->is_in_reserved(p)) { // Could also be in CLD, when marking through metadata.
+          uint from_idx = heap->heap_region_index_containing(p);
+          uint to_idx = heap->heap_region_index_containing(obj);
+          conn_matrix->set_connected(from_idx, to_idx, true);
+        }
+      }
+
       if (heap->mark_next(obj)) {
         log_develop_trace(gc, marking)("Marked obj: " PTR_FORMAT, p2i((HeapWord*) obj));
 
         bool pushed = q->push(SCMTask(obj));
         assert(pushed, "overflow queue should always succeed pushing");
< prev index next >