Skip to content

Commit 1de5bf1

Browse files
committed
8314106: C2: assert(is_valid()) failed: must be valid after JDK-8305636
Reviewed-by: thartmann, kvn
1 parent 5c91622 commit 1de5bf1

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

src/hotspot/share/opto/loopPredicate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,8 @@ void PhaseIdealLoop::clone_loop_predication_predicates_to_unswitched_loop(IdealL
445445
Deoptimization::DeoptReason reason,
446446
IfProjNode*& iffast_pred,
447447
IfProjNode*& ifslow_pred) {
448-
if (predicate_block->is_non_empty()) {
448+
if (predicate_block->has_parse_predicate()) {
449449
clone_parse_predicate_to_unswitched_loops(predicate_block, reason, iffast_pred, ifslow_pred);
450-
451450
clone_assertion_predicates_to_unswitched_loop(loop, old_new, reason, predicate_block->parse_predicate_success_proj(),
452451
iffast_pred, ifslow_pred);
453452
}
@@ -456,6 +455,7 @@ void PhaseIdealLoop::clone_loop_predication_predicates_to_unswitched_loop(IdealL
456455
void PhaseIdealLoop::clone_parse_predicate_to_unswitched_loops(const PredicateBlock* predicate_block,
457456
Deoptimization::DeoptReason reason,
458457
IfProjNode*& iffast_pred, IfProjNode*& ifslow_pred) {
458+
assert(predicate_block->has_parse_predicate(), "must have parse predicate");
459459
ParsePredicateSuccessProj* parse_predicate_proj = predicate_block->parse_predicate_success_proj();
460460
iffast_pred = clone_parse_predicate_to_unswitched_loop(parse_predicate_proj, iffast_pred, reason, false);
461461
check_cloned_parse_predicate_for_unswitching(iffast_pred, true);
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2023, 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 8314106
28+
* @summary Test that we do not try to copy a Parse Predicate to an unswitched loop if they do not exist anymore.
29+
* @run main/othervm -Xbatch -XX:-TieredCompilation
30+
* -XX:CompileCommand=compileonly,compiler.predicates.TestLoopUnswitchingWithoutParsePredicates::*
31+
* compiler.predicates.TestLoopUnswitchingWithoutParsePredicates
32+
*/
33+
34+
package compiler.predicates;
35+
36+
public class TestLoopUnswitchingWithoutParsePredicates {
37+
static byte byFld;
38+
static byte byArrFld[] = new byte[400];
39+
40+
public static void main(String[] strArr) {
41+
for (int i = 0; i < 1000;i++) {
42+
test(i);
43+
}
44+
}
45+
46+
static void test(int i2) {
47+
int i10, i11 = 0, i12, i13, i14;
48+
double dArr[] = new double[400];
49+
for (i10 = 7; i10 < 307; i10++) {
50+
byArrFld[i10] = 58;
51+
for (i12 = 1; i12 < 3; i12++) {
52+
for (i14 = 1; i14 < 2; i14++) {
53+
byFld &= i14;
54+
switch (i2) {
55+
case 4:
56+
dArr[1] = i14;
57+
case 2:
58+
i13 = i11;
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+

0 commit comments

Comments
 (0)