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

Improve Mutex inlining

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • hotspot
    • b18

      I observed in some profiles that calls from Mutex::lock() to Mutex::lock(Thread *) are not being inlined, at least not by gcc on Linux. By outlining the contended loop, we see better inlining and less instructions spent when using mutexes in hotspot[1], at little to no static footprint cost.

      A more thorough examination should be considered: MutexLocker could possibly inline through a call to Mutex::try_lock, which reduce the uncontended fast-path to a call down to the platform primitive, e.g., pthread_mutex_trylock.

      [1] http://cr.openjdk.java.net/~redestad/scratch/mutex_contended.00/

            redestad Claes Redestad
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: