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

Convert TraceTypeProfile to UL

XMLWordPrintable

    • b11

      `-Xlog:jit*=debug` already gives us almost everything we want to know: +PrintCompilation and +PrintInlining-like outputs.

      ```
      $ java '-Xlog:jit*'=debug

      [7.300s][debug][jit,compilation] 604 3 jdk.internal.jimage.ImageLocation::getAttributeString (54 bytes)
      [7.300s][debug][jit,inlining ] @ 38 jdk.internal.jimage.ImageLocation::getStrings (5 bytes) inline
      [7.300s][debug][jit,inlining ] @ 48 jdk.internal.jimage.ImageStringsReader::get (9 bytes) inline
      [7.300s][debug][jit,inlining ] @ 5 jdk.internal.jimage.BasicImageReader::getString (35 bytes) callee is too large
      [7.300s][debug][jit,inlining ] @ 18 java.lang.StringBuilder::<init> (7 bytes) inline
      ```

      But we would also like to have `+TraceTypeProfile` in that output. Unfortunately, currently it only prints to tty.

      ```
      $ java '-Xlog:jit*'=debug:file=jit.log -XX:+UnlockDiagnosticVMOptions -XX:+TraceTypeProfile Alloc.java 2>&1 | tee stdout.log
      ...

      $ tail -n 10 *.log
      ==> jit.log <==
      [1.506s][debug][jit,inlining ] @ 1 java.lang.Object::hashCode (0 bytes) no static binding
      [1.506s][debug][jit,inlining ] @ 4 java.util.concurrent.ConcurrentHashMap::spread (10 bytes) inline
      [1.507s][debug][jit,inlining ] @ 41 java.util.concurrent.ConcurrentHashMap::tabAt (22 bytes) callee uses too much stack
      [1.507s][debug][jit,inlining ] @ 70 java.util.concurrent.ConcurrentHashMap::helpTransfer (124 bytes) callee is too large
      [1.507s][debug][jit,inlining ] @ 94 java.util.concurrent.ConcurrentHashMap::tabAt (22 bytes) callee uses too much stack
      [1.507s][debug][jit,inlining ] @ 147 java.lang.Object::equals (11 bytes) no static binding
      [1.507s][debug][jit,inlining ] @ 178 java.lang.Object::equals (11 bytes) no static binding
      [1.507s][debug][jit,inlining ] @ 228 java.util.concurrent.ConcurrentHashMap::setTabAt (20 bytes) callee uses too much stack
      [1.507s][debug][jit,inlining ] @ 290 java/util/concurrent/ConcurrentHashMap$TreeNode::findTreeNode (not loaded) not inlineable
      [1.507s][debug][jit,inlining ] @ 324 java.lang.Object::equals (11 bytes) no static binding

      ==> stdout.log <==
                                       \-> TypeProfile (1466/6006 counts) = java/util/LinkedHashMap
       java.util.HashMap::putVal
                                      @ 152 java.util.HashMap::newNode (13 bytes)
                                       \-> TypeProfile (4540/6006 counts) = java/util/HashMap
       java.util.concurrent.ConcurrentHashMap::get
                                    @ 149 java.lang.String::equals (56 bytes)
                                     \-> TypeProfile (51/294 counts) = java/lang/String
       java.util.concurrent.ConcurrentHashMap::get
                                    @ 149 java.lang.invoke.MethodType::equals (65 bytes)
                                     \-> TypeProfile (243/294 counts) = java/lang/invoke/MethodType
      ```


      So we have to fall back to non-UL configurations for it, to correctly attribute type profiles to call sites.

      ```
      $ java -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining -XX:+TraceTypeProfile
      ...
          204 590 3 jdk.internal.jimage.ImageLocation::getAttributeString (54 bytes) made not entrant
                                    @ 38 jdk.internal.jimage.ImageLocation::getStrings (5 bytes) accessor
                                    @ 48 jdk.internal.jimage.ImageStringsReader::get (9 bytes) inline (hot)
                                     \-> TypeProfile (10381/10381 counts) = jdk/internal/jimage/ImageStringsReader
                                      @ 5 jdk.internal.jimage.BasicImageReader::getString (35 bytes) inline (hot)
      ```

            btaylor Ben Taylor
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: