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

Forcing eager initialization of CHM$ReservationNode avoids deoptimization

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: core-libs

      Description

      On bootstrap we always hit a deoptimization of CHM.tabAt (which now gets compiled very early). By eagerly initializing ReservationNode we avoid this and see slightly better startup:

      diff -r a09af8ef8e5c src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
      --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java Thu Apr 26 12:48:35 2018 -0700
      +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java Fri Apr 27 15:04:58 2018 +0200
      @@ -6388,6 +6388,9 @@
       
               // Reduce the risk of rare disastrous classloading in first call to
               // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
      - Class<?> ensureLoaded = LockSupport.class;
      + U.ensureClassInitialized(LockSupport.class);
      + // Eagerly initializing of ReservationNode avoids a few very likely deoptimizations
      + // during bootstrap:
      + U.ensureClassInitialized(ReservationNode.class);
           }
       }

        Attachments

          Activity

            People

            • Assignee:
              martin Martin Buchholz
              Reporter:
              redestad Claes Redestad
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: