JDK-8027559 : Decrease code size and templatizing in G1ParCopyClosure::do_oop_work
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs25,8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-10-30
  • Updated: 2014-07-29
  • Resolved: 2014-02-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b04Fixed
Description
G1 closures are relatively heavyweight; VTune indicates high I-cache misses and DSB switches (DSB is an instruction predecode cache, see also http://software.intel.com/sites/products/documentation/doclib/iss/2013/amplifier/lin/ug_docs/GUID-143D1B76-D97F-454F-9B4B-91F2D791B66D.htm) that indicate that the hot loops are too large.

On the other hand, G1ParCopyClosure::do_oop_work is heavily templatized, and for this reason relatively generic.

Maybe little performance (and the use of templates, i.e. code size!) can be saved by manually extracting duplicate code without destroying maintainability too much. This following patterns have been noticed (inlining some levels for completeness) during a short look:

(1)
oop obj = load_decode_oop(p)

if (...)
  store_encode_oop(obj, p)

  if (...) {
    if (G1DeferredUpdate) {
       oop obj = load_decode_oop(p)
       [...]
    } else {
       oop obj = load_decode_oop(p)
    }
  } else {
  }
} else {
}
if (...) {
        oop obj = load_decode_oop(p)
}

(2) repeated use of is_in_reserved() and !is_in_reserved() with possibly the intention of a NULL check.

(3) especially the changes in (1) could result in removal of unnecessary template instantiations.

Look and see if anything can be done in particular in this method about that.
Comments
pjbb2005 log files; baseline.log is without the current changes, changed.log with.
18-02-2014

Also move out G1ParCopyClosure::copy_to_survivor_space(), G1ParCopyClosure::mark[_forwarded]_object, and G1ParCopyClosure::do_klass_barrier() as they are not dependent on any template parameter. This saves some code size, as the compiler will create an instance for each of them (containing the same code).
24-01-2014