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

Improve skipping card enqueuing during gc if there are no remembered sets in old gen

XMLWordPrintable

    • gc

      This code

      template <class T>
      inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
      [...]
        } else if (!HeapRegion::is_in_same_region(p, obj)) {
          handle_non_cset_obj_common(region_attr, p, obj);
          assert(_scanning_in_young != Uninitialized, "Scan location has not been initialized.");
          if (_scanning_in_young == True) {
            return;
          }
          _par_scan_state->enqueue_card_if_tracked(region_attr, p, obj); // !----------------------
        }
      }

      is going to enqueue cards into the refinement buffers (slightly abridged) that contain "interesting" references, i.e. need reference update.

      The check above is a shortcut to avoid the method call (and its additional checks) for cases that "obviously" do not need cards.

      Another check that could be done (and should probably be added to the assignment of _scanning_in_young) is that if there is absolutely no non-young gen region with a remembered set, then this attempt to enqueue will also always fail.

      So the idea is to somewhere store whether this is the case (i.e. store and maintain the number of non-young regions with remset), and use it in the G1ScanInYoungSetter.

      This could be interesting as the case when there is no non-young gen region with remembered sets may be fairly common (i.e. during young-only phase, up until the remark pause) as long as there are no humongous object candidates.

      Investigate and test

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

              Created:
              Updated: