Path: blob/master/src/hotspot/share/include/jvm.h
40951 views
/*1* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef _JAVASOFT_JVM_H_26#define _JAVASOFT_JVM_H_2728#include <sys/stat.h>2930#include "jni.h"31#include "jvm_md.h"32#include "jvm_constants.h"33#include "jvm_io.h"3435#ifdef __cplusplus36extern "C" {37#endif3839/*40* This file contains additional functions exported from the VM.41* These functions are complementary to the standard JNI support.42* There are three parts to this file:43*44* First, this file contains the VM-related functions needed by native45* libraries in the standard Java API. For example, the java.lang.Object46* class needs VM-level functions that wait for and notify monitors.47*48* Second, (included from jvm_constants.h) constant definitions49* needed by the byte code verifier and class file format checker.50* These definitions allow the verifier and format checker to be written51* in a VM-independent way.52*53* Third, this file contains various I/O and network operations needed54* by the standard Java I/O and network APIs. A part of these APIs,55* namely the jio_xxxprintf functions, are included from jvm_io.h.56*/575859/*************************************************************************60PART 1: Functions for Native Libraries61************************************************************************/62/*63* java.lang.Object64*/65JNIEXPORT jint JNICALL66JVM_IHashCode(JNIEnv *env, jobject obj);6768JNIEXPORT void JNICALL69JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);7071JNIEXPORT void JNICALL72JVM_MonitorNotify(JNIEnv *env, jobject obj);7374JNIEXPORT void JNICALL75JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);7677JNIEXPORT jobject JNICALL78JVM_Clone(JNIEnv *env, jobject obj);7980/*81* java.lang.String82*/83JNIEXPORT jstring JNICALL84JVM_InternString(JNIEnv *env, jstring str);8586/*87* java.lang.System88*/89JNIEXPORT jlong JNICALL90JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);9192JNIEXPORT jlong JNICALL93JVM_NanoTime(JNIEnv *env, jclass ignored);9495JNIEXPORT jlong JNICALL96JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);9798JNIEXPORT void JNICALL99JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,100jobject dst, jint dst_pos, jint length);101102/*103* Return an array of all properties as alternating name and value pairs.104*/105JNIEXPORT jobjectArray JNICALL106JVM_GetProperties(JNIEnv *env);107108/*109* java.lang.Runtime110*/111JNIEXPORT void JNICALL112JVM_BeforeHalt();113114JNIEXPORT void JNICALL115JVM_Halt(jint code);116117JNIEXPORT void JNICALL118JVM_GC(void);119120/* Returns the number of real-time milliseconds that have elapsed since the121* least-recently-inspected heap object was last inspected by the garbage122* collector.123*124* For simple stop-the-world collectors this value is just the time125* since the most recent collection. For generational collectors it is the126* time since the oldest generation was most recently collected. Other127* collectors are free to return a pessimistic estimate of the elapsed time, or128* simply the time since the last full collection was performed.129*130* Note that in the presence of reference objects, a given object that is no131* longer strongly reachable may have to be inspected multiple times before it132* can be reclaimed.133*/134JNIEXPORT jlong JNICALL135JVM_MaxObjectInspectionAge(void);136137JNIEXPORT jlong JNICALL138JVM_TotalMemory(void);139140JNIEXPORT jlong JNICALL141JVM_FreeMemory(void);142143JNIEXPORT jlong JNICALL144JVM_MaxMemory(void);145146JNIEXPORT jint JNICALL147JVM_ActiveProcessorCount(void);148149JNIEXPORT jboolean JNICALL150JVM_IsUseContainerSupport(void);151152JNIEXPORT void * JNICALL153JVM_LoadLibrary(const char *name);154155JNIEXPORT void JNICALL156JVM_UnloadLibrary(void * handle);157158JNIEXPORT void * JNICALL159JVM_FindLibraryEntry(void *handle, const char *name);160161JNIEXPORT jboolean JNICALL162JVM_IsSupportedJNIVersion(jint version);163164JNIEXPORT jobjectArray JNICALL165JVM_GetVmArguments(JNIEnv *env);166167JNIEXPORT void JNICALL168JVM_InitializeFromArchive(JNIEnv* env, jclass cls);169170JNIEXPORT void JNICALL171JVM_RegisterLambdaProxyClassForArchiving(JNIEnv* env, jclass caller,172jstring invokedName,173jobject invokedType,174jobject methodType,175jobject implMethodMember,176jobject instantiatedMethodType,177jclass lambdaProxyClass);178179JNIEXPORT jclass JNICALL180JVM_LookupLambdaProxyClassFromArchive(JNIEnv* env, jclass caller,181jstring invokedName,182jobject invokedType,183jobject methodType,184jobject implMethodMember,185jobject instantiatedMethodType);186187JNIEXPORT jboolean JNICALL188JVM_IsCDSDumpingEnabled(JNIEnv* env);189190JNIEXPORT jboolean JNICALL191JVM_IsSharingEnabled(JNIEnv* env);192193JNIEXPORT jboolean JNICALL194JVM_IsDumpingClassList(JNIEnv* env);195196JNIEXPORT jlong JNICALL197JVM_GetRandomSeedForDumping();198199JNIEXPORT void JNICALL200JVM_LogLambdaFormInvoker(JNIEnv* env, jstring line);201202JNIEXPORT void JNICALL203JVM_DumpClassListToFile(JNIEnv* env, jstring fileName);204205JNIEXPORT void JNICALL206JVM_DumpDynamicArchive(JNIEnv* env, jstring archiveName);207208/*209* java.lang.Throwable210*/211JNIEXPORT void JNICALL212JVM_FillInStackTrace(JNIEnv *env, jobject throwable);213214/*215* java.lang.StackTraceElement216*/217JNIEXPORT void JNICALL218JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable);219220JNIEXPORT void JNICALL221JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo);222223/*224* java.lang.NullPointerException225*/226227JNIEXPORT jstring JNICALL228JVM_GetExtendedNPEMessage(JNIEnv *env, jthrowable throwable);229230/*231* java.lang.StackWalker232*/233enum {234JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,235JVM_STACKWALK_GET_CALLER_CLASS = 0x04,236JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,237JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100238};239240JNIEXPORT jobject JNICALL241JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,242jint skip_frames, jint frame_count, jint start_index,243jobjectArray frames);244245JNIEXPORT jint JNICALL246JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,247jint frame_count, jint start_index,248jobjectArray frames);249250/*251* java.lang.Thread252*/253JNIEXPORT void JNICALL254JVM_StartThread(JNIEnv *env, jobject thread);255256JNIEXPORT void JNICALL257JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);258259JNIEXPORT jboolean JNICALL260JVM_IsThreadAlive(JNIEnv *env, jobject thread);261262JNIEXPORT void JNICALL263JVM_SuspendThread(JNIEnv *env, jobject thread);264265JNIEXPORT void JNICALL266JVM_ResumeThread(JNIEnv *env, jobject thread);267268JNIEXPORT void JNICALL269JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);270271JNIEXPORT void JNICALL272JVM_Yield(JNIEnv *env, jclass threadClass);273274JNIEXPORT void JNICALL275JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);276277JNIEXPORT jobject JNICALL278JVM_CurrentThread(JNIEnv *env, jclass threadClass);279280JNIEXPORT void JNICALL281JVM_Interrupt(JNIEnv *env, jobject thread);282283JNIEXPORT jboolean JNICALL284JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);285286JNIEXPORT void JNICALL287JVM_DumpAllStacks(JNIEnv *env, jclass unused);288289JNIEXPORT jobjectArray JNICALL290JVM_GetAllThreads(JNIEnv *env, jclass dummy);291292JNIEXPORT void JNICALL293JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);294295/* getStackTrace() and getAllStackTraces() method */296JNIEXPORT jobjectArray JNICALL297JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);298299/*300* java.lang.SecurityManager301*/302JNIEXPORT jobjectArray JNICALL303JVM_GetClassContext(JNIEnv *env);304305/*306* java.lang.Package307*/308JNIEXPORT jstring JNICALL309JVM_GetSystemPackage(JNIEnv *env, jstring name);310311JNIEXPORT jobjectArray JNICALL312JVM_GetSystemPackages(JNIEnv *env);313314/*315* java.lang.ref.Reference316*/317JNIEXPORT jobject JNICALL318JVM_GetAndClearReferencePendingList(JNIEnv *env);319320JNIEXPORT jboolean JNICALL321JVM_HasReferencePendingList(JNIEnv *env);322323JNIEXPORT void JNICALL324JVM_WaitForReferencePendingList(JNIEnv *env);325326JNIEXPORT jboolean JNICALL327JVM_ReferenceRefersTo(JNIEnv *env, jobject ref, jobject o);328329JNIEXPORT void JNICALL330JVM_ReferenceClear(JNIEnv *env, jobject ref);331332/*333* java.lang.ref.PhantomReference334*/335JNIEXPORT jboolean JNICALL336JVM_PhantomReferenceRefersTo(JNIEnv *env, jobject ref, jobject o);337338/*339* java.io.ObjectInputStream340*/341JNIEXPORT jobject JNICALL342JVM_LatestUserDefinedLoader(JNIEnv *env);343344/*345* java.lang.reflect.Array346*/347JNIEXPORT jint JNICALL348JVM_GetArrayLength(JNIEnv *env, jobject arr);349350JNIEXPORT jobject JNICALL351JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);352353JNIEXPORT jvalue JNICALL354JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);355356JNIEXPORT void JNICALL357JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);358359JNIEXPORT void JNICALL360JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,361unsigned char vCode);362363JNIEXPORT jobject JNICALL364JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);365366JNIEXPORT jobject JNICALL367JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);368369370/*371* Returns the immediate caller class of the native method invoking372* JVM_GetCallerClass. The Method.invoke and other frames due to373* reflection machinery are skipped.374*375* The caller is expected to be marked with376* jdk.internal.reflect.CallerSensitive. The JVM will throw an377* error if it is not marked properly.378*/379JNIEXPORT jclass JNICALL380JVM_GetCallerClass(JNIEnv *env);381382383/*384* Find primitive classes385* utf: class name386*/387JNIEXPORT jclass JNICALL388JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);389390391/*392* Find a class from a boot class loader. Returns NULL if class not found.393*/394JNIEXPORT jclass JNICALL395JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);396397/*398* Find a class from a given class loader. Throws ClassNotFoundException.399* name: name of class400* init: whether initialization is done401* loader: class loader to look up the class. This may not be the same as the caller's402* class loader.403* caller: initiating class. The initiating class may be null when a security404* manager is not installed.405*/406JNIEXPORT jclass JNICALL407JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,408jobject loader, jclass caller);409410/*411* Find a class from a given class.412*/413JNIEXPORT jclass JNICALL414JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,415jclass from);416417/* Find a loaded class cached by the VM */418JNIEXPORT jclass JNICALL419JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);420421/* Define a class */422JNIEXPORT jclass JNICALL423JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,424jsize len, jobject pd);425426/* Define a class with a source (added in JDK1.5) */427JNIEXPORT jclass JNICALL428JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,429const jbyte *buf, jsize len, jobject pd,430const char *source);431432/*433* Define a class with the specified lookup class.434* lookup: Lookup class435* name: the name of the class436* buf: class bytes437* len: length of class bytes438* pd: protection domain439* init: initialize the class440* flags: properties of the class441* classData: private static pre-initialized field; may be null442*/443JNIEXPORT jclass JNICALL444JVM_LookupDefineClass(JNIEnv *env, jclass lookup, const char *name, const jbyte *buf,445jsize len, jobject pd, jboolean init, int flags, jobject classData);446447/*448* Module support funcions449*/450451/*452* Define a module with the specified packages and bind the module to the453* given class loader.454* module: module to define455* is_open: specifies if module is open (currently ignored)456* version: the module version457* location: the module location458* packages: array of packages in the module459*/460JNIEXPORT void JNICALL461JVM_DefineModule(JNIEnv *env, jobject module, jboolean is_open, jstring version,462jstring location, jobjectArray packages);463464/*465* Set the boot loader's unnamed module.466* module: boot loader's unnamed module467*/468JNIEXPORT void JNICALL469JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module);470471/*472* Do a qualified export of a package.473* from_module: module containing the package to export474* package: name of the package to export475* to_module: module to export the package to476*/477JNIEXPORT void JNICALL478JVM_AddModuleExports(JNIEnv *env, jobject from_module, jstring package, jobject to_module);479480/*481* Do an export of a package to all unnamed modules.482* from_module: module containing the package to export483* package: name of the package to export to all unnamed modules484*/485JNIEXPORT void JNICALL486JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, jstring package);487488/*489* Do an unqualified export of a package.490* from_module: module containing the package to export491* package: name of the package to export492*/493JNIEXPORT void JNICALL494JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, jstring package);495496/*497* Add a module to the list of modules that a given module can read.498* from_module: module requesting read access499* source_module: module that from_module wants to read500*/501JNIEXPORT void JNICALL502JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);503504/*505* Define all modules that have been stored in the CDS archived heap.506* platform_loader: the built-in platform class loader507* system_loader: the built-in system class loader508*/509JNIEXPORT void JNICALL510JVM_DefineArchivedModules(JNIEnv *env, jobject platform_loader, jobject system_loader);511512/*513* Reflection support functions514*/515516JNIEXPORT jstring JNICALL517JVM_InitClassName(JNIEnv *env, jclass cls);518519JNIEXPORT jobjectArray JNICALL520JVM_GetClassInterfaces(JNIEnv *env, jclass cls);521522JNIEXPORT jboolean JNICALL523JVM_IsInterface(JNIEnv *env, jclass cls);524525JNIEXPORT jobjectArray JNICALL526JVM_GetClassSigners(JNIEnv *env, jclass cls);527528JNIEXPORT void JNICALL529JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);530531JNIEXPORT jobject JNICALL532JVM_GetProtectionDomain(JNIEnv *env, jclass cls);533534JNIEXPORT jboolean JNICALL535JVM_IsArrayClass(JNIEnv *env, jclass cls);536537JNIEXPORT jboolean JNICALL538JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);539540JNIEXPORT jboolean JNICALL541JVM_IsHiddenClass(JNIEnv *env, jclass cls);542543JNIEXPORT jint JNICALL544JVM_GetClassModifiers(JNIEnv *env, jclass cls);545546JNIEXPORT jobjectArray JNICALL547JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);548549JNIEXPORT jclass JNICALL550JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);551552JNIEXPORT jstring JNICALL553JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass);554555/* Generics support (JDK 1.5) */556JNIEXPORT jstring JNICALL557JVM_GetClassSignature(JNIEnv *env, jclass cls);558559/* Annotations support (JDK 1.5) */560JNIEXPORT jbyteArray JNICALL561JVM_GetClassAnnotations(JNIEnv *env, jclass cls);562563/* Type use annotations support (JDK 1.8) */564565JNIEXPORT jbyteArray JNICALL566JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);567568JNIEXPORT jbyteArray JNICALL569JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);570571JNIEXPORT jbyteArray JNICALL572JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);573574/*575* New (JDK 1.4) reflection implementation576*/577578JNIEXPORT jobjectArray JNICALL579JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);580581JNIEXPORT jobjectArray JNICALL582JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);583584JNIEXPORT jobjectArray JNICALL585JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);586587588/* Differs from JVM_GetClassModifiers in treatment of inner classes.589This returns the access flags for the class as specified in the590class file rather than searching the InnerClasses attribute (if591present) to find the source-level access flags. Only the values of592the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be593valid. */594JNIEXPORT jint JNICALL595JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);596597/* Nestmates - since JDK 11 */598599JNIEXPORT jboolean JNICALL600JVM_AreNestMates(JNIEnv *env, jclass current, jclass member);601602JNIEXPORT jclass JNICALL603JVM_GetNestHost(JNIEnv *env, jclass current);604605JNIEXPORT jobjectArray JNICALL606JVM_GetNestMembers(JNIEnv *env, jclass current);607608/* Records - since JDK 16 */609610JNIEXPORT jboolean JNICALL611JVM_IsRecord(JNIEnv *env, jclass cls);612613JNIEXPORT jobjectArray JNICALL614JVM_GetRecordComponents(JNIEnv *env, jclass ofClass);615616/* Sealed classes - since JDK 17 */617618JNIEXPORT jobjectArray JNICALL619JVM_GetPermittedSubclasses(JNIEnv *env, jclass current);620621/* The following two reflection routines are still needed due to startup time issues */622/*623* java.lang.reflect.Method624*/625JNIEXPORT jobject JNICALL626JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);627628/*629* java.lang.reflect.Constructor630*/631JNIEXPORT jobject JNICALL632JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);633634/*635* Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)636*/637638JNIEXPORT jobject JNICALL639JVM_GetClassConstantPool(JNIEnv *env, jclass cls);640641JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize642(JNIEnv *env, jobject unused, jobject jcpool);643644JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt645(JNIEnv *env, jobject unused, jobject jcpool, jint index);646647JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded648(JNIEnv *env, jobject unused, jobject jcpool, jint index);649650JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt651(JNIEnv *env, jobject obj, jobject unused, jint index);652653JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt654(JNIEnv *env, jobject unused, jobject jcpool, jint index);655656JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded657(JNIEnv *env, jobject unused, jobject jcpool, jint index);658659JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt660(JNIEnv *env, jobject unused, jobject jcpool, jint index);661662JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded663(JNIEnv *env, jobject unused, jobject jcpool, jint index);664665JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt666(JNIEnv *env, jobject unused, jobject jcpool, jint index);667668JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt669(JNIEnv *env, jobject obj, jobject unused, jint index);670671JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt672(JNIEnv *env, jobject obj, jobject unused, jint index);673674JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt675(JNIEnv *env, jobject unused, jobject jcpool, jint index);676677JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt678(JNIEnv *env, jobject unused, jobject jcpool, jint index);679680JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt681(JNIEnv *env, jobject unused, jobject jcpool, jint index);682683JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt684(JNIEnv *env, jobject unused, jobject jcpool, jint index);685686JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt687(JNIEnv *env, jobject unused, jobject jcpool, jint index);688689JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At690(JNIEnv *env, jobject unused, jobject jcpool, jint index);691692JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt693(JNIEnv *env, jobject unused, jobject jcpool, jint index);694695/*696* Parameter reflection697*/698699JNIEXPORT jobjectArray JNICALL700JVM_GetMethodParameters(JNIEnv *env, jobject method);701702/*703* java.security.*704*/705706JNIEXPORT jobject JNICALL707JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);708709/*710* Ensure that code doing a stackwalk and using javaVFrame::locals() to711* get the value will see a materialized value and not a scalar-replaced712* null value.713*/714#define JVM_EnsureMaterializedForStackWalk(env, value) \715do {} while(0) // Nothing to do. The fact that the value escaped716// through a native method is enough.717718JNIEXPORT jobject JNICALL719JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);720721/*722* Signal support, used to implement the shutdown sequence. Every VM must723* support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts724* (^C) and the latter for external termination (kill, system shutdown, etc.).725* Other platform-dependent signal values may also be supported.726*/727728JNIEXPORT void * JNICALL729JVM_RegisterSignal(jint sig, void *handler);730731JNIEXPORT jboolean JNICALL732JVM_RaiseSignal(jint sig);733734JNIEXPORT jint JNICALL735JVM_FindSignal(const char *name);736737/*738* Retrieve the assertion directives for the specified class.739*/740JNIEXPORT jboolean JNICALL741JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);742743/*744* Retrieve the assertion directives from the VM.745*/746JNIEXPORT jobject JNICALL747JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);748749/*750* java.util.concurrent.atomic.AtomicLong751*/752JNIEXPORT jboolean JNICALL753JVM_SupportsCX8(void);754755/*************************************************************************756PART 2: Support for the Verifier and Class File Format Checker757************************************************************************/758/*759* Return the class name in UTF format. The result is valid760* until JVM_ReleaseUTf is called.761*762* The caller must treat the string as a constant and not modify it763* in any way.764*/765JNIEXPORT const char * JNICALL766JVM_GetClassNameUTF(JNIEnv *env, jclass cb);767768/*769* Returns the constant pool types in the buffer provided by "types."770*/771JNIEXPORT void JNICALL772JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);773774/*775* Returns the number of Constant Pool entries.776*/777JNIEXPORT jint JNICALL778JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);779780/*781* Returns the number of *declared* fields or methods.782*/783JNIEXPORT jint JNICALL784JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);785786JNIEXPORT jint JNICALL787JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);788789/*790* Returns the CP indexes of exceptions raised by a given method.791* Places the result in the given buffer.792*793* The method is identified by method_index.794*/795JNIEXPORT void JNICALL796JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,797unsigned short *exceptions);798/*799* Returns the number of exceptions raised by a given method.800* The method is identified by method_index.801*/802JNIEXPORT jint JNICALL803JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);804805/*806* Returns the byte code sequence of a given method.807* Places the result in the given buffer.808*809* The method is identified by method_index.810*/811JNIEXPORT void JNICALL812JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,813unsigned char *code);814815/*816* Returns the length of the byte code sequence of a given method.817* The method is identified by method_index.818*/819JNIEXPORT jint JNICALL820JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);821822/*823* A structure used to a capture exception table entry in a Java method.824*/825typedef struct {826jint start_pc;827jint end_pc;828jint handler_pc;829jint catchType;830} JVM_ExceptionTableEntryType;831832/*833* Returns the exception table entry at entry_index of a given method.834* Places the result in the given buffer.835*836* The method is identified by method_index.837*/838JNIEXPORT void JNICALL839JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,840jint entry_index,841JVM_ExceptionTableEntryType *entry);842843/*844* Returns the length of the exception table of a given method.845* The method is identified by method_index.846*/847JNIEXPORT jint JNICALL848JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);849850/*851* Returns the modifiers of a given field.852* The field is identified by field_index.853*/854JNIEXPORT jint JNICALL855JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);856857/*858* Returns the modifiers of a given method.859* The method is identified by method_index.860*/861JNIEXPORT jint JNICALL862JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);863864/*865* Returns the number of local variables of a given method.866* The method is identified by method_index.867*/868JNIEXPORT jint JNICALL869JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);870871/*872* Returns the number of arguments (including this pointer) of a given method.873* The method is identified by method_index.874*/875JNIEXPORT jint JNICALL876JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);877878/*879* Returns the maximum amount of stack (in words) used by a given method.880* The method is identified by method_index.881*/882JNIEXPORT jint JNICALL883JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);884885/*886* Is a given method a constructor.887* The method is identified by method_index.888*/889JNIEXPORT jboolean JNICALL890JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);891892/*893* Is the given method generated by the VM.894* The method is identified by method_index.895*/896JNIEXPORT jboolean JNICALL897JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);898899/*900* Returns the name of a given method in UTF format.901* The result remains valid until JVM_ReleaseUTF is called.902*903* The caller must treat the string as a constant and not modify it904* in any way.905*/906JNIEXPORT const char * JNICALL907JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);908909/*910* Returns the signature of a given method in UTF format.911* The result remains valid until JVM_ReleaseUTF is called.912*913* The caller must treat the string as a constant and not modify it914* in any way.915*/916JNIEXPORT const char * JNICALL917JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);918919/*920* Returns the name of the field referred to at a given constant pool921* index.922*923* The result is in UTF format and remains valid until JVM_ReleaseUTF924* is called.925*926* The caller must treat the string as a constant and not modify it927* in any way.928*/929JNIEXPORT const char * JNICALL930JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);931932/*933* Returns the name of the method referred to at a given constant pool934* index.935*936* The result is in UTF format and remains valid until JVM_ReleaseUTF937* is called.938*939* The caller must treat the string as a constant and not modify it940* in any way.941*/942JNIEXPORT const char * JNICALL943JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);944945/*946* Returns the signature of the method referred to at a given constant pool947* index.948*949* The result is in UTF format and remains valid until JVM_ReleaseUTF950* is called.951*952* The caller must treat the string as a constant and not modify it953* in any way.954*/955JNIEXPORT const char * JNICALL956JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);957958/*959* Returns the signature of the field referred to at a given constant pool960* index.961*962* The result is in UTF format and remains valid until JVM_ReleaseUTF963* is called.964*965* The caller must treat the string as a constant and not modify it966* in any way.967*/968JNIEXPORT const char * JNICALL969JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);970971/*972* Returns the class name referred to at a given constant pool index.973*974* The result is in UTF format and remains valid until JVM_ReleaseUTF975* is called.976*977* The caller must treat the string as a constant and not modify it978* in any way.979*/980JNIEXPORT const char * JNICALL981JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);982983/*984* Returns the class name referred to at a given constant pool index.985*986* The constant pool entry must refer to a CONSTANT_Fieldref.987*988* The result is in UTF format and remains valid until JVM_ReleaseUTF989* is called.990*991* The caller must treat the string as a constant and not modify it992* in any way.993*/994JNIEXPORT const char * JNICALL995JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);996997/*998* Returns the class name referred to at a given constant pool index.999*1000* The constant pool entry must refer to CONSTANT_Methodref or1001* CONSTANT_InterfaceMethodref.1002*1003* The result is in UTF format and remains valid until JVM_ReleaseUTF1004* is called.1005*1006* The caller must treat the string as a constant and not modify it1007* in any way.1008*/1009JNIEXPORT const char * JNICALL1010JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);10111012/*1013* Returns the modifiers of a field in calledClass. The field is1014* referred to in class cb at constant pool entry index.1015*1016* The caller must treat the string as a constant and not modify it1017* in any way.1018*1019* Returns -1 if the field does not exist in calledClass.1020*/1021JNIEXPORT jint JNICALL1022JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);10231024/*1025* Returns the modifiers of a method in calledClass. The method is1026* referred to in class cb at constant pool entry index.1027*1028* Returns -1 if the method does not exist in calledClass.1029*/1030JNIEXPORT jint JNICALL1031JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);10321033/*1034* Releases the UTF string obtained from the VM.1035*/1036JNIEXPORT void JNICALL1037JVM_ReleaseUTF(const char *utf);10381039/*1040* Compare if two classes are in the same package.1041*/1042JNIEXPORT jboolean JNICALL1043JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);104410451046/*************************************************************************1047PART 3: I/O and Network Support1048************************************************************************/10491050/*1051* Convert a pathname into native format. This function does syntactic1052* cleanup, such as removing redundant separator characters. It modifies1053* the given pathname string in place.1054*/1055JNIEXPORT char * JNICALL1056JVM_NativePath(char *);10571058JNIEXPORT void * JNICALL1059JVM_RawMonitorCreate(void);10601061JNIEXPORT void JNICALL1062JVM_RawMonitorDestroy(void *mon);10631064JNIEXPORT jint JNICALL1065JVM_RawMonitorEnter(void *mon);10661067JNIEXPORT void JNICALL1068JVM_RawMonitorExit(void *mon);10691070/*1071* java.lang.management support1072*/1073JNIEXPORT void* JNICALL1074JVM_GetManagement(jint version);10751076/*1077* com.sun.tools.attach.VirtualMachine support1078*1079* Initialize the agent properties with the properties maintained in the VM.1080*/1081JNIEXPORT jobject JNICALL1082JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);10831084JNIEXPORT jstring JNICALL1085JVM_GetTemporaryDirectory(JNIEnv *env);10861087/* Generics reflection support.1088*1089* Returns information about the given class's EnclosingMethod1090* attribute, if present, or null if the class had no enclosing1091* method.1092*1093* If non-null, the returned array contains three elements. Element 01094* is the java.lang.Class of which the enclosing method is a member,1095* and elements 1 and 2 are the java.lang.Strings for the enclosing1096* method's name and descriptor, respectively.1097*/1098JNIEXPORT jobjectArray JNICALL1099JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);11001101/*1102* This structure is used by the launcher to get the default thread1103* stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a1104* version of 1.1. As it is not supported otherwise, it has been removed1105* from jni.h1106*/1107typedef struct JDK1_1InitArgs {1108jint version;11091110char **properties;1111jint checkSource;1112jint nativeStackSize;1113jint javaStackSize;1114jint minHeapSize;1115jint maxHeapSize;1116jint verifyMode;1117char *classpath;11181119jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);1120void (JNICALL *exit)(jint code);1121void (JNICALL *abort)(void);11221123jint enableClassGC;1124jint enableVerboseGC;1125jint disableAsyncGC;1126jint verbose;1127jboolean debugging;1128jint debugPort;1129} JDK1_1InitArgs;113011311132#ifdef __cplusplus1133} /* extern "C" */11341135#endif /* __cplusplus */11361137#endif /* !_JAVASOFT_JVM_H_ */113811391140