-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8296412: Special case infinite loops with unmerged backedges in Ideal…
…LoopTree::check_safepts Backport-of: da38d43fcc640ea9852db6c7c23817dcef7080d5
- Loading branch information
Showing
3 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
test/hotspot/jtreg/compiler/loopopts/TestInfiniteLoopWithUnmergedBackedges.jasm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
/* | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
super public class TestInfiniteLoopWithUnmergedBackedges | ||
{ | ||
public Method "<init>":"()V" | ||
stack 2 locals 1 | ||
{ | ||
aload_0; | ||
invokespecial Method java/lang/Object."<init>":"()V"; | ||
return; | ||
} | ||
static Method test_001:"(IIIII)V" | ||
stack 5 locals 10 | ||
{ | ||
iload_0; | ||
ifgt LOOP; | ||
// below is dominated by the one above | ||
iload_0; | ||
ifle BACK; | ||
goto HEAD; | ||
HEAD: | ||
iload_3; | ||
ifeq BACK; | ||
BACK: | ||
goto HEAD; | ||
LOOP: | ||
iload_1; | ||
iflt LOOP; | ||
iload_2; | ||
iflt LOOP; | ||
return; | ||
} | ||
static Method test_002:"(IIIII)V" | ||
stack 5 locals 30 | ||
{ | ||
iload_0; | ||
ifgt LOOP; | ||
|
||
iconst_0; | ||
istore 9; | ||
|
||
goto HEAD; | ||
TAIL: | ||
iload_3; | ||
iload 9; | ||
if_icmpeq HEAD; | ||
iinc 9, 1; | ||
HEAD: | ||
goto TAIL; | ||
LOOP: | ||
iload_1; | ||
iflt LOOP; | ||
iload_2; | ||
iflt LOOP; | ||
return; | ||
} | ||
static Method test_003:"(IIIII)I" | ||
stack 5 locals 30 | ||
{ | ||
iload_0; | ||
ifgt SKIP; | ||
|
||
iconst_0; | ||
istore 9; | ||
|
||
goto HEAD; | ||
TAIL: | ||
iload_3; | ||
iload 9; | ||
if_icmpeq HEAD; | ||
iinc 9, 1; | ||
// Two paths lead to HEAD, so we have an inner and outer loop | ||
// But no SafePoint is placed here, because we go forward in bci | ||
HEAD: | ||
// SafePoint is placed here, because we go from here back in bci | ||
goto TAIL; | ||
|
||
SKIP: | ||
iconst_0; | ||
istore 8; | ||
iconst_0; | ||
istore 9; | ||
// loop with two backedges, which calls | ||
// merge_many_backedges and then recomputes | ||
// build_loop_tree | ||
LOOP: | ||
iinc 9, 1; | ||
iinc 8, -1; | ||
iload 9; | ||
ldc 7; | ||
irem; | ||
ifeq LOOP; | ||
iload 9; | ||
ldc 10001; | ||
if_icmple LOOP; | ||
iload 8; | ||
ireturn; | ||
} | ||
static Method test_004:"(IIIII)I" | ||
stack 5 locals 30 | ||
{ | ||
iload_0; | ||
ifgt SKIP; | ||
|
||
iconst_0; | ||
istore 9; | ||
|
||
goto HEAD; | ||
TAIL: | ||
iload_3; | ||
iload 9; | ||
if_icmpeq HEAD; | ||
iinc 9, 1; | ||
iload 9; | ||
ldc 10001; | ||
if_icmpeq HEAD; // a second one | ||
iinc 9, 1; | ||
HEAD: | ||
goto TAIL; | ||
|
||
SKIP: | ||
iconst_0; | ||
istore 8; | ||
iconst_0; | ||
istore 9; | ||
LOOP: | ||
iinc 9, 1; | ||
iinc 8, -1; | ||
iload 9; | ||
ldc 7; | ||
irem; | ||
ifeq LOOP; | ||
iload 9; | ||
ldc 10001; | ||
if_icmple LOOP; | ||
iload 8; | ||
ireturn; | ||
} | ||
static Method test_005:"(IIIII)I" | ||
stack 5 locals 30 | ||
{ | ||
iload_0; | ||
ifgt SKIP; | ||
|
||
iconst_0; | ||
istore 9; | ||
|
||
goto HEAD; | ||
TAIL: | ||
iload_3; | ||
iload 9; | ||
if_icmpeq HEAD; | ||
iinc 9, 1; | ||
iload 9; | ||
ldc 10001; | ||
if_icmpeq HEAD; // a second one | ||
iinc 9, 1; | ||
HEAD: | ||
goto TAIL; | ||
|
||
SKIP: | ||
iconst_0; | ||
istore 8; | ||
iconst_0; | ||
istore 9; | ||
LOOP: | ||
iinc 9, 1; | ||
iinc 8, -1; | ||
iload 9; | ||
ldc 7; | ||
irem; | ||
ifeq LOOP; | ||
iload 9; | ||
ldc 10001; | ||
if_icmple LOOP; | ||
iload 8; | ||
ireturn; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
test/hotspot/jtreg/compiler/loopopts/TestInfiniteLoopWithUnmergedBackedgesMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8296412 | ||
* @compile TestInfiniteLoopWithUnmergedBackedges.jasm | ||
* @summary Infinite loops may not have the backedges merged, before we call IdealLoopTree::check_safepts | ||
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:-LoopUnswitching | ||
* -XX:CompileCommand=compileonly,TestInfiniteLoopWithUnmergedBackedges::test* | ||
* TestInfiniteLoopWithUnmergedBackedgesMain | ||
*/ | ||
|
||
public class TestInfiniteLoopWithUnmergedBackedgesMain { | ||
public static void main (String[] args) { | ||
TestInfiniteLoopWithUnmergedBackedges.test_001(1, 0, 0, 0, 0); | ||
TestInfiniteLoopWithUnmergedBackedges.test_002(1, 0, 0, 0, 0); | ||
TestInfiniteLoopWithUnmergedBackedges.test_003(1, 0, 0, 0, 0); | ||
TestInfiniteLoopWithUnmergedBackedges.test_004(1, 0, 0, 0, 0); | ||
} | ||
} |
ee63f83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review
Issues