Improve Mutex inlining

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 14
    • Affects Version/s: 14
    • Component/s: 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/

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

              Created:
              Updated:
              Resolved: