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

G1: refactor G1CardSetArrayLocker

    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:
      b22

      Description

      ```
        class G1CardSetArrayLocker : public StackObj {
          EntryCountType volatile* _value;
          EntryCountType volatile _original_value;
          bool _success;
          ...
        }
      ```
      Using `value` in field names is too abstract; since this class only used to capture `num_entries`, these field names can be made more explicit.

      `_original_value` is only accessed by the thread holding the lock, so it should *not* be `volatile`.


      `bool _success` is used as a one-bit integer to increment `num_entries` by 0 or 1, which works fine, but can be a bit confusing. Instead, one can increment `_original_value` directly.

        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: