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

riscv: missing side effect for result in instruct vcount_positives

    XMLWordPrintable

Details

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

    Description

      JDK-8283364 replaces StringCoding.hasNegatives with countPositives.
      But the TEMP_DEF for result in vcount_positives was missing, without which result != tmp could not be guaranteed.
      If we add `assert_different_registers(result, tmp)` in `C2_MacroAssembler::count_positives_v`,
      JVM will complain assertion error for some test in hotspot and langtools when UseRVV is enabled.

      For example, on QEMU user mode with enabling RVV extension, the following jtreg tests commands will trigger assertion error:

      jtreg -javaoption:-XX:+UseRVV -Djdk.lang.Process.launchMechanism=VFORK -timeoutFactor:20 -jdk:fastdebug/install-fastdebug/jvm/openjdk-19 test/langtools/tools/sjavac/JavacOptionPrep.java

      ```
      javac: [-d, JTwork/classes/0/tools/sjavac/JavacOptionPrep.d, -sourcepath, test/langtools/tools/sjavac, -classpath, JTwork/classes/0/tools/sjavac/JavacOptionPrep.d, --add-exports=jdk.compiler/com.sun.tools.sjavac.options=ALL-UNNAMED, test/langtools/tools/sjavac/JavacOptionPrep.java]
      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/register.hpp:245
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (src/hotspot/share/asm/register.hpp:245), pid=15559, tid=15600
      # assert(regs[i] != regs[j]) failed: Multiple uses of register: c_rarg0
      # JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 19, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
      # Problematic frame:
      # V [libjvm.so+0x58f38a] C2_MacroAssembler::count_positives_v(RegisterImpl const*, RegisterImpl const*, RegisterImpl const*, RegisterImpl const*)+0x96
      ```
      With code base, test result for hotspot and langtools with RVV enabled:
      test_hotspot:
      applications/ctw/modules/java_base.java
      applications/ctw/modules/java_xml.java
      gc/metaspace/TestMetaspacePerfCounters.java

      test_langtools:
      Test results: passed: 4,228; failed: 73; error: 2

      After is patch, failed tests in hotspot and langtools are passed:
      test_langtools:
      Test results: passed: 4,305

      Attachments

        Issue Links

          Activity

            People

              fjiang Feilong Jiang
              fjiang Feilong Jiang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: