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

G1: Rename needs_remset_update to remset_is_tracked in G1HeapRegionAttr

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b21

      Description

      `region_attr.needs_remset_update()` is used to cache the corresponding remset `is_tracked()` state. One can rename the method to make the relation more explicit.

      Before:

      ```
      _region_attr.set_has_remset(r->hrm_index(), r->rem_set()->is_tracked());
      ...
      assert(region_attr.needs_remset_update() == hr_obj->rem_set()->is_tracked(),
      ```

      After:

      ```
      _region_attr.set_remset_is_tracked(r->hrm_index(), r->rem_set()->is_tracked());
      ...
      assert(region_attr.remset_is_tracked() == hr_obj->rem_set()->is_tracked(),
      ```

      A more subtle reason is that `is_tracked()` tells the current remset state, and whether remset needs to be updated or not is sth the caller decides. In `G1ParScanThreadState::write_ref_field_post`, all four checks are trying to decide if a card should be enqueued (or equivalently if the remset should be updated).

      ```
      if (HeapRegion::is_in_same_region(p, obj)) {
        ...
      if (from_attr.is_new_survivor()) {
        ...
      if (dest_attr.is_in_cset()) {
        ...
      if (!region_attr.needs_remset_update()) { <--- check the remset state, and the caller decides whether remset needs to be updated or not.
        ...
      ```

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ayang Albert Yang
              Reporter:
              ayang Albert Yang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: