Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/calls/common/InvokeSpecial.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.calls.common;
25
26
import jdk.test.lib.Asserts;
27
28
/**
29
* A test class checking InvokeSpecial instruction
30
*/
31
public class InvokeSpecial extends CallsBase {
32
private static final Object LOCK = new Object();
33
34
public static void main(String args[]) {
35
new InvokeSpecial().runTest(args);
36
}
37
38
/**
39
* A native caller method, assumed to called "callee"/"calleeNative"
40
*/
41
@Override
42
public native void callerNative();
43
44
/**
45
* A caller method, assumed to called "callee"/"calleeNative"
46
*/
47
@Override
48
public void caller() {
49
if (nativeCallee) {
50
Asserts.assertTrue(calleeNative(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);
51
} else {
52
Asserts.assertTrue(callee(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);
53
}
54
}
55
56
/**
57
* A callee method, assumed to be called by "caller"/"callerNative"
58
*/
59
private boolean callee(int param1, long param2, float param3, double param4,
60
String param5) {
61
calleeVisited = true;
62
CallsBase.checkValues(param1, param2, param3, param4, param5);
63
return true;
64
}
65
66
/**
67
* A native callee method, assumed to be called by "caller"/"callerNative"
68
*/
69
public native boolean calleeNative(int param1, long param2, float param3,
70
double param4, String param5);
71
72
/**
73
* Returns object to lock execution on
74
* @return lock object
75
*/
76
@Override
77
protected Object getLockObject() {
78
return LOCK;
79
}
80
}
81
82