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

C2 generates wrong code with -XX:-InlineNatives for java/lang/invoke/ClassSpecializer.findSpecies

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 11, 12, 13
    • Fix Version/s: 13
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This bug was found while we were developing our MIPS port of OpenJDK which can be triggered by the test case test/hotspot/jtreg/compiler/c1/Test8004051.java.

      - Reproduce:
      -----------------------------------------
      JDK=/home/fool/fujie/workspace/jdk/build/linux-x86_64-server-release/images/jdk

      cd /home/fool/fujie/workspace/jdk/test/hotspot/jtreg

      ${JDK}/bin/javac ./compiler/c1/Test8004051.java

      ${JDK}/bin/java \
        -Xcomp \
        -XX:-TieredCompilation \
        -XX:+UnlockDiagnosticVMOptions \
        -XX:-InlineNatives \
        -XX:CompileCommand=quiet \
        -XX:CompileCommand=compileonly,java/lang/invoke/ClassSpecializer.findSpecies \
        compiler.c1.Test8004051
      -----------------------------------------

      - Error
      -----------------------------------------
      Exception in thread "main" java.lang.ExceptionInInitializerError
      at java.base/java.lang.invoke.DirectMethodHandle.rebind(DirectMethodHandle.java:147)
      at java.base/java.lang.invoke.MethodHandles.dropArguments0(MethodHandles.java:3606)
      at java.base/java.lang.invoke.MethodHandles.dropArguments(MethodHandles.java:3676)
      at java.base/java.lang.invoke.StringConcatFactory$MethodHandleInlineCopyStrategy.generate(StringConcatFactory.java:1545)
      at java.base/java.lang.invoke.StringConcatFactory.generate(StringConcatFactory.java:772)
      at java.base/java.lang.invoke.StringConcatFactory.doStringConcat(StringConcatFactory.java:681)
      at java.base/java.lang.invoke.StringConcatFactory.makeConcatWithConstants(StringConcatFactory.java:597)
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:99)
      at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:259)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:249)
      at compiler.c1.Test8004051.fillPrimRect(Test8004051.java:53)
      at compiler.c1.Test8004051.main(Test8004051.java:38)
      Caused by: java.lang.ClassCastException: Cannot cast java.lang.Object to java.lang.invoke.BoundMethodHandle$SpeciesData
      at java.base/java.lang.Class.cast(Class.java:3613)
      at java.base/java.lang.invoke.ClassSpecializer.findSpecies(ClassSpecializer.java:202)
      at java.base/java.lang.invoke.ClassSpecializer.<init>(ClassSpecializer.java:127)
      at java.base/java.lang.invoke.BoundMethodHandle$Specializer.<init>(BoundMethodHandle.java:380)
      at java.base/java.lang.invoke.BoundMethodHandle.<clinit>(BoundMethodHandle.java:359)
      ... 13 more
      -----------------------------------------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thartmann Tobias Hartmann
              Reporter:
              jiefu Jie Fu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: