< prev index next >

src/hotspot/share/gc/g1/g1OopClosures.inline.hpp

Print this page
rev 52316 : imported patch 8212911-unify-reference-handling-during-gc
rev 52317 : imported patch 8212911-stefanj-review
rev 52318 : imported patch 8212911-kbarrett-review

@@ -80,16 +80,16 @@
   }
   oop obj = CompressedOops::decode_not_null(heap_oop);
   const InCSetState state = _g1h->in_cset_state(obj);
   if (state.is_in_cset()) {
     prefetch_and_push(p, obj);
-  } else {
-    if (HeapRegion::is_in_same_region(p, obj)) {
+  } else if (!HeapRegion::is_in_same_region(p, obj)) {
+    handle_non_cset_obj_common(state, p, obj);
+    if (_scanning_in_young) {
       return;
     }
-    handle_non_cset_obj_common(state, p, obj);
-    _par_scan_state->update_rs(_from, p, obj);
+    _par_scan_state->enqueue_card_if_tracked(p, obj);
   }
 }
 
 template <class T>
 inline void G1CMOopClosure::do_oop_work(T* p) {

@@ -170,17 +170,13 @@
   const InCSetState state = _g1h->in_cset_state(obj);
   if (state.is_in_cset()) {
     // Since the source is always from outside the collection set, here we implicitly know
     // that this is a cross-region reference too.
     prefetch_and_push(p, obj);
-  } else {
-    HeapRegion* to = _g1h->heap_region_containing(obj);
-    if (_from == to) {
-      return;
-    }
+  } else if (!HeapRegion::is_in_same_region(p, obj)) {
     handle_non_cset_obj_common(state, p, obj);
-    to->rem_set()->add_reference(p, _worker_i);
+    _par_scan_state->enqueue_card_if_tracked(p, obj);
   }
 }
 
 template <class T>
 inline void G1ScanObjsDuringScanRSClosure::do_oop_work(T* p) {

@@ -191,14 +187,11 @@
   oop obj = CompressedOops::decode_not_null(heap_oop);
 
   const InCSetState state = _g1h->in_cset_state(obj);
   if (state.is_in_cset()) {
     prefetch_and_push(p, obj);
-  } else {
-    if (HeapRegion::is_in_same_region(p, obj)) {
-      return;
-    }
+  } else if (!HeapRegion::is_in_same_region(p, obj)) {
     handle_non_cset_obj_common(state, p, obj);
   }
 }
 
 void G1ParCopyHelper::do_cld_barrier(oop new_obj) {
< prev index next >