Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java
41149 views
1
/*
2
* Copyright (c) 2021, 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
/*
26
* @test
27
* @key stress randomness
28
* @bug 8257822
29
* @summary Verify that zero check is executed before division/modulo operation.
30
* @requires vm.compiler2.enabled
31
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test
32
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf
33
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test
34
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM compiler.loopopts.TestDivZeroWithSplitIf
35
*/
36
37
package compiler.loopopts;
38
39
public class TestDivZeroWithSplitIf {
40
public static int iArrFld[] = new int[10];
41
42
public static void test() {
43
int x = 20;
44
int y = 0;
45
int z = 10;
46
for (int i = 9; i < 99; i += 2) {
47
for (int j = 3; j < 100; j++) {
48
for (int k = 1; k < 2; k++) {
49
try {
50
x = (-65229 / y); // Division by zero
51
z = (iArrFld[5] / 8); // RangeCheckNode
52
} catch (ArithmeticException a_e) {}
53
try {
54
y = (-38077 / y);
55
z = (y / 9);
56
} catch (ArithmeticException a_e) {}
57
y = 8;
58
z += k;
59
}
60
}
61
}
62
}
63
public static void main(String[] strArr) {
64
for (int i = 0; i < 10; i++) {
65
test();
66
}
67
}
68
}
69
70
71