Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/j9vm31/jnireflect.cpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 2021, 2021 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#include "j9vm31.h"
24
25
jmethodID JNICALL
26
FromReflectedMethod(JNIEnv *env, jobject method)
27
{
28
const jint NUM_ARGS = 2;
29
J9_CEL4RO64_ArgType argTypes[NUM_ARGS] = { CEL4RO64_type_JNIEnv64, CEL4RO64_type_jobject };
30
uint64_t argValues[NUM_ARGS] = { JNIENV64_FROM_JNIENV31(env), method };
31
jmethodID returnValue = NULL;
32
FUNCTION_DESCRIPTOR_FROM_JNIENV31(env, FromReflectedMethod);
33
j9_cel4ro64_call_function(functionDescriptor, argTypes, argValues, NUM_ARGS, CEL4RO64_type_jmethodID, &returnValue);
34
return returnValue;
35
}
36
37
jfieldID JNICALL
38
FromReflectedField(JNIEnv *env, jobject field)
39
{
40
const jint NUM_ARGS = 2;
41
J9_CEL4RO64_ArgType argTypes[NUM_ARGS] = { CEL4RO64_type_JNIEnv64, CEL4RO64_type_jobject };
42
uint64_t argValues[NUM_ARGS] = { JNIENV64_FROM_JNIENV31(env), field };
43
jfieldID returnValue = NULL;
44
FUNCTION_DESCRIPTOR_FROM_JNIENV31(env, FromReflectedField);
45
j9_cel4ro64_call_function(functionDescriptor, argTypes, argValues, NUM_ARGS, CEL4RO64_type_jfieldID, &returnValue);
46
return returnValue;
47
}
48
49
jobject JNICALL
50
ToReflectedMethod(JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic)
51
{
52
const jint NUM_ARGS = 4;
53
J9_CEL4RO64_ArgType argTypes[NUM_ARGS] = { CEL4RO64_type_JNIEnv64, CEL4RO64_type_jclass, CEL4RO64_type_jmethodID, CEL4RO64_type_jboolean };
54
uint64_t argValues[NUM_ARGS] = { JNIENV64_FROM_JNIENV31(env), cls, methodID, (uint64_t)isStatic };
55
jobject returnValue = NULL;
56
FUNCTION_DESCRIPTOR_FROM_JNIENV31(env, ToReflectedMethod);
57
j9_cel4ro64_call_function(functionDescriptor, argTypes, argValues, NUM_ARGS, CEL4RO64_type_jobject, &returnValue);
58
return returnValue;
59
}
60
61
jobject JNICALL
62
ToReflectedField(JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic)
63
{
64
const jint NUM_ARGS = 4;
65
J9_CEL4RO64_ArgType argTypes[NUM_ARGS] = { CEL4RO64_type_JNIEnv64, CEL4RO64_type_jclass, CEL4RO64_type_jfieldID, CEL4RO64_type_jboolean };
66
uint64_t argValues[NUM_ARGS] = { JNIENV64_FROM_JNIENV31(env), cls, fieldID, (uint64_t)isStatic };
67
jobject returnValue = NULL;
68
FUNCTION_DESCRIPTOR_FROM_JNIENV31(env, ToReflectedField);
69
j9_cel4ro64_call_function(functionDescriptor, argTypes, argValues, NUM_ARGS, CEL4RO64_type_jobject, &returnValue);
70
return returnValue;
71
}
72
73