/*******************************************************************************1* Copyright (c) 2001, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/21/* Prototypes and types required by the JCL module */2223#ifndef JCL_INTERNAL_H24#define JCL_INTERNAL_H2526#ifdef __cplusplus27extern "C" {28#endif2930/* ---------------- getstacktrace.c ---------------- */31j9object_t32createStackTraceThrowable(J9VMThread *currentThread, const UDATA *frames, UDATA maxFrames);33343536/* ---------------- mgmtthread.c ---------------- */3738U_6439checkedTimeInterval(U_64 endNS, U_64 startNS);404142/* ---------------- reflecthelp.c ---------------- */43void44initializeReflection(J9JavaVM *javaVM);4546void47preloadReflectWrapperClasses(J9JavaVM *javaVM);4849j9object_t getClassAnnotationData(struct J9VMThread *vmThread, struct J9Class *declaringClass);5051jbyteArray getClassTypeAnnotationsAsByteArray(JNIEnv *env, jclass jlClass);5253j9object_t getFieldAnnotationData(struct J9VMThread *vmThread, struct J9Class *declaringClass, J9JNIFieldID *j9FieldID);5455jbyteArray getFieldTypeAnnotationsAsByteArray(JNIEnv *env, jobject jlrField);5657j9object_t getMethodAnnotationData(struct J9VMThread *vmThread, struct J9Class *declaringClass, J9Method *ramMethod);5859j9object_t getMethodParametersAnnotationData(struct J9VMThread *vmThread, struct J9Class *declaringClass, J9Method *ramMethod);6061j9object_t getMethodTypeAnnotationData(struct J9VMThread *vmThread, struct J9Class *declaringClass, J9Method *ramMethod);6263jbyteArray getMethodTypeAnnotationsAsByteArray(JNIEnv *env, jobject jlrMethod);6465j9object_t getMethodDefaultAnnotationData(struct J9VMThread *vmThread, struct J9Class *declaringClass, J9Method *ramMethod);6667jobjectArray getMethodParametersAsArray(JNIEnv *env, jobject jlrMethod);6869/**70* The caller must have VM access.71* Build a java.lang.reflect.Field object for a field specified with a name and a declaring class.72* @param[in] vmThread The current vmThread.73* @param[in] declaringClass The declaring class. Must be non-null.74* @param[in] fieldName The name of the field.75* @return j9object_t a java.lang.reflect.Field76*/77j9object_t78getFieldObjHelper(J9VMThread *vmThread, jclass declaringClass, jstring fieldName);7980/**81* Build a java.lang.reflect.Field for a specified declared field.82* @param[in] env The JNI context.83* @param[in] declaringClass The declaring class. Must be non-null.84* @param[in] fieldName The name of the field.85* @return jobject a java.lang.reflect.Field86*/87jobject88getDeclaredFieldHelper(JNIEnv *env, jobject declaringClass, jstring fieldName);8990/**91* Build an array of java.lang.reflect.Field for the fields declared by a class.92* @param[in] env The JNI context.93* @param[in] declaringClass The declaring class. Must be non-null.94* @return jarray an array of java.lang.reflect.Field95*/96jarray97getDeclaredFieldsHelper(JNIEnv *env, jobject declaringClass);9899/**100* Build a java.lang.reflect.Field for a specified field.101* @param[in] env The JNI context.102* @param[in] cls A class. Must be non-null.103* @param[in] fieldName The name of the field.104* @return jobject a java.lang.reflect.Field105*/106jobject107getFieldHelper(JNIEnv *env, jobject cls, jstring fieldName);108109/**110* Build an array of java.lang.reflect.Field for the public fields of a class.111* @param[in] env The JNI context.112* @param[in] cls A class. Must be non-null.113* @return jarray an array of java.lang.reflect.Field114*/115jarray116getFieldsHelper(JNIEnv *env, jobject cls);117118/**119* Get the array class for an element class.120* Creates the class if it isn't already created.121*122* @param[in] vmThread The current vmThread.123* @param[in] elementTypeClass The element class.124* @return the array class125*126* @pre has VM access127* @todo There is a duplicate copy of this function in j9vm/j7vmi.c128*/129J9Class *130fetchArrayClass(struct J9VMThread *vmThread, J9Class *elementTypeClass);131132#if JAVA_SPEC_VERSION >= 14133/**134* Build an array of java.lang.reflect.RecordComponent for the record components of a record class135*136* @param[in] env The JNI context.137* @param[in] cls A class. Must be non-null.138*139* @return jarray an array of java.lang.reflect.RecordComponent.140* If cls is not a record, return null.141* If record class has no record components, return an empty array.142*/143jarray144getRecordComponentsHelper(JNIEnv *env, jobject cls);145#endif /* JAVA_SPEC_VERSION >= 14 */146147/**148* Build an array of java.lang.String to return names of all permitted subclasses149* for a sealed class.150*151* @param[in] env The JNI context.152* @param[in] cls A class. Must be non-null.153*154* @return jarray an array of java.lang.String155*/156jarray157permittedSubclassesHelper(JNIEnv *env, jobject cls);158159/* ---------------- sigquit.c ---------------- */160void161J9SigQuitShutdown(J9JavaVM * vm);162163164/* ---------------- unsafe_mem.c ---------------- */165UDATA166initializeUnsafeMemoryTracking(J9JavaVM* vm);167168void169freeUnsafeMemory(J9JavaVM* vm);170171/* ---------------- java_dyn_methodhandle.c ---------------- */172#if defined(J9VM_OPT_JAVA_OFFLOAD_SUPPORT)173void clearNonZAAPEligibleBit(JNIEnv *env, jclass nativeClass, const JNINativeMethod *nativeMethods, jint nativeMethodCount);174#endif /* J9VM_OPT_JAVA_OFFLOAD_SUPPORT */175176#ifdef __cplusplus177}178#endif179180#endif /* JCL_INTERNAL_H */181182183