Skip to content

Commit 672fa8b

Browse files
committed
8228888: C2 compilation fails with assert "m has strange control"
Weakened too strong assert. Reviewed-by: kvn, roland
1 parent 792a6d1 commit 672fa8b

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
lines changed

src/hotspot/share/opto/loopopts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ Node *PhaseIdealLoop::has_local_phi_input( Node *n ) {
324324
}
325325
return NULL;
326326
}
327-
assert(m->is_Phi() || is_dominator(get_ctrl(m), n_ctrl), "m has strange control");
327+
assert(n->is_Phi() || m->is_Phi() || is_dominator(get_ctrl(m), n_ctrl), "m has strange control");
328328
}
329329

330330
return n_ctrl;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*
23+
*/
24+
25+
super public class compiler/loopopts/StrangeControl
26+
version 51:0
27+
{
28+
29+
static Field field:"I";
30+
31+
public static Method test:"(I)V"
32+
stack 2 locals 2
33+
{
34+
iconst_0;
35+
istore 1;
36+
L1: stack_frame_type append;
37+
locals_map int;
38+
iinc 1, 1;
39+
iload 1;
40+
iconst_2;
41+
if_icmple L1;
42+
L2: stack_frame_type same;
43+
iload_0;
44+
putstatic Field field:"I";
45+
goto L1;
46+
}
47+
48+
} // end Class StrangeControl
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*
23+
*/
24+
25+
/*
26+
* @test
27+
* @bug 8228888
28+
* @summary Test PhaseIdealLoop::has_local_phi_input() with phi input with non-dominating control.
29+
* @compile StrangeControl.jasm
30+
* @run main/othervm -Xbatch -XX:CompileCommand=inline,compiler.loopopts.StrangeControl::test
31+
* compiler.loopopts.TestStrangeControl
32+
*/
33+
34+
package compiler.loopopts;
35+
36+
public class TestStrangeControl {
37+
38+
public static void main(String[] args) throws Exception {
39+
Thread thread = new Thread() {
40+
public void run() {
41+
// Run this in an own thread because it's basically an endless loop
42+
StrangeControl.test(42);
43+
}
44+
};
45+
thread.start();
46+
// Give thread executing strange control loop enough time to trigger OSR compilation
47+
Thread.sleep(4000);
48+
}
49+
}

0 commit comments

Comments
 (0)