Assertion: “assert(regs[i] != regs[j]) failed: Multiple uses of register: xmm0”

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      - Operating system: Linux
      - Compiler/toolchain: GCC 9.5
      - Source commit: a8784a04081a11a41fe0e3bd8ab9fba6af2d3d4d (tag: jdk-17.0.18+4, branch: master)
      - Build type: fastdebug
      - Coverage: enabled (built with --enable-coverage)
      - Build environment: Linux, compiled from source with GCC 9.5

      A DESCRIPTION OF THE PROBLEM :
      - A small Vector API program triggers a C2 fastdebug assertion on x86_64 when run with -Xcomp -Xbatch.
      - The failure occurs while compiling vector operations that:
        - load a FloatVector from an array with a non-zero offset,
        - perform sub/min operations,
        - use reinterpretAsFloats(),
        - and store into an array using intoArray with a VectorMask created from a long literal.
      - Expected behavior: the program prints “Hello World”.
      - Actual behavior: JVM aborts with an internal error:
        - assert(regs[i] != regs[j]) failed: Multiple uses of register: xmm0
        - Location: src/hotspot/share/asm/register.hpp:109
        - A hs_err log and a compiler replay file are generated.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Compile:
      $ /path/to/jdk/bin/javac --add-modules jdk.incubator.vector Test.java

      2) Run with C2-only compilation:
      $ /path/to/jdk/bin/java --add-modules jdk.incubator.vector -Xcomp -Xbatch Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Hello World
      ACTUAL -
      # A fatal error has been detected by the Java Runtime Environment:
      # Internal Error (.../src/hotspot/share/asm/register.hpp:109)
      # assert(regs[i] != regs[j]) failed: Multiple uses of register: xmm0
      ...
      # An error report file is saved as: hs_err_pidXXXXX.log
      # Compiler replay data is saved as: replay_pidXXXXX.log

      ---------- BEGIN SOURCE ----------
      import jdk.incubator.vector.*;

      public class Test {
          public static final int N = 128;

          public static float[] floatTestArray = new float[96];

          public static long vMeth_check_sum = 0;

          public static void vMeth() {
              float[] ffarr1 = new float[96];
              float[] ffarr5 = new float[96];
              FloatVector ffvec1 = null;
              for (int tmpVar = 0; tmpVar < 96; tmpVar++)
                  ffarr1[tmpVar] = 4467.577148f + (float) (tmpVar % 8);
              for (int tmpVar = 0; tmpVar < 96; tmpVar++)
                  ffarr5[tmpVar] = 4164.570313f + (float) (tmpVar % 8);

              ffvec1 = FloatVector.fromArray(FloatVector.SPECIES_PREFERRED, ffarr5, 35);
              ffvec1 = ffvec1.sub(ffvec1);
              ffvec1 = ffvec1.reinterpretAsFloats().reinterpretAsFloats();
              ffvec1.intoArray(floatTestArray, 35);
              try {
                  ffvec1 = FloatVector.fromArray(FloatVector.SPECIES_PREFERRED, ffarr1, 1);
                  ffvec1 = ffvec1.min(ffvec1);
                  ffvec1.intoArray(
                          floatTestArray, 1, VectorMask.fromLong(FloatVector.SPECIES_PREFERRED, 0xFF));
              } catch (ArithmeticException ex) {
              } finally {
              }
          }

          public static void main(String[] strArr) {
              for (int i = 0; i < 10; i++) {
                  vMeth();
              }
              System.out.println("Hello World");
          }
      }

      ---------- END SOURCE ----------

            Assignee:
            Tobias Hartmann
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: