member variable _monitor of MonitorLocker is redundant

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 17
    • Component/s: hotspot
    • b18

      MonitorLocker is a subclass of MutexLocker. The member variable _monitor has the same value of _mutex in its base class.

      The only difference is type of pointer. Because 2 constructs pass in Monitor*, it's safe to use static_cast<> to cast _mutex to Monitor*. eg.
      Monitor* as_monitor() const {
      return static_cast<Monitor* >(_mutex);
      }

      This can save 1 pointer for a MonitorLocker object. on x86_64 LP64, it can save 8 bytes.

            Assignee:
            Xin Liu
            Reporter:
            Xin Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: