Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/exception/exception.java
40948 views
1
/*
2
* Copyright (c) 2008, 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
*
27
* @summary converted from VM Testbase jit/exception.
28
* VM Testbase keywords: [jit, quick]
29
*
30
* @library /vmTestbase
31
* /test/lib
32
* @run main/othervm jit.exception.exception
33
*/
34
35
package jit.exception;
36
37
/*
38
This JIT buster test checks to see if a JIT doing register allocation
39
on a machine with a callees saves ABI for non-volatile registers can
40
get the exception handling correct. Intel and PowerPC are both such
41
machines. The problem is restoring the correct values of i and j in
42
the catch block. If i and j are never put into registers, then the
43
JIT won't have a problem with correctness because the catch block
44
will load the correct values from memory. If the JIT puts i and j
45
into registers, then restoring their correct values at the catch
46
block gets a little bit tougher.
47
*/
48
49
import nsk.share.TestFailure;
50
51
public class exception {
52
public static void main(String[] args) {
53
int i, j;
54
55
for (i=0,j=0; i<1000000; i++) {
56
j=j+1;
57
j=j+1;
58
}
59
try {
60
int k;
61
k = div(0);
62
} catch (Exception e) {
63
if ((i != 1000000) || (j != 2000000)) {
64
System.out.println("i=" + i + "(expected 1000000), j = " + j + "(expected 2000000)");
65
throw new TestFailure("Test FAILS");
66
} else {
67
System.out.println("Test PASSES");
68
}
69
}
70
}
71
72
static int div(int n) {
73
int m=15;
74
m = m/n;
75
return m;
76
}
77
}
78
79