Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/escapeAnalysis/TestIdealAllocShape.java
41152 views
1
/*
2
* Copyright (c) 2020, 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 8242895
27
* @summary full loop unroll before EA creates phis between allocs projs and init
28
* @run main/othervm -Xbatch -XX:CompileCommand=dontinline,*DataA.m1 compiler.escapeAnalysis.TestIdealAllocShape
29
*/
30
31
package compiler.escapeAnalysis;
32
33
public class TestIdealAllocShape {
34
static volatile DataA f1;
35
36
static class DataA {
37
DataA f1;
38
DataA(DataA p1) {
39
this.f1 = p1;
40
}
41
public void m1() {}
42
}
43
44
public static DataA test1() {
45
DataA l1 = new DataA(null);
46
for (int i=0; i<2; i++) {
47
try {
48
return new DataA(l1); // l1 is a GlobalEscape. // control break.
49
} catch (Exception e) {
50
}
51
}
52
return null;
53
}
54
55
public static DataA test2() {
56
DataA l1 = new DataA(null);
57
for (int i=0; i<2; i++) {
58
try {
59
f1 = new DataA(l1); // l1 is a GlobalEscape.
60
break; // control break.
61
} catch (Exception e) {
62
}
63
}
64
synchronized(l1) { // elided sync
65
l1.m1();
66
}
67
return null;
68
}
69
70
public static void main(String argv[]) {
71
72
for (int i=0; i<20000; i++) {
73
TestIdealAllocShape.test1();
74
}
75
76
for (int i=0; i<20000; i++) {
77
TestIdealAllocShape.test2();
78
}
79
}
80
}
81
82