src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp

changeset 1051
4f360ec815ba
parent 777
37f87013dfd8
child 1061
87fa6e083d82
     1.1 --- a/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp	Mon Mar 02 16:37:04 2009 -0800
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp	Fri Mar 06 13:50:14 2009 -0800
     1.3 @@ -31,24 +31,7 @@
     1.4  }
     1.5  
     1.6  inline void HRInto_G1RemSet::write_ref_nv(HeapRegion* from, oop* p) {
     1.7 -  oop obj = *p;
     1.8 -  assert(from != NULL && from->is_in_reserved(p),
     1.9 -         "p is not in a from");
    1.10 -  HeapRegion* to = _g1->heap_region_containing(obj);
    1.11 -  if (from != to && to != NULL) {
    1.12 -    if (!to->popular() && !from->is_survivor()) {
    1.13 -#if G1_REM_SET_LOGGING
    1.14 -      gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS"
    1.15 -                             " for region [" PTR_FORMAT ", " PTR_FORMAT ")",
    1.16 -                             p, obj,
    1.17 -                             to->bottom(), to->end());
    1.18 -#endif
    1.19 -      assert(to->rem_set() != NULL, "Need per-region 'into' remsets.");
    1.20 -      if (to->rem_set()->add_reference(p)) {
    1.21 -        _g1->schedule_popular_region_evac(to);
    1.22 -      }
    1.23 -    }
    1.24 -  }
    1.25 +  par_write_ref(from, p, 0);
    1.26  }
    1.27  
    1.28  inline void HRInto_G1RemSet::write_ref(HeapRegion* from, oop* p) {
    1.29 @@ -82,7 +65,22 @@
    1.30    HeapRegion* to = _g1->heap_region_containing(obj);
    1.31    // The test below could be optimized by applying a bit op to to and from.
    1.32    if (to != NULL && from != NULL && from != to) {
    1.33 -    if (!to->popular() && !from->is_survivor()) {
    1.34 +    bool update_delayed = false;
    1.35 +    // There is a tricky infinite loop if we keep pushing
    1.36 +    // self forwarding pointers onto our _new_refs list.
    1.37 +    // The _par_traversal_in_progress flag is true during the collection pause,
    1.38 +    // false during the evacuation failure handing.
    1.39 +    if (_par_traversal_in_progress &&
    1.40 +        to->in_collection_set() && !self_forwarded(obj)) {
    1.41 +      _new_refs[tid]->push(p);
    1.42 +      // Deferred updates to the Cset are either discarded (in the normal case),
    1.43 +      // or processed (if an evacuation failure occurs) at the end
    1.44 +      // of the collection.
    1.45 +      // See HRInto_G1RemSet::cleanup_after_oops_into_collection_set_do().
    1.46 +      update_delayed = true;
    1.47 +    }
    1.48 +
    1.49 +    if (!to->popular() && !update_delayed) {
    1.50  #if G1_REM_SET_LOGGING
    1.51        gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS"
    1.52                               " for region [" PTR_FORMAT ", " PTR_FORMAT ")",
    1.53 @@ -94,11 +92,5 @@
    1.54          _g1->schedule_popular_region_evac(to);
    1.55        }
    1.56      }
    1.57 -    // There is a tricky infinite loop if we keep pushing
    1.58 -    // self forwarding pointers onto our _new_refs list.
    1.59 -    if (_par_traversal_in_progress &&
    1.60 -        to->in_collection_set() && !self_forwarded(obj)) {
    1.61 -      _new_refs[tid]->push(p);
    1.62 -    }
    1.63    }
    1.64  }

mercurial