Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/hotspot/jtreg/compiler/arraycopy/TestNegativeArrayCopyAfterLoop.java
64474 views
1
/*
2
* Copyright (C) 2021 THL A29 Limited, a Tencent company. 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 8267904
27
* @requires vm.compiler2.enabled
28
* @summary C2 inline array_copy move CastIINode(Array Length) before allocation cause crash.
29
* @run main/othervm compiler.arraycopy.TestNegativeArrayCopyAfterLoop
30
*/
31
32
package compiler.arraycopy;
33
import java.util.Arrays;
34
35
class test {
36
public static int exp_count = 0;
37
public int in1 = -4096;
38
test (){
39
try {
40
short sha4[] = new short[1012];
41
for (int i = 0; i < sha4.length; i++) {
42
sha4[i] = 9;
43
}
44
Arrays.copyOf(sha4, in1);
45
} catch (Exception ex) {
46
exp_count++;
47
}
48
}
49
}
50
51
public class TestNegativeArrayCopyAfterLoop {
52
public static void main(String[] args) {
53
for (int i = 0; i < 20000; i++) {
54
new test();
55
}
56
if (test.exp_count == 20000) {
57
System.out.println("TEST PASSED");
58
}
59
}
60
}
61
62