Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java
40948 views
1
/*
2
* Copyright (c) 2003, 2018, 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 nsk.jvmti.ClearFieldAccessWatch;
25
26
import java.io.PrintStream;
27
28
public class clrfldw001 {
29
30
native static void setWatch(int fld_ind);
31
native static void clearWatch(int fld_ind);
32
native void touchfld0();
33
native static void check(int fld_ind, boolean flag);
34
native static int getRes();
35
36
static {
37
try {
38
System.loadLibrary("clrfldw001");
39
} catch (UnsatisfiedLinkError ule) {
40
System.err.println("Could not load clrfldw001 library");
41
System.err.println("java.library.path:"
42
+ System.getProperty("java.library.path"));
43
throw ule;
44
}
45
}
46
47
int fld0 = -1;
48
static int fld1 = 1;
49
private clrfldw001a fld2 = new clrfldw001a();
50
static int fld;
51
52
public static void main(String[] args) {
53
args = nsk.share.jvmti.JVMTITest.commonInit(args);
54
55
System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
56
}
57
58
public static int run(String argv[], PrintStream ref) {
59
clrfldw001 t = new clrfldw001();
60
clrfldw001a t_a = new clrfldw001a();
61
clrfldw001b t_b = new clrfldw001b();
62
for (int i = 0; i < 5; i++) {
63
setWatch(i);
64
}
65
t_b.start();
66
clearWatch(1);
67
fld = fld1 + fld;
68
check(1, false);
69
clearWatch(3);
70
fld -= t_a.fld3[2];
71
check(3, false);
72
t.meth01();
73
try {
74
t_b.join();
75
} catch (InterruptedException e) {}
76
return getRes();
77
}
78
79
private void meth01() {
80
clearWatch(0);
81
touchfld0();
82
check(0, false);
83
clearWatch(2);
84
fld += fld2.fld;
85
check(2, false);
86
}
87
}
88
89
class clrfldw001a {
90
int[] fld3 = {10, 9, 8, 7, 6};
91
int fld = 2;
92
}
93
94
class clrfldw001b extends Thread {
95
float fld4 = 6.0f;
96
public void run() {
97
clrfldw001.clearWatch(4);
98
clrfldw001.fld += fld4;
99
clrfldw001.check(4, false);
100
}
101
}
102
103