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

Vector API intrinsincs should not modify IR when bailing out

XMLWordPrintable

    • b13

      * Symptom
      ```
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/jvm/jdk/src/hotspot/share/opto/library_call.cpp:137), pid=95497, tid=95511
      # assert(ctrl == kit.control()) failed: Control flow was added although the intrinsic bailed out
      #
      # JRE version: OpenJDK Runtime Environment (17.0) (fastdebug build 17-internal+0-adhoc.jvm.jdk)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 17-internal+0-adhoc.jvm.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x111f975] LibraryIntrinsic::generate(JVMState*)+0x315
      #

      Current CompileTask:
      C2: 1094 219 b jdk.internal.vm.vector.VectorSupport::convert (39 bytes)

      Stack: [0x00007f50290f8000,0x00007f50291f9000], sp=0x00007f50291f3c70, free space=1007k
      Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x111f975] LibraryIntrinsic::generate(JVMState*)+0x315
      V [libjvm.so+0x7ea14e] CallGenerator::do_late_inline_helper()+0xabe
      V [libjvm.so+0x978395] Compile::inline_incrementally_one()+0x255
      V [libjvm.so+0x978817] Compile::inline_incrementally(PhaseIterGVN&)+0x197
      V [libjvm.so+0x9791bb] Compile::Optimize()+0x34b
      V [libjvm.so+0x97b974] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1864
      V [libjvm.so+0x7e23ba] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x10a
      V [libjvm.so+0x989d66] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xbf6
      V [libjvm.so+0x98a8f8] CompileBroker::compiler_thread_loop()+0x4b8
      V [libjvm.so+0x17d066a] JavaThread::thread_main_inner()+0x2fa
      V [libjvm.so+0x17d0987] JavaThread::run()+0x2b7
      V [libjvm.so+0x17d5448] Thread::call_run()+0xf8
      V [libjvm.so+0x13c45fe] thread_native_entry(Thread*)+0x10e
      ```

      * Reproducer
      Run with -XX:UseAVX=1
      ```
      import jdk.incubator.vector.*;
      import java.nio.ByteOrder;

      public class Test {
        static final VectorSpecies<Double> SPECIES256 = DoubleVector.SPECIES_256;
        static byte[] a = new byte[512];
        static byte[] r = new byte[512];

        static void test() {
          DoubleVector av = DoubleVector.fromByteArray(SPECIES256, a, 0, ByteOrder.BIG_ENDIAN);
          av.intoByteArray(r, 0, ByteOrder.BIG_ENDIAN);
        }

        public static void main(String[] args) {
          for (int i = 0; i < 10000; i++) {
            test();
          }
          System.out.println(r[0]);
        }
      }
      ```

            jiefu Jie Fu
            jiefu Jie Fu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: