G1: refactor G1CardSetArrayLocker

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 18
    • Affects Version/s: 18
    • Component/s: hotspot
    • gc
    • b22

      ```
        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.

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

              Created:
              Updated:
              Resolved: