Skip to content

Commit 502fa3e

Browse files
committed
8296912: C2: CreateExNode::Identity fails with assert(i < _max) failed: oob: i=1, _max=1
Reviewed-by: chagedorn, kvn
1 parent 5795c76 commit 502fa3e

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/hotspot/share/opto/cfgnode.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -2782,9 +2782,8 @@ Node* CreateExNode::Identity(PhaseGVN* phase) {
27822782
// exception oop through.
27832783
CallNode *call = in(1)->in(0)->as_Call();
27842784

2785-
return ( in(0)->is_CatchProj() && in(0)->in(0)->in(1) == in(1) )
2786-
? this
2787-
: call->in(TypeFunc::Parms);
2785+
return (in(0)->is_CatchProj() && in(0)->in(0)->is_Catch() &&
2786+
in(0)->in(0)->in(1) == in(1)) ? this : call->in(TypeFunc::Parms);
27882787
}
27892788

27902789
//=============================================================================

test/hotspot/jtreg/compiler/c2/TestDeadDataLoop.java

+27-4
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,20 @@
2323

2424
/*
2525
* @test
26-
* @bug 8284358
26+
* @bug 8284358 8296912
2727
* @summary An unreachable loop is not removed, leading to a broken graph.
2828
* @requires vm.compiler2.enabled
2929
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=1448005075
30-
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
30+
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3131
* compiler.c2.TestDeadDataLoop
3232
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=1922737097
33-
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
33+
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
34+
* compiler.c2.TestDeadDataLoop
35+
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=2472844645
36+
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3437
* compiler.c2.TestDeadDataLoop
3538
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN
36-
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
39+
* -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3740
* compiler.c2.TestDeadDataLoop
3841
*/
3942

@@ -216,10 +219,29 @@ static void test10() {
216219
}
217220
}
218221

222+
static long l;
223+
224+
static void test11(boolean never) {
225+
float f = 1;
226+
boolean b;
227+
for (int i = 0; i < 5; ++i) {
228+
b = (never || l < 0);
229+
l = notInlined2();
230+
if (!never) {
231+
f += i;
232+
}
233+
}
234+
l += f;
235+
}
236+
219237
public static boolean notInlined() {
220238
return false;
221239
}
222240

241+
public static int notInlined2() {
242+
return 42;
243+
}
244+
223245
public static void main(String[] args) {
224246
// Make sure classes are initialized
225247
Integer i = 42;
@@ -234,6 +256,7 @@ public static void main(String[] args) {
234256
test8();
235257
test9();
236258
test10();
259+
test11(false);
237260
}
238261
}
239262

0 commit comments

Comments
 (0)