Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/loopopts/PeelingAndLoopStripMining.java
41152 views
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
* @test
26
* @bug 8229994
27
* @summary Tests dominance in PhaseIdealLoop::get_early_ctrl_for_expensive() if an expensive SqrtD node is peeled.
28
*
29
* @run main/othervm -Xbatch -XX:-TieredCompilation
30
* -XX:CompileCommand=compileonly,compiler.loopopts.PeelingAndLoopStripMining::*
31
* compiler.loopopts.PeelingAndLoopStripMining
32
*/
33
34
package compiler.loopopts;
35
36
public class PeelingAndLoopStripMining {
37
38
static double dFld = 3.3;
39
40
public void test(int k) {
41
for (int i = 1; i < 100; i++) {
42
// Loop invariant check triggers loop peeling
43
if (k == 300) {
44
return;
45
}
46
47
/*
48
* sqrtAdd() is inlined which contains an expensive node SqrtD with a control input from the above IfTrue node 'ifT'
49
* (flipped in IR, i.e. when not returning). PhaseIdealLoop::peeled_dom_test_elim() will change the control input
50
* of SqrtD to the peeled IfTrue node 'pifT' of 'ifT' and test if 'pifT' is on the idom chain starting from 'ifT'.
51
* This failed previously because the new loop entry from the peeled iteration was always set as idom of the
52
* CountedLoop node and not of the OuterStripMinedLoop node if present. Thus, 'pifT' was not found on the idom chain
53
* starting from 'ifT' resulting in a bad graph assertion failure in PhaseIdealLoop::get_early_ctrl_for_expensive().
54
*/
55
dFld = sqrtAdd(i);
56
}
57
}
58
59
public static void main(String[] strArr) {
60
PeelingAndLoopStripMining _instance = new SubClass();
61
for (int i = 0; i < 10000; i++ ) {
62
_instance.test(12);
63
}
64
65
_instance = new PeelingAndLoopStripMining();
66
for (int i = 0; i < 10000; i++ ) {
67
_instance.test(300);
68
}
69
for (int i = 0; i < 10000; i++ ) {
70
_instance.test(45);
71
}
72
}
73
74
public double sqrtAdd(int i) {
75
return 1.0 + Math.sqrt(i);
76
}
77
}
78
79
class SubClass extends PeelingAndLoopStripMining {
80
public double sqrtAdd(int i) {
81
return 2.0 + Math.sqrt(i);
82
}
83
}
84
85
86