Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/arraycopy/TestMissingControl.java
41149 views
1
/*
2
* Copyright (c) 2014, 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 8055153
27
* @summary missing control on LoadRange and LoadKlass when array copy macro node is expanded
28
*
29
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-TieredCompilation
30
* compiler.arraycopy.TestMissingControl
31
*
32
*/
33
34
package compiler.arraycopy;
35
36
public class TestMissingControl {
37
38
static int[] m1(int[] a2) {
39
int[] a1 = new int[10];
40
System.arraycopy(a1, 0, a2, 0, 10);
41
return a1;
42
}
43
44
static class A {
45
}
46
47
static Object m2(Object[] a2) {
48
A[] a1 = new A[10];
49
System.arraycopy(a1, 0, a2, 0, 10);
50
return a1;
51
}
52
53
static void test1() {
54
int[] a2 = new int[10];
55
int[] a3 = new int[5];
56
57
// compile m1 with arraycopy intrinsified
58
for (int i = 0; i < 20000; i++) {
59
m1(a2);
60
}
61
62
// make m1 trap
63
for (int i = 0; i < 10; i++) {
64
try {
65
m1(a3);
66
} catch(IndexOutOfBoundsException ioobe) {
67
}
68
}
69
70
// recompile m1
71
for (int i = 0; i < 20000; i++) {
72
m1(a2);
73
}
74
75
try {
76
m1(null);
77
} catch(NullPointerException npe) {}
78
}
79
80
static void test2() {
81
A[] a2 = new A[10];
82
A[] a3 = new A[5];
83
84
// compile m2 with arraycopy intrinsified
85
for (int i = 0; i < 20000; i++) {
86
m2(a2);
87
}
88
89
// make m2 trap
90
for (int i = 0; i < 10; i++) {
91
try {
92
m2(a3);
93
} catch(IndexOutOfBoundsException ioobe) {
94
}
95
}
96
97
// recompile m2
98
for (int i = 0; i < 20000; i++) {
99
m2(a2);
100
}
101
102
try {
103
m2(null);
104
} catch(NullPointerException npe) {}
105
}
106
107
static public void main(String[] args) {
108
test1();
109
test2();
110
}
111
}
112
113