JDK-8250675 : Vector API crashes on AVX512 machines with assert(eval_map.contains(n)) failed: absent
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-panama
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2020-07-28
  • Updated: 2020-07-29
  • Resolved: 2020-07-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-panamaResolved
Related Reports
Duplicate :  
Description
# Reproduce
The following reproducer was made from jdk/incubator/vector/Int64VectorTests.java
```
import jdk.incubator.vector.VectorSpecies;
import jdk.incubator.vector.VectorOperators;
import jdk.incubator.vector.IntVector;

public class Test {
    static final VectorSpecies<Integer> SPECIES =
                IntVector.SPECIES_64;
    static int[] a = new int[1024];
    static int[] b = new int[1024];
    static int[] r = new int[1024];

    static void AND_NOTInt64VectorTests() {
        for (int i = 0; i < a.length; i += SPECIES.length()) {
            IntVector av = IntVector.fromArray(SPECIES, a, i);
            IntVector bv = IntVector.fromArray(SPECIES, b, i);
            av.lanewise(VectorOperators.AND_NOT, bv).intoArray(r, i);
        }
    }

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

# Symptom
```
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (../src/hotspot/share/opto/compile.cpp:2505), pid=39131, tid=39143
#  assert(eval_map.contains(n)) failed: absent
#
# Problematic frame:
# V  [libjvm.so+0x930611]  eval_operand(Node*, ResourceHashtable<Node*, unsigned int, &(unsigned int primitive_hash<Node*>(Node* const&)), &(bool primitive_equals<Node*>(Node* const&, Node* const&)), 256u, (ResourceObj::allocation_type)1, (MemoryType)8>&)+0x81




Current CompileTask:
C2:   1160   69             Test::AND_NOTInt64VectorTests (62 bytes)

Stack: [0x00007f4bd563d000,0x00007f4bd573e000],  sp=0x00007f4bd5738940,  free space=1006k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x7ac0b1]  eval_operand(Node*, ResourceHashtable<Node*, unsigned int, &(unsigned int primitive_hash<Node*>(Node* const&)), &(bool primitive_equals<Node*>(Node* const&, Node* const&)), 256u, (ResourceObj::allocation_type)1, (MemoryType)8>&)+0x73
V  [libjvm.so+0x7ac17c]  eval_operands(Node*, unsigned int&, unsigned int&, unsigned int&, ResourceHashtable<Node*, unsigned int, &(unsigned int primitive_hash<Node*>(Node* const&)), &(bool primitive_equals<Node*>(Node* const&, Node* const&)), 256u, (ResourceObj::allocation_type)1, (MemoryType)8>&)+0x88
V  [libjvm.so+0x7ac444]  Compile::compute_truth_table(Unique_Node_List&, Unique_Node_List&)+0x1cc
V  [libjvm.so+0x7abf23]  Compile::xform_to_MacroLogicV(PhaseIterGVN&, TypeVect const*, Unique_Node_List&, Unique_Node_List&)+0x1bf
V  [libjvm.so+0x7acd1c]  Compile::process_logic_cone_root(PhaseIterGVN&, Node*, VectorSet&)+0x1e2
V  [libjvm.so+0x7aceac]  Compile::optimize_logic_cones(PhaseIterGVN&)+0x14a
V  [libjvm.so+0x7ab534]  Compile::Optimize()+0x10a4
V  [libjvm.so+0x7a3e7f]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1127
V  [libjvm.so+0x69aa1f]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x15b
V  [libjvm.so+0x7bf9ea]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x986
V  [libjvm.so+0x7be57d]  CompileBroker::compiler_thread_loop()+0x3dd
V  [libjvm.so+0x129e46d]  compiler_thread_entry(JavaThread*, Thread*)+0x69
V  [libjvm.so+0x1299595]  JavaThread::thread_main_inner()+0x14b
V  [libjvm.so+0x129943f]  JavaThread::run()+0x1a9
V  [libjvm.so+0x1295628]  Thread::call_run()+0x180
V  [libjvm.so+0xfbb60e]  thread_native_entry(Thread*)+0x1e4
```


# Fix
```
diff -r 9a45f5bf5f60 src/hotspot/share/opto/compile.cpp
--- a/src/hotspot/share/opto/compile.cpp        Fri Jul 24 01:06:45 2020 +0300
+++ b/src/hotspot/share/opto/compile.cpp        Tue Jul 28 21:09:10 2020 +0800
@@ -2510,6 +2510,12 @@
                           uint& func1, uint& func2, uint& func3,
                           ResourceHashtable<Node*,uint>& eval_map) {
     assert(is_vector_bitwise_op(n), "");
+
+    if (VectorNode::is_vector_bitwise_not_pattern(n)) {
+        func1 = eval_operand(n->in(VectorNode::is_all_ones_vector(n->in(1)) ? 2 : 1), eval_map);
+        return;
+    }
+
     func1 = eval_operand(n->in(1), eval_map);

     if (is_vector_binary_bitwise_op(n)) {
```
Comments
Will be fixed in https://bugs.openjdk.java.net/browse/JDK-8250745
29-07-2020