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

C2: replay doesn't replay compilation with var handle correctly

XMLWordPrintable

      I noticed this with the panama benchmarks from this PR:
      https://github.com/openjdk/panama-foreign/pull/762

      One built, running one of the benchmark with:

      $ java -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+PrintCompilation -XX:+PrintInlining -XX:CompileOnly=org.openjdk.bench.java.lang.foreign.MemorySegmentVsBits::byteVarHandle -XX:CompileCommand=option,org.openjdk.bench.java.lang.foreign.MemorySegmentVsBits::byteVarHandle,DumpReplay -XX:CompileCommand=quiet --enable-preview -jar /home/roland/panama-foreign/build/linux-x86_64-server-release/images/test/micro/benchmarks.jar MemorySegmentVsBits.byteVarHandle -f 0 -psize=256

      dumps a replay and also shows plenty of inlining going on during inlining:

         7688 102 n java.lang.invoke.MethodHandle::invokeBasic(LLIJ)V (native)
      # Compiler replay data is saved as: replay_pid3697718_compid101.log
                                  @ 27 java.lang.invoke.VarHandleGuards::guard_LIJ_V (135 bytes) force inline by annotation
                                    @ 3 java.lang.invoke.VarHandle::checkAccessModeThenIsDirect (29 bytes) force inline by annotation
                                    @ 47 java.lang.invoke.VarForm::getMemberName (31 bytes) force inline by annotation
                                    @ 50 java.lang.invoke.VarHandleByteArrayAsLongs$ArrayHandle::set (39 bytes) force inline by annotation
                                      @ 20 java.lang.invoke.VarHandleByteArrayAsLongs$ArrayHandle::index (13 bytes) force inline by annotation
                                        @ 9 jdk.internal.util.Preconditions::checkIndex (18 bytes) (intrinsic)
                                      @ 35 jdk.internal.misc.Unsafe::putLongUnaligned (14 bytes) inline (hot)
                                        @ 7 jdk.internal.misc.Unsafe::convEndian (16 bytes) inline (hot)
                                          @ 12 java.lang.Long::reverseBytes (46 bytes) (intrinsic)
                                        @ 10 jdk.internal.misc.Unsafe::putLongUnaligned (157 bytes) (intrinsic)

      Now running replaying the compilation:
      $ java --enable-preview -cp /home/roland/panama-foreign/build/linux-x86_64-server-release/images/test/micro/benchmarks.jar -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid3697718_compid101.log -XX:+PrintCompilation -XX:+PrintInlining -XX:+ReplayIgnoreInitErrors
      ...
         1864 94 b 4 org.openjdk.bench.java.lang.foreign.MemorySegmentVsBits::byteVarHandle (37 bytes)
      $

      shows no inlining. Running without -XX:+ReplayIgnoreInitErrors causes the replay to fail with:
      Error while parsing line 364 at position 95: expected hidden class

      Failed on expected hidden class

            Unassigned Unassigned
            roland Roland Westrelin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: