Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DummyClass.java
41153 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
package compiler.jvmci.compilerToVM;
25
26
import jdk.test.lib.Utils;
27
import sun.hotspot.WhiteBox;
28
29
import java.util.Random;
30
31
class DummyClass extends DummyAbstractClass {
32
private static final WhiteBox WB = WhiteBox.getWhiteBox();
33
int p1 = 5;
34
int p2 = 6;
35
36
public int dummyInstanceFunction() {
37
String str1 = "123123123";
38
double x = 3.14;
39
int y = Integer.parseInt(str1);
40
41
return y / (int) x;
42
}
43
44
public int dummyEmptyInstanceFunction() {
45
return 42;
46
}
47
48
public static int dummyEmptyStaticFunction() {
49
return -42;
50
}
51
52
@Override
53
public int dummyAbstractFunction() {
54
int z = p1 * p2;
55
return (int) (Math.cos(p2 - p1 + z) * 100);
56
}
57
58
@Override
59
public void dummyFunction() {
60
dummyEmptyInstanceFunction();
61
}
62
63
public void withLoop() {
64
long tier4 = (Long) WB.getVMFlag("Tier4BackEdgeThreshold");
65
for (long i = 0; i < tier4; ++i) {
66
randomProfile();
67
}
68
}
69
70
private double randomProfile() {
71
String str1 = "123123123";
72
double x = 3.14;
73
int y = Integer.parseInt(str1);
74
75
Random rnd = Utils.getRandomInstance();
76
if (rnd.nextDouble() > 0.2) {
77
return y / (int) x;
78
} else {
79
return x / y;
80
}
81
}
82
83
}
84
85