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

G1: refactor G1CardSetArrayLocker

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 18
    • 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.

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

              Created:
              Updated:
              Resolved: