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

riscv: should not allocate special register for temp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 19
    • hotspot
    • b19
    • riscv
    • linux

        Following testcases fail with -XX:+UseRVV after JDK-8284863

        test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java
        test/hotspot/jtreg/compiler/vectorapi/VectorCastShape64Test.java
        test/hotspot/jtreg/compiler/vectorapi/VectorMaskCastTest.java
        test/hotspot/jtreg/compiler/vectorapi/VectorMaskLoadStoreTest.java

        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGSEGV (0xb) at pc=0x000000400214b604, pid=47220, tid=47271
        #
        # JRE version: OpenJDK Runtime Environment (19.0) (build 19-internal-adhoc.zhuyanhong.jdk)
        # Java VM: OpenJDK 64-Bit Server VM (19-internal-adhoc.zhuyanhong.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
        # Problematic frame:
        # V [libjvm.so+0x7de604] LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, JavaThread*)+0x440
        #
        # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/zhuyanhong/jdk/JTwork/compiler/vectorapi/VectorMaskCastTest/core.47220)
        #

        The root cause of this problem is that special registers were allocated as temporary registers in C2.
        We add `guarantee(tmp != x27, "Use Special Register x27");` in `C2_MacroAssembler::count_positives_v`, and the error log turns out x27 is allocated for temp:

        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (c2_MacroAssembler_riscv.cpp:1546), pid=45749, tid=45834
        # guarantee(tmp != x27) failed: Use Special Register x27
        #
        # JRE version: OpenJDK Runtime Environment (19.0) (build 19-internal-adhoc.zhuyanhong.jdk)
        # Java VM: OpenJDK 64-Bit Server VM (19-internal-adhoc.zhuyanhong.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
        # Problematic frame:
        # V [libjvm.so+0x36fdfc] C2_MacroAssembler::count_positives_v(RegisterImpl const*, RegisterImpl const*, RegisterImpl const*, RegisterImpl const*)+0x23a

        x27 is used for heapbase, special registers should not allocated as a tmp register. Similar issue also exists in several other C2 instructs for riscv.

              yzhu Yanhong Zhu
              yzhu Yanhong Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: