Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/escapeAnalysis/TestEABadMergeMem.java
41152 views
1
/*
2
* Copyright (c) 2015, 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 8134031
27
* @summary Bad rewiring of memory edges when we split unique types during EA
28
*
29
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
30
* -XX:CompileCommand=dontinline,compiler.escapeAnalysis.TestEABadMergeMem::m_notinlined
31
* compiler.escapeAnalysis.TestEABadMergeMem
32
*/
33
34
package compiler.escapeAnalysis;
35
36
public class TestEABadMergeMem {
37
38
static class Box {
39
int i;
40
}
41
42
static void m_notinlined() {
43
}
44
45
static float dummy1;
46
static float dummy2;
47
48
static int test(Box a, Box c, int i, int j, int k, boolean flag1, boolean flag2) {
49
Box b = new Box(); // non escaping
50
a.i = i;
51
b.i = j;
52
c.i = k;
53
54
m_notinlined();
55
56
boolean flag3 = false;
57
if (flag1) {
58
for (int ii = 0; ii < 100; ii++) {
59
if (flag2) {
60
dummy1 = (float)ii;
61
} else {
62
dummy2 = (float)ii;
63
}
64
}
65
flag3 = true;
66
}
67
// Memory Phi here with projection of not inlined call as one edge, MergeMem as other
68
69
if (flag3) { // will split through Phi during loopopts
70
int res = c.i + b.i;
71
m_notinlined(); // prevents split through phi during igvn
72
return res;
73
} else {
74
return 44 + 43;
75
}
76
}
77
78
static public void main(String[] args) {
79
for (int i = 0; i < 20000; i++) {
80
// m(2);
81
Box a = new Box();
82
Box c = new Box();
83
int res = test(a, c, 42, 43, 44, (i%2) == 0, (i%3) == 0);
84
if (res != 44 + 43) {
85
throw new RuntimeException("Bad result " + res);
86
}
87
}
88
}
89
90
}
91
92