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

VM crash when generating ClassCastException in C1 compiled code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 11
    • hotspot
    • aarch64
    • linux

      Graal has a bug in rev. 079591ab18a5694a8ba5cf630ed4f76d3442fe21, where a ClassCastException is thrown in method org.graalvm.compiler.lir.aarch64.AArch64AtomicMove.AtomicReadAndAdd.emitCode. But instead of throwing the exception, the entire VM crashes.

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x0000ffff80213698, pid=26434, tid=26507
      #
      # JRE version: OpenJDK Runtime Environment (11.0) (build 11-labs+0-SNAPSHOT-20180607-130447)
      # Java VM: OpenJDK 64-Bit Server VM (11-labs+0-SNAPSHOT-20180607-130447, mixed mode, tiered, jvmci, jvmci compiler, compressed oops, g1 gc, linux-aarch64)
      # Problematic frame:
      # V [libjvm.so+0x7f0698] Klass::class_loader_and_module_name() const+0x138
      #
      # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      #
      # An error report file with more information is saved as:
      # /home/sanzinger/graal/graal/compiler/hs_err_pid26434.log


      Steps to reproduce on AArch64 with latest OpenJDK 11:

      git clone https://github.com/oracle/graal.git
      cd graal
      git checkout 079591ab18a5694a8ba5cf630ed4f76d3442fe21
      mx build
      mx vm -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI


      It seems that the C1 generated code for class jdk/vm/ci/code/ValueUtil.asRegisterValue is incorrect and leads to the VM crash.

      Following command throws the exception properly without a VM crash by excluding ValueUtil.asRegister from compilation:

      mx vm -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI -XX:CompileCommand=exclude,jdk/vm/ci/code/ValueUtil.asRegisterValue

      CompileCommand: exclude jdk/vm/ci/code/ValueUtil.asRegisterValue
      Bootstrapping JVMCI....................Thread[JVMCI CompilerThread17,9,system]: Compilation of org.graalvm.compiler.nodes.StructuredGraph.<init>(String, Resol
      vedJavaMethod, int, Assumptions, SpeculationLog, boolean, Graph$SourcePositionTracking, CompilationIdentifier, OptionValues, DebugContext, Cancellable, NodeSo
      urcePosition) failed: org.graalvm.compiler.debug.GraalError: java.lang.ClassCastException: jdk.internal.vm.compiler/org.graalvm.compiler.lir.ConstantValue can
      not be cast to jdk.internal.vm.ci/jdk.vm.ci.code.RegisterValue
              at lir instruction: B358@3698 org.graalvm.compiler.lir.aarch64.AArch64AtomicMove$AtomicReadAndAddOp r0|QWORD = ATOMIC_READ_AND_ADD (~addressValue: r1|
      QWORD[.], ~deltaValue: long[1|0x1]) {scratchValue1: r2|QWORD, scratchValue2: r3|QWORD} accessKind: QWORD
      [B0, B2, [..], B406, B197]
              at jdk.internal.vm.compiler/org.graalvm.compiler.lir.asm.CompilationResultBuilder.emitOp(CompilationResultBuilder.java:542)
              at jdk.internal.vm.compiler/org.graalvm.compiler.lir.asm.CompilationResultBuilder.emitBlock(CompilationResultBuilder.java:522)
      [...]

      [~aph] can you help out here?

            aph Andrew Haley
            sanzinger Stefan Anzinger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: