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

C2 EA fails with "missing memory path" when encountering unsafe_arraycopy stub call

    XMLWordPrintable

Details

    • b14
    • 18
    • b06

    Backports

      Description

        When running the benchmark from the subject line (attached), I'm seeing the following crash:

        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (h:\openjdk\git-jdk2\src\hotspot\share\opto\escape.cpp:4029), pid=12256, tid=8644
        # assert(false) failed: EA: missing memory path
        #
        # JRE version: OpenJDK Runtime Environment (22.0) (fastdebug build 22-internal-adhoc.jorn.git-jdk2)
        # Java VM: OpenJDK 64-Bit Server VM (fastdebug 22-internal-adhoc.jorn.git-jdk2, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
        # Core dump will be written. Default location: H:\openjdk\git-jdk2\make\hs_err_pid12256.mdmp
        #
        # If you would like to submit a bug report, please visit:
        # https://bugreport.java.com/bugreport/crash.jsp
        #

        With the latest master branch from the openjdk/jdk repo. It has the following stack trace:

        Current thread (0x00000271b0168ca0): JavaThread "C2 CompilerThread4" daemon [_thread_in_native, id=8644, stack(0x0000007f41700000,0x0000007f41800000) (1024K)]


        Current CompileTask:
        C2: 585 776 % 4 org.openjdk.bench.java.lang.foreign.jmh_generated.MemorySegmentCopyUnsafe_panama_jmhTest::panama_avgt_jmhStub @ 13 (52 bytes)

        Stack: [0x0000007f41700000,0x0000007f41800000]
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [jvm.dll+0xc81a01] os::win32::platform_print_native_stack+0x101 (os_windows_x86.cpp:236)
        V [jvm.dll+0xfcef7d] VMError::report+0x147d (vmError.cpp:1000)
        V [jvm.dll+0xfd13c5] VMError::report_and_die+0x645 (vmError.cpp:1814)
        V [jvm.dll+0xfd1ae4] VMError::report_and_die+0x64 (vmError.cpp:1579)
        V [jvm.dll+0x553dbb] report_vm_error+0x5b (debug.cpp:191)
        V [jvm.dll+0x624cbc] ConnectionGraph::split_unique_types+0x2a1c (escape.cpp:4029)
        V [jvm.dll+0x617060] ConnectionGraph::compute_escape+0x13a0 (escape.cpp:381)
        V [jvm.dll+0x61819e] ConnectionGraph::do_analysis+0xae (escape.cpp:116)
        V [jvm.dll+0x4dd63f] Compile::Optimize+0x67f (compile.cpp:2315)
        V [jvm.dll+0x4db1c5] Compile::Compile+0x11d5 (compile.cpp:855)
        V [jvm.dll+0x3eff8b] C2Compiler::compile_method+0x13b (c2compiler.cpp:122)
        V [jvm.dll+0x4f6da6] CompileBroker::invoke_compiler_on_method+0x846 (compileBroker.cpp:2284)
        V [jvm.dll+0x4f417c] CompileBroker::compiler_thread_loop+0x31c (compileBroker.cpp:1943)
        V [jvm.dll+0x801f79] JavaThread::thread_main_inner+0x279 (javaThread.cpp:721)
        V [jvm.dll+0xf33a17] Thread::call_run+0x1b7 (thread.cpp:225)
        V [jvm.dll+0xc7f462] os::win32::thread_native_entry+0xa2 (os_windows.cpp:547)
        C [ucrtbase.dll+0x29363] (no source info available)
        C [KERNEL32.DLL+0x1257d] (no source info available)
        C [ntdll.dll+0x5aa68] (no source info available)

        I've tried creating a standalone reproducer without success This code does not use any novel compiler intrinsics. It is largely plain Java code but it contains a call to Unsafe::copyMemory and accesses to off-heap memory. I've also tried disabling inlining of the benchmark method and that makes the crash go away, there may be a bad interaction between the JMH wrapper and the benchmark code. FWIW, running with '-Djmh.blackhole.autoDetect=false' does not fix the crash. JHM version is the latest 1.38 (built from source, but I've reproduced with 1.34 as well)

        I can reliably reproduce the crash.


        Additional output before the crash:
        225 StoreB === 360 752 234 327 [[ 118 ]] @rawptr:BotPTR, idx=Raw; Memory: @rawptr:BotPTR, idx=Raw; !jvms: Unsafe::copyMemory @ bci:29 (line 806) ScopedMemoryAccess::copyMemoryInternal @ bci:28 (line 147) ScopedMemoryAccess::copyMemory @ bci:12 (line 129) AbstractMemorySegmentImpl::copy @ bci:197 (line 619) MemorySegment::copy @ bci:33 (line 1341) MemorySegment::copy @ bci:13 (line 1288) MemorySegment::copyFrom @ bci:10 (line 812) MemorySegmentCopyUnsafe::panama @ bci:44 (line 66)
         118 CallLeafNoFP === 360 1 225 31 1 (226 227 134 1 ) [[ 62 233 ]] # unsafe_arraycopy void ( NotNull *+bot, NotNull *+bot, long, half ) !jvms: Unsafe::copyMemory @ bci:29 (line 806) ScopedMemoryAccess::copyMemoryInternal @ bci:28 (line 147) ScopedMemoryAccess::copyMemory @ bci:12 (line 129) AbstractMemorySegmentImpl::copy @ bci:197 (line 619) MemorySegment::copy @ bci:33 (line 1341) MemorySegment::copy @ bci:13 (line 1288) MemorySegment::copyFrom @ bci:10 (line 812) MemorySegmentCopyUnsafe::panama @ bci:44 (line 66)

        Attachments

          1. 8316756.patch
            1 kB
          2. hs_err_pid53358.log
            83 kB
          3. MemorySegmentCopyUnsafe.java
            3 kB
          4. Test.java
            2 kB

          Issue Links

            Activity

              People

                tholenstein Tobias Holenstein
                jvernee Jorn Vernee
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: