Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8027559

Decrease code size and templatizing in G1ParCopyClosure::do_oop_work

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • hs25, 8
    • hotspot
    • gc
    • b04

        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.

              tschatzl Thomas Schatzl
              tschatzl Thomas Schatzl
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: