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

Improve Mutex inlining

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 14
    • Fix Version/s: 14
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b18

      Description

      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/

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: