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

Segfault during deoptimization of C2-compiled code

XMLWordPrintable

    • b07
    • 22
    • b06

        Execution of the attached test with -Xcomp on JDK 22 and 23 leads to a segfault:

        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGSEGV (0xb) at pc=0x00007f04423fe14f, pid=749112, tid=749113
        #
        # JRE version: OpenJDK Runtime Environment (23.0+4) (build 23-ea+4-185)
        # Java VM: OpenJDK 64-Bit Server VM (23-ea+4-185, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0xdcf14f] StackValue::create_stack_value_from_oop_location(stackChunkOopDesc*, void*)+0x12f

        The stack is:

        Stack: [0x00007f04413d5000,0x00007f04414d6000], sp=0x00007f04414d2120, free space=1012k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0xdcf14f] StackValue::create_stack_value_from_oop_location(stackChunkOopDesc*, void*)+0x12f
        V [libjvm.so+0xdcfa97] StackValue* StackValue::create_stack_value<RegisterMap>(ScopeValue*, unsigned char*, RegisterMap const*)+0x1d7
        V [libjvm.so+0xf389f7] compiledVFrame::monitors() const+0x1e7
        V [libjvm.so+0x6aa4fe] Deoptimization::fetch_unroll_info_helper(JavaThread*, int)+0xd6e
        V [libjvm.so+0x6aa782] Deoptimization::uncommon_trap(JavaThread*, int, int)+0x32
        Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
        v ~UncommonTrapBlob 0x00007f042c1015a1
        J 1201 c2 Test.method1()LTest$Class0; (87 bytes) @ 0x00007f042c8dd9a0 [0x00007f042c8dd820+0x0000000000000180]
        J 1021 c1 Test.main([Ljava/lang/String;)V (24 bytes) @ 0x00007f0424dc26ec [0x00007f0424dc2660+0x000000000000008c]
        v ~StubRoutines::call_stub 0x00007f042c0aacc6

        If I'm reading this correctly, this is during deoptimization of a C2-compiled method.

        To run:
        rm -f *.class && jdk-22/bin/javac Test.java && jdk-22/bin/java -Xcomp Test
        or
        rm -f *.class && jdk-23/bin/javac Test.java && jdk-23/bin/java -Xcomp Test

        Tested JDK versions:
        openjdk version "22-ea" 2024-03-19
        OpenJDK Runtime Environment (build 22-ea+30-2287)
        OpenJDK 64-Bit Server VM (build 22-ea+30-2287, mixed mode, sharing)
        from https://jdk.java.net/22/
        and
        openjdk version "23-ea" 2024-09-17
        OpenJDK Runtime Environment (build 23-ea+4-185)
        OpenJDK 64-Bit Server VM (build 23-ea+4-185, mixed mode, sharing)
        from https://jdk.java.net/23/.

        Doesn't seem to happen with JDK 21. Test code and a sample hs_err dump attached.

              cslucas Cesar Soares
              gbarany Gergö Barany
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: