RFR (S): 8144714 Add extension point to G1 evacuation closures

Kim Barrett kim.barrett at oracle.com
Thu Dec 10 01:41:53 UTC 2015


On Dec 4, 2015, at 10:18 AM, Mikael Gerdin <mikael.gerdin at oracle.com> wrote:
> 
> Hi all,
> 
> Please review this small change to add a hook in the G1 evacuation path.
> This allows extension code to register regions which are otherwise interesting to the GC and get notifications when pointers into such regions are encountered.
> 
> Testing: JPRT, gc test suite
> Performance:
> This additional branch in G1ParScanClosure introduces a slight regression of about 1-2% in GC pause times. I have some performance fixes to make up for that regression in the pipe.
> 
> webrev: http://cr.openjdk.java.net/~mgerdin/8144714/webrev.0/
> bug: https://bugs.openjdk.java.net/browse/JDK-8144714
> 
> Thanks
> /Mikael

I'm still not planning to fully review this change, but I happened to
be looking at G1ParScanClosure and remembered the code to add the
extension point, and wondered if it might be improved.

------------------------------------------------------------------------------ 
src/share/vm/gc/g1/g1OopClosures.inline.hpp
  91       if (state.is_humongous()) {
  92         _g1->set_humongous_is_live(obj);
  93       } else if (state.is_ext()) {
  94         _par_scan_state->do_oop_ext(p);
  95       }

Would it be worthwhile changing this to

  if (state.is_humongous_or_ext()) {
    if (state.is_humongous()) {
      _g1->set_humongous_is_live(obj);
    } else {
      _par_scan_state->do_oop_ext(p);
    }
  }

where

bool InCSetState::is_humongous_or_ext() const {
  return _value < NotInCSet;
}

This would have one conditional branch vs two for objects in regions
that are neither humongous nor ext, at the cost of always having two
conditional branches for humongous objects, which are presumably
relatively rare.  That seems like a win when ext isn't being used.

Or instead of adding a new function, maybe promote is_default() out
of #ifdef ASSERT and use

  if (!state.is_default()) {
    if (state.is_humongous()) {
      _g1->set_humongous_is_live(obj);
    } else {
      _par_scan_state->do_oop_ext(p);
    }
  }

------------------------------------------------------------------------------




More information about the hotspot-gc-dev mailing list