Skip to content

Commit b7b437d

Browse files
author
Vladimir Ivanov
committed
8356453: C2: assert(!vbox->is_Phi()) during vector box expansion
Reviewed-by: thartmann, kvn
1 parent e4ecda2 commit b7b437d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/hotspot/share/opto/vector.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ void PhaseVector::optimize_vector_boxes() {
4444

4545
C->igvn_worklist()->ensure_empty(); // should be done with igvn
4646

47+
if (StressMacroExpansion) {
48+
C->shuffle_macro_nodes();
49+
}
50+
4751
expand_vunbox_nodes();
4852
scalarize_vbox_nodes();
4953

@@ -311,7 +315,7 @@ Node* PhaseVector::expand_vbox_node_helper(Node* vbox,
311315
VectorSet &visited) {
312316
// JDK-8304948 shows an example that there may be a cycle in the graph.
313317
if (visited.test_set(vbox->_idx)) {
314-
assert(vbox->is_Phi(), "should be phi");
318+
assert(vbox->is_Phi() || vbox->is_CheckCastPP(), "either phi or expanded");
315319
return vbox; // already visited
316320
}
317321

@@ -362,7 +366,7 @@ Node* PhaseVector::expand_vbox_node_helper(Node* vbox,
362366
return C->initial_gvn()->transform(vbox);
363367
}
364368

365-
assert(!vbox->is_Phi(), "should be expanded");
369+
assert(vbox->is_CheckCastPP(), "should be expanded");
366370
// TODO: assert that expanded vbox is initialized with the same value (vect).
367371
return vbox; // already expanded
368372
}

test/hotspot/jtreg/compiler/vectorapi/VectorBoxExpandTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class VectorBoxExpandTest {
4141

4242
private static int[] iarr = new int[ARR_LEN];
4343
private static IntVector g;
44+
private static int acc = 0;
4445

4546
// C2 would generate IR graph like below:
4647
//
@@ -86,10 +87,14 @@ private static void test() {
8687

8788
for (int ic = 0; ic < NUM_ITER; ic++) {
8889
for (int i = 0; i < iarr.length; i++) {
90+
acc += System.identityHashCode(a);
8991
a = a.add(a);
92+
acc += System.identityHashCode(a);
9093
}
9194
}
9295
g = a;
96+
acc += System.identityHashCode(a);
97+
9398
}
9499

95100
public static void main(String[] args) {

0 commit comments

Comments
 (0)