Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/prims/jvm.h
32285 views
/*1* Copyright (c) 1997, 2018, 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.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_PRIMS_JVM_H25#define SHARE_VM_PRIMS_JVM_H2627#include "prims/jni.h"28#ifdef TARGET_OS_FAMILY_linux29# include "jvm_linux.h"30#endif31#ifdef TARGET_OS_FAMILY_solaris32# include "jvm_solaris.h"33#endif34#ifdef TARGET_OS_FAMILY_windows35# include "jvm_windows.h"36#endif37#ifdef TARGET_OS_FAMILY_aix38# include "jvm_aix.h"39#endif40#ifdef TARGET_OS_FAMILY_bsd41# include "jvm_bsd.h"42#endif4344#ifndef _JAVASOFT_JVM_H_45#define _JAVASOFT_JVM_H_4647// HotSpot integration note:48//49// This file and jvm.h used with the JDK are identical,50// except for the three includes removed below5152// #include <sys/stat.h>53// #include "jni.h"54// #include "jvm_md.h"555657#ifdef __cplusplus58extern "C" {59#endif6061/*62* This file contains additional functions exported from the VM.63* These functions are complementary to the standard JNI support.64* There are three parts to this file:65*66* First, this file contains the VM-related functions needed by native67* libraries in the standard Java API. For example, the java.lang.Object68* class needs VM-level functions that wait for and notify monitors.69*70* Second, this file contains the functions and constant definitions71* needed by the byte code verifier and class file format checker.72* These functions allow the verifier and format checker to be written73* in a VM-independent way.74*75* Third, this file contains various I/O and nerwork operations needed76* by the standard Java I/O and network APIs.77*/7879/*80* Bump the version number when either of the following happens:81*82* 1. There is a change in JVM_* functions.83*84* 2. There is a change in the contract between VM and Java classes.85* For example, if the VM relies on a new private field in Thread86* class.87*/8889#define JVM_INTERFACE_VERSION 49091JNIEXPORT jobjectArray JNICALL92JVM_GetMethodParameters(JNIEnv *env, jobject method);9394JNIEXPORT jint JNICALL95JVM_GetInterfaceVersion(void);9697/*************************************************************************98PART 1: Functions for Native Libraries99************************************************************************/100/*101* java.lang.Object102*/103JNIEXPORT jint JNICALL104JVM_IHashCode(JNIEnv *env, jobject obj);105106JNIEXPORT void JNICALL107JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);108109JNIEXPORT void JNICALL110JVM_MonitorNotify(JNIEnv *env, jobject obj);111112JNIEXPORT void JNICALL113JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);114115JNIEXPORT jobject JNICALL116JVM_Clone(JNIEnv *env, jobject obj);117118/*119* java.lang.String120*/121JNIEXPORT jstring JNICALL122JVM_InternString(JNIEnv *env, jstring str);123124/*125* java.lang.System126*/127JNIEXPORT jlong JNICALL128JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);129130JNIEXPORT jlong JNICALL131JVM_NanoTime(JNIEnv *env, jclass ignored);132133JNIEXPORT void JNICALL134JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,135jobject dst, jint dst_pos, jint length);136137JNIEXPORT jobject JNICALL138JVM_InitProperties(JNIEnv *env, jobject p);139140/*141* java.io.File142*/143JNIEXPORT void JNICALL144JVM_OnExit(void (*func)(void));145146/*147* java.nio.Bits148*/149JNIEXPORT void JNICALL150JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset,151jobject dstObj, jlong dstOffset, jlong size,152jlong elemSize);153154/*155* java.lang.Runtime156*/157JNIEXPORT void JNICALL158JVM_Exit(jint code);159160JNIEXPORT void JNICALL161JVM_BeforeHalt();162163JNIEXPORT void JNICALL164JVM_Halt(jint code);165166JNIEXPORT void JNICALL167JVM_GC(void);168169/* Returns the number of real-time milliseconds that have elapsed since the170* least-recently-inspected heap object was last inspected by the garbage171* collector.172*173* For simple stop-the-world collectors this value is just the time174* since the most recent collection. For generational collectors it is the175* time since the oldest generation was most recently collected. Other176* collectors are free to return a pessimistic estimate of the elapsed time, or177* simply the time since the last full collection was performed.178*179* Note that in the presence of reference objects, a given object that is no180* longer strongly reachable may have to be inspected multiple times before it181* can be reclaimed.182*/183JNIEXPORT jlong JNICALL184JVM_MaxObjectInspectionAge(void);185186JNIEXPORT void JNICALL187JVM_TraceInstructions(jboolean on);188189JNIEXPORT void JNICALL190JVM_TraceMethodCalls(jboolean on);191192JNIEXPORT jlong JNICALL193JVM_TotalMemory(void);194195JNIEXPORT jlong JNICALL196JVM_FreeMemory(void);197198JNIEXPORT jlong JNICALL199JVM_MaxMemory(void);200201JNIEXPORT jint JNICALL202JVM_ActiveProcessorCount(void);203204JNIEXPORT jboolean JNICALL205JVM_IsUseContainerSupport(void);206207JNIEXPORT void * JNICALL208JVM_LoadLibrary(const char *name);209210JNIEXPORT void JNICALL211JVM_UnloadLibrary(void * handle);212213JNIEXPORT void * JNICALL214JVM_FindLibraryEntry(void *handle, const char *name);215216JNIEXPORT jboolean JNICALL217JVM_IsSupportedJNIVersion(jint version);218219/*220* java.lang.Float and java.lang.Double221*/222JNIEXPORT jboolean JNICALL223JVM_IsNaN(jdouble d);224225/*226* java.lang.Throwable227*/228JNIEXPORT void JNICALL229JVM_FillInStackTrace(JNIEnv *env, jobject throwable);230231JNIEXPORT jint JNICALL232JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);233234JNIEXPORT jobject JNICALL235JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);236237/*238* java.lang.Compiler239*/240JNIEXPORT void JNICALL241JVM_InitializeCompiler (JNIEnv *env, jclass compCls);242243JNIEXPORT jboolean JNICALL244JVM_IsSilentCompiler(JNIEnv *env, jclass compCls);245246JNIEXPORT jboolean JNICALL247JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls);248249JNIEXPORT jboolean JNICALL250JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname);251252JNIEXPORT jobject JNICALL253JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg);254255JNIEXPORT void JNICALL256JVM_EnableCompiler(JNIEnv *env, jclass compCls);257258JNIEXPORT void JNICALL259JVM_DisableCompiler(JNIEnv *env, jclass compCls);260261/*262* java.lang.Thread263*/264JNIEXPORT void JNICALL265JVM_StartThread(JNIEnv *env, jobject thread);266267JNIEXPORT void JNICALL268JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);269270JNIEXPORT jboolean JNICALL271JVM_IsThreadAlive(JNIEnv *env, jobject thread);272273JNIEXPORT void JNICALL274JVM_SuspendThread(JNIEnv *env, jobject thread);275276JNIEXPORT void JNICALL277JVM_ResumeThread(JNIEnv *env, jobject thread);278279JNIEXPORT void JNICALL280JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);281282JNIEXPORT void JNICALL283JVM_Yield(JNIEnv *env, jclass threadClass);284285JNIEXPORT void JNICALL286JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);287288JNIEXPORT jobject JNICALL289JVM_CurrentThread(JNIEnv *env, jclass threadClass);290291JNIEXPORT jint JNICALL292JVM_CountStackFrames(JNIEnv *env, jobject thread);293294JNIEXPORT void JNICALL295JVM_Interrupt(JNIEnv *env, jobject thread);296297JNIEXPORT jboolean JNICALL298JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);299300JNIEXPORT jboolean JNICALL301JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);302303JNIEXPORT void JNICALL304JVM_DumpAllStacks(JNIEnv *env, jclass unused);305306JNIEXPORT jobjectArray JNICALL307JVM_GetAllThreads(JNIEnv *env, jclass dummy);308309JNIEXPORT void JNICALL310JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);311312/* getStackTrace() and getAllStackTraces() method */313JNIEXPORT jobjectArray JNICALL314JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);315316/*317* java.lang.SecurityManager318*/319JNIEXPORT jclass JNICALL320JVM_CurrentLoadedClass(JNIEnv *env);321322JNIEXPORT jobject JNICALL323JVM_CurrentClassLoader(JNIEnv *env);324325JNIEXPORT jobjectArray JNICALL326JVM_GetClassContext(JNIEnv *env);327328JNIEXPORT jint JNICALL329JVM_ClassDepth(JNIEnv *env, jstring name);330331JNIEXPORT jint JNICALL332JVM_ClassLoaderDepth(JNIEnv *env);333334/*335* java.lang.Package336*/337JNIEXPORT jstring JNICALL338JVM_GetSystemPackage(JNIEnv *env, jstring name);339340JNIEXPORT jobjectArray JNICALL341JVM_GetSystemPackages(JNIEnv *env);342343/*344* java.io.ObjectInputStream345*/346JNIEXPORT jobject JNICALL347JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass,348jclass initClass);349350JNIEXPORT jobject JNICALL351JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass,352jint length);353354JNIEXPORT jobject JNICALL355JVM_LatestUserDefinedLoader(JNIEnv *env);356357/*358* This function has been deprecated and should not be considered359* part of the specified JVM interface.360*/361JNIEXPORT jclass JNICALL362JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass,363jstring currClassName);364365/*366* java.lang.reflect.Array367*/368JNIEXPORT jint JNICALL369JVM_GetArrayLength(JNIEnv *env, jobject arr);370371JNIEXPORT jobject JNICALL372JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);373374JNIEXPORT jvalue JNICALL375JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);376377JNIEXPORT void JNICALL378JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);379380JNIEXPORT void JNICALL381JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,382unsigned char vCode);383384JNIEXPORT jobject JNICALL385JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);386387JNIEXPORT jobject JNICALL388JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);389390/*391* java.lang.Class and java.lang.ClassLoader392*/393394#define JVM_CALLER_DEPTH -1395396/*397* Returns the class in which the code invoking the native method398* belongs.399*400* Note that in JDK 1.1, native methods did not create a frame.401* In 1.2, they do. Therefore native methods like Class.forName402* can no longer look at the current frame for the caller class.403*/404JNIEXPORT jclass JNICALL405JVM_GetCallerClass(JNIEnv *env, int n);406407/*408* Find primitive classes409* utf: class name410*/411JNIEXPORT jclass JNICALL412JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);413414/*415* Link the class416*/417JNIEXPORT void JNICALL418JVM_ResolveClass(JNIEnv *env, jclass cls);419420/*421* Find a class from a given class loader. Throw ClassNotFoundException422* or NoClassDefFoundError depending on the value of the last423* argument.424*/425JNIEXPORT jclass JNICALL426JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,427jobject loader, jboolean throwError);428429/*430* Find a class from a boot class loader. Returns NULL if class not found.431*/432JNIEXPORT jclass JNICALL433JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);434435/*436* Find a class from a given class loader. Throws ClassNotFoundException.437* name: name of class438* init: whether initialization is done439* loader: class loader to look up the class. This may not be the same as the caller's440* class loader.441* caller: initiating class. The initiating class may be null when a security442* manager is not installed.443*/444JNIEXPORT jclass JNICALL445JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,446jobject loader, jclass caller);447448/*449* Find a class from a given class.450*/451JNIEXPORT jclass JNICALL452JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,453jclass from);454455/* Find a loaded class cached by the VM */456JNIEXPORT jclass JNICALL457JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);458459/* Define a class */460JNIEXPORT jclass JNICALL461JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,462jsize len, jobject pd);463464/* Define a class with a source (added in JDK1.5) */465JNIEXPORT jclass JNICALL466JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,467const jbyte *buf, jsize len, jobject pd,468const char *source);469470/* Define a class with a source with conditional verification (added HSX 14)471* -Xverify:all will verify anyway, -Xverify:none will not verify,472* -Xverify:remote (default) will obey this conditional473* i.e. true = should_verify_class474*/475JNIEXPORT jclass JNICALL476JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,477jobject loader, const jbyte *buf,478jsize len, jobject pd, const char *source,479jboolean verify);480481/*482* Reflection support functions483*/484485JNIEXPORT jstring JNICALL486JVM_GetClassName(JNIEnv *env, jclass cls);487488JNIEXPORT jobjectArray JNICALL489JVM_GetClassInterfaces(JNIEnv *env, jclass cls);490491JNIEXPORT jobject JNICALL492JVM_GetClassLoader(JNIEnv *env, jclass cls);493494JNIEXPORT jboolean JNICALL495JVM_IsInterface(JNIEnv *env, jclass cls);496497JNIEXPORT jobjectArray JNICALL498JVM_GetClassSigners(JNIEnv *env, jclass cls);499500JNIEXPORT void JNICALL501JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);502503JNIEXPORT jobject JNICALL504JVM_GetProtectionDomain(JNIEnv *env, jclass cls);505506JNIEXPORT jboolean JNICALL507JVM_IsArrayClass(JNIEnv *env, jclass cls);508509JNIEXPORT jboolean JNICALL510JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);511512JNIEXPORT jclass JNICALL513JVM_GetComponentType(JNIEnv *env, jclass cls);514515JNIEXPORT jint JNICALL516JVM_GetClassModifiers(JNIEnv *env, jclass cls);517518JNIEXPORT jobjectArray JNICALL519JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);520521JNIEXPORT jclass JNICALL522JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);523524/* Generics support (JDK 1.5) */525JNIEXPORT jstring JNICALL526JVM_GetClassSignature(JNIEnv *env, jclass cls);527528/* Annotations support (JDK 1.5) */529JNIEXPORT jbyteArray JNICALL530JVM_GetClassAnnotations(JNIEnv *env, jclass cls);531532/* Annotations support (JDK 1.6) */533534// field is a handle to a java.lang.reflect.Field object535JNIEXPORT jbyteArray JNICALL536JVM_GetFieldAnnotations(JNIEnv *env, jobject field);537538// method is a handle to a java.lang.reflect.Method object539JNIEXPORT jbyteArray JNICALL540JVM_GetMethodAnnotations(JNIEnv *env, jobject method);541542// method is a handle to a java.lang.reflect.Method object543JNIEXPORT jbyteArray JNICALL544JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method);545546// method is a handle to a java.lang.reflect.Method object547JNIEXPORT jbyteArray JNICALL548JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method);549550/* Type use annotations support (JDK 1.8) */551552JNIEXPORT jbyteArray JNICALL553JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);554555// field is a handle to a java.lang.reflect.Field object556JNIEXPORT jbyteArray JNICALL557JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);558559// method is a handle to a java.lang.reflect.Method object560JNIEXPORT jbyteArray JNICALL561JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);562563/*564* New (JDK 1.4) reflection implementation565*/566567JNIEXPORT jobjectArray JNICALL568JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);569570JNIEXPORT jobjectArray JNICALL571JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);572573JNIEXPORT jobjectArray JNICALL574JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);575576/* Differs from JVM_GetClassModifiers in treatment of inner classes.577This returns the access flags for the class as specified in the578class file rather than searching the InnerClasses attribute (if579present) to find the source-level access flags. Only the values of580the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be581valid. */582JNIEXPORT jint JNICALL583JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);584585/*586* Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)587*/588589JNIEXPORT jobject JNICALL590JVM_GetClassConstantPool(JNIEnv *env, jclass cls);591592JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize593(JNIEnv *env, jobject obj, jobject unused);594595JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt596(JNIEnv *env, jobject obj, jobject unused, jint index);597598JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded599(JNIEnv *env, jobject obj, jobject unused, jint index);600601JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt602(JNIEnv *env, jobject obj, jobject unused, jint index);603604JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded605(JNIEnv *env, jobject obj, jobject unused, jint index);606607JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt608(JNIEnv *env, jobject obj, jobject unused, jint index);609610JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded611(JNIEnv *env, jobject obj, jobject unused, jint index);612613JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt614(JNIEnv *env, jobject obj, jobject unused, jint index);615616JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt617(JNIEnv *env, jobject obj, jobject unused, jint index);618619JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt620(JNIEnv *env, jobject obj, jobject unused, jint index);621622JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt623(JNIEnv *env, jobject obj, jobject unused, jint index);624625JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt626(JNIEnv *env, jobject obj, jobject unused, jint index);627628JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt629(JNIEnv *env, jobject obj, jobject unused, jint index);630631JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At632(JNIEnv *env, jobject obj, jobject unused, jint index);633634/*635* java.security.*636*/637638JNIEXPORT jobject JNICALL639JVM_DoPrivileged(JNIEnv *env, jclass cls,640jobject action, jobject context, jboolean wrapException);641642JNIEXPORT jobject JNICALL643JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);644645JNIEXPORT jobject JNICALL646JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);647648/*649* Signal support, used to implement the shutdown sequence. Every VM must650* support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts651* (^C) and the latter for external termination (kill, system shutdown, etc.).652* Other platform-dependent signal values may also be supported.653*/654655JNIEXPORT void * JNICALL656JVM_RegisterSignal(jint sig, void *handler);657658JNIEXPORT jboolean JNICALL659JVM_RaiseSignal(jint sig);660661JNIEXPORT jint JNICALL662JVM_FindSignal(const char *name);663664/*665* Retrieve the assertion directives for the specified class.666*/667JNIEXPORT jboolean JNICALL668JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);669670/*671* Retrieve the assertion directives from the VM.672*/673JNIEXPORT jobject JNICALL674JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);675676/*677* java.util.concurrent.atomic.AtomicLong678*/679JNIEXPORT jboolean JNICALL680JVM_SupportsCX8(void);681682JNIEXPORT jboolean JNICALL683JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal);684685/*686* com.sun.dtrace.jsdt support687*/688689#define JVM_TRACING_DTRACE_VERSION 1690691/*692* Structure to pass one probe description to JVM.693*694* The VM will overwrite the definition of the referenced method with695* code that will fire the probe.696*/697typedef struct {698jmethodID method;699jstring function;700jstring name;701void* reserved[4]; // for future use702} JVM_DTraceProbe;703704/**705* Encapsulates the stability ratings for a DTrace provider field706*/707typedef struct {708jint nameStability;709jint dataStability;710jint dependencyClass;711} JVM_DTraceInterfaceAttributes;712713/*714* Structure to pass one provider description to JVM715*/716typedef struct {717jstring name;718JVM_DTraceProbe* probes;719jint probe_count;720JVM_DTraceInterfaceAttributes providerAttributes;721JVM_DTraceInterfaceAttributes moduleAttributes;722JVM_DTraceInterfaceAttributes functionAttributes;723JVM_DTraceInterfaceAttributes nameAttributes;724JVM_DTraceInterfaceAttributes argsAttributes;725void* reserved[4]; // for future use726} JVM_DTraceProvider;727728/*729* Get the version number the JVM was built with730*/731JNIEXPORT jint JNICALL732JVM_DTraceGetVersion(JNIEnv* env);733734/*735* Register new probe with given signature, return global handle736*737* The version passed in is the version that the library code was738* built with.739*/740JNIEXPORT jlong JNICALL741JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,742jint providers_count, JVM_DTraceProvider* providers);743744/*745* Check JSDT probe746*/747JNIEXPORT jboolean JNICALL748JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);749750/*751* Destroy custom DOF752*/753JNIEXPORT void JNICALL754JVM_DTraceDispose(JNIEnv* env, jlong handle);755756/*757* Check to see if DTrace is supported by OS758*/759JNIEXPORT jboolean JNICALL760JVM_DTraceIsSupported(JNIEnv* env);761762/*************************************************************************763PART 2: Support for the Verifier and Class File Format Checker764************************************************************************/765/*766* Return the class name in UTF format. The result is valid767* until JVM_ReleaseUTf is called.768*769* The caller must treat the string as a constant and not modify it770* in any way.771*/772JNIEXPORT const char * JNICALL773JVM_GetClassNameUTF(JNIEnv *env, jclass cb);774775/*776* Returns the constant pool types in the buffer provided by "types."777*/778JNIEXPORT void JNICALL779JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);780781/*782* Returns the number of Constant Pool entries.783*/784JNIEXPORT jint JNICALL785JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);786787/*788* Returns the number of *declared* fields or methods.789*/790JNIEXPORT jint JNICALL791JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);792793JNIEXPORT jint JNICALL794JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);795796/*797* Returns the CP indexes of exceptions raised by a given method.798* Places the result in the given buffer.799*800* The method is identified by method_index.801*/802JNIEXPORT void JNICALL803JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,804unsigned short *exceptions);805/*806* Returns the number of exceptions raised by a given method.807* The method is identified by method_index.808*/809JNIEXPORT jint JNICALL810JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);811812/*813* Returns the byte code sequence of a given method.814* Places the result in the given buffer.815*816* The method is identified by method_index.817*/818JNIEXPORT void JNICALL819JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,820unsigned char *code);821822/*823* Returns the length of the byte code sequence of a given method.824* The method is identified by method_index.825*/826JNIEXPORT jint JNICALL827JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);828829/*830* A structure used to a capture exception table entry in a Java method.831*/832typedef struct {833jint start_pc;834jint end_pc;835jint handler_pc;836jint catchType;837} JVM_ExceptionTableEntryType;838839/*840* Returns the exception table entry at entry_index of a given method.841* Places the result in the given buffer.842*843* The method is identified by method_index.844*/845JNIEXPORT void JNICALL846JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,847jint entry_index,848JVM_ExceptionTableEntryType *entry);849850/*851* Returns the length of the exception table of a given method.852* The method is identified by method_index.853*/854JNIEXPORT jint JNICALL855JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);856857/*858* Returns the modifiers of a given field.859* The field is identified by field_index.860*/861JNIEXPORT jint JNICALL862JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);863864/*865* Returns the modifiers of a given method.866* The method is identified by method_index.867*/868JNIEXPORT jint JNICALL869JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);870871/*872* Returns the number of local variables of a given method.873* The method is identified by method_index.874*/875JNIEXPORT jint JNICALL876JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);877878/*879* Returns the number of arguments (including this pointer) of a given method.880* The method is identified by method_index.881*/882JNIEXPORT jint JNICALL883JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);884885/*886* Returns the maximum amount of stack (in words) used by a given method.887* The method is identified by method_index.888*/889JNIEXPORT jint JNICALL890JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);891892/*893* Is a given method a constructor.894* The method is identified by method_index.895*/896JNIEXPORT jboolean JNICALL897JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);898899/*900* Is the given method generated by the VM.901* The method is identified by method_index.902*/903JNIEXPORT jboolean JNICALL904JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);905906/*907* Returns the name of a given method in UTF format.908* The result remains valid until JVM_ReleaseUTF is called.909*910* The caller must treat the string as a constant and not modify it911* in any way.912*/913JNIEXPORT const char * JNICALL914JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);915916/*917* Returns the signature of a given method in UTF format.918* The result remains valid until JVM_ReleaseUTF is called.919*920* The caller must treat the string as a constant and not modify it921* in any way.922*/923JNIEXPORT const char * JNICALL924JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);925926/*927* Returns the name of the field refered to at a given constant pool928* index.929*930* The result is in UTF format and remains valid until JVM_ReleaseUTF931* is called.932*933* The caller must treat the string as a constant and not modify it934* in any way.935*/936JNIEXPORT const char * JNICALL937JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);938939/*940* Returns the name of the method refered to at a given constant pool941* index.942*943* The result is in UTF format and remains valid until JVM_ReleaseUTF944* is called.945*946* The caller must treat the string as a constant and not modify it947* in any way.948*/949JNIEXPORT const char * JNICALL950JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);951952/*953* Returns the signature of the method refered to at a given constant pool954* index.955*956* The result is in UTF format and remains valid until JVM_ReleaseUTF957* is called.958*959* The caller must treat the string as a constant and not modify it960* in any way.961*/962JNIEXPORT const char * JNICALL963JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);964965/*966* Returns the signature of the field refered to at a given constant pool967* index.968*969* The result is in UTF format and remains valid until JVM_ReleaseUTF970* is called.971*972* The caller must treat the string as a constant and not modify it973* in any way.974*/975JNIEXPORT const char * JNICALL976JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);977978/*979* Returns the class name refered to at a given constant pool index.980*981* The result is in UTF format and remains valid until JVM_ReleaseUTF982* is called.983*984* The caller must treat the string as a constant and not modify it985* in any way.986*/987JNIEXPORT const char * JNICALL988JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);989990/*991* Returns the class name refered to at a given constant pool index.992*993* The constant pool entry must refer to a CONSTANT_Fieldref.994*995* The result is in UTF format and remains valid until JVM_ReleaseUTF996* is called.997*998* The caller must treat the string as a constant and not modify it999* in any way.1000*/1001JNIEXPORT const char * JNICALL1002JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);10031004/*1005* Returns the class name refered to at a given constant pool index.1006*1007* The constant pool entry must refer to CONSTANT_Methodref or1008* CONSTANT_InterfaceMethodref.1009*1010* The result is in UTF format and remains valid until JVM_ReleaseUTF1011* is called.1012*1013* The caller must treat the string as a constant and not modify it1014* in any way.1015*/1016JNIEXPORT const char * JNICALL1017JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);10181019/*1020* Returns the modifiers of a field in calledClass. The field is1021* referred to in class cb at constant pool entry index.1022*1023* The caller must treat the string as a constant and not modify it1024* in any way.1025*1026* Returns -1 if the field does not exist in calledClass.1027*/1028JNIEXPORT jint JNICALL1029JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);10301031/*1032* Returns the modifiers of a method in calledClass. The method is1033* referred to in class cb at constant pool entry index.1034*1035* Returns -1 if the method does not exist in calledClass.1036*/1037JNIEXPORT jint JNICALL1038JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);10391040/*1041* Releases the UTF string obtained from the VM.1042*/1043JNIEXPORT void JNICALL1044JVM_ReleaseUTF(const char *utf);10451046/*1047* Compare if two classes are in the same package.1048*/1049JNIEXPORT jboolean JNICALL1050JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);10511052/* Constants in class files */10531054#define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */1055#define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */1056#define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */1057#define JVM_ACC_STATIC 0x0008 /* instance variable is static */1058#define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */1059#define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */1060#define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */1061#define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */1062#define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */1063#define JVM_ACC_TRANSIENT 0x0080 /* not persistent */1064#define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */1065#define JVM_ACC_NATIVE 0x0100 /* implemented in C */1066#define JVM_ACC_INTERFACE 0x0200 /* class is an interface */1067#define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */1068#define JVM_ACC_STRICT 0x0800 /* strict floating point */1069#define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */1070#define JVM_ACC_ANNOTATION 0x2000 /* annotation type */1071#define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */10721073#define JVM_ACC_PUBLIC_BIT 01074#define JVM_ACC_PRIVATE_BIT 11075#define JVM_ACC_PROTECTED_BIT 21076#define JVM_ACC_STATIC_BIT 31077#define JVM_ACC_FINAL_BIT 41078#define JVM_ACC_SYNCHRONIZED_BIT 51079#define JVM_ACC_SUPER_BIT 51080#define JVM_ACC_VOLATILE_BIT 61081#define JVM_ACC_BRIDGE_BIT 61082#define JVM_ACC_TRANSIENT_BIT 71083#define JVM_ACC_VARARGS_BIT 71084#define JVM_ACC_NATIVE_BIT 81085#define JVM_ACC_INTERFACE_BIT 91086#define JVM_ACC_ABSTRACT_BIT 101087#define JVM_ACC_STRICT_BIT 111088#define JVM_ACC_SYNTHETIC_BIT 121089#define JVM_ACC_ANNOTATION_BIT 131090#define JVM_ACC_ENUM_BIT 1410911092// NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java1093enum {1094JVM_CONSTANT_Utf8 = 1,1095JVM_CONSTANT_Unicode, /* unused */1096JVM_CONSTANT_Integer,1097JVM_CONSTANT_Float,1098JVM_CONSTANT_Long,1099JVM_CONSTANT_Double,1100JVM_CONSTANT_Class,1101JVM_CONSTANT_String,1102JVM_CONSTANT_Fieldref,1103JVM_CONSTANT_Methodref,1104JVM_CONSTANT_InterfaceMethodref,1105JVM_CONSTANT_NameAndType,1106JVM_CONSTANT_MethodHandle = 15, // JSR 2921107JVM_CONSTANT_MethodType = 16, // JSR 2921108//JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only1109JVM_CONSTANT_InvokeDynamic = 18, // JSR 2921110JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles1111};11121113/* JVM_CONSTANT_MethodHandle subtypes */1114enum {1115JVM_REF_getField = 1,1116JVM_REF_getStatic = 2,1117JVM_REF_putField = 3,1118JVM_REF_putStatic = 4,1119JVM_REF_invokeVirtual = 5,1120JVM_REF_invokeStatic = 6,1121JVM_REF_invokeSpecial = 7,1122JVM_REF_newInvokeSpecial = 8,1123JVM_REF_invokeInterface = 91124};11251126/* Used in the newarray instruction. */11271128#define JVM_T_BOOLEAN 41129#define JVM_T_CHAR 51130#define JVM_T_FLOAT 61131#define JVM_T_DOUBLE 71132#define JVM_T_BYTE 81133#define JVM_T_SHORT 91134#define JVM_T_INT 101135#define JVM_T_LONG 1111361137/* JVM method signatures */11381139#define JVM_SIGNATURE_ARRAY '['1140#define JVM_SIGNATURE_BYTE 'B'1141#define JVM_SIGNATURE_CHAR 'C'1142#define JVM_SIGNATURE_CLASS 'L'1143#define JVM_SIGNATURE_ENDCLASS ';'1144#define JVM_SIGNATURE_ENUM 'E'1145#define JVM_SIGNATURE_FLOAT 'F'1146#define JVM_SIGNATURE_DOUBLE 'D'1147#define JVM_SIGNATURE_FUNC '('1148#define JVM_SIGNATURE_ENDFUNC ')'1149#define JVM_SIGNATURE_INT 'I'1150#define JVM_SIGNATURE_LONG 'J'1151#define JVM_SIGNATURE_SHORT 'S'1152#define JVM_SIGNATURE_VOID 'V'1153#define JVM_SIGNATURE_BOOLEAN 'Z'11541155/*1156* A function defined by the byte-code verifier and called by the VM.1157* This is not a function implemented in the VM.1158*1159* Returns JNI_FALSE if verification fails. A detailed error message1160* will be places in msg_buf, whose length is specified by buf_len.1161*/1162typedef jboolean (*verifier_fn_t)(JNIEnv *env,1163jclass cb,1164char * msg_buf,1165jint buf_len);116611671168/*1169* Support for a VM-independent class format checker.1170*/1171typedef struct {1172unsigned long code; /* byte code */1173unsigned long excs; /* exceptions */1174unsigned long etab; /* catch table */1175unsigned long lnum; /* line number */1176unsigned long lvar; /* local vars */1177} method_size_info;11781179typedef struct {1180unsigned int constants; /* constant pool */1181unsigned int fields;1182unsigned int methods;1183unsigned int interfaces;1184unsigned int fields2; /* number of static 2-word fields */1185unsigned int innerclasses; /* # of records in InnerClasses attr */11861187method_size_info clinit; /* memory used in clinit */1188method_size_info main; /* used everywhere else */1189} class_size_info;11901191/*1192* Functions defined in libjava.so to perform string conversions.1193*1194*/11951196typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);11971198typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);11991200/* This is the function defined in libjava.so that performs class1201* format checks. This functions fills in size information about1202* the class file and returns:1203*1204* 0: good1205* -1: out of memory1206* -2: bad format1207* -3: unsupported version1208* -4: bad class name1209*/12101211typedef jint (*check_format_fn_t)(char *class_name,1212unsigned char *data,1213unsigned int data_size,1214class_size_info *class_size,1215char *message_buffer,1216jint buffer_length,1217jboolean measure_only,1218jboolean check_relaxed);12191220#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \1221JVM_ACC_FINAL | \1222JVM_ACC_SUPER | \1223JVM_ACC_INTERFACE | \1224JVM_ACC_ABSTRACT | \1225JVM_ACC_ANNOTATION | \1226JVM_ACC_ENUM | \1227JVM_ACC_SYNTHETIC)12281229#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \1230JVM_ACC_PRIVATE | \1231JVM_ACC_PROTECTED | \1232JVM_ACC_STATIC | \1233JVM_ACC_FINAL | \1234JVM_ACC_VOLATILE | \1235JVM_ACC_TRANSIENT | \1236JVM_ACC_ENUM | \1237JVM_ACC_SYNTHETIC)12381239#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \1240JVM_ACC_PRIVATE | \1241JVM_ACC_PROTECTED | \1242JVM_ACC_STATIC | \1243JVM_ACC_FINAL | \1244JVM_ACC_SYNCHRONIZED | \1245JVM_ACC_BRIDGE | \1246JVM_ACC_VARARGS | \1247JVM_ACC_NATIVE | \1248JVM_ACC_ABSTRACT | \1249JVM_ACC_STRICT | \1250JVM_ACC_SYNTHETIC)12511252/*1253* This is the function defined in libjava.so to perform path1254* canonicalization. VM call this function before opening jar files1255* to load system classes.1256*1257*/12581259typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);12601261/*************************************************************************1262PART 3: I/O and Network Support1263************************************************************************/12641265/* Note that the JVM IO functions are expected to return JVM_IO_ERR1266* when there is any kind of error. The caller can then use the1267* platform specific support (e.g., errno) to get the detailed1268* error info. The JVM_GetLastErrorString procedure may also be used1269* to obtain a descriptive error string.1270*/1271#define JVM_IO_ERR (-1)12721273/* For interruptible IO. Returning JVM_IO_INTR indicates that an IO1274* operation has been disrupted by Thread.interrupt. There are a1275* number of technical difficulties related to interruptible IO that1276* need to be solved. For example, most existing programs do not handle1277* InterruptedIOExceptions specially, they simply treat those as any1278* IOExceptions, which typically indicate fatal errors.1279*1280* There are also two modes of operation for interruptible IO. In the1281* resumption mode, an interrupted IO operation is guaranteed not to1282* have any side-effects, and can be restarted. In the termination mode,1283* an interrupted IO operation corrupts the underlying IO stream, so1284* that the only reasonable operation on an interrupted stream is to1285* close that stream. The resumption mode seems to be impossible to1286* implement on Win32 and Solaris. Implementing the termination mode is1287* easier, but it's not clear that's the right semantics.1288*1289* Interruptible IO is not supported on Win32.It can be enabled/disabled1290* using a compile-time flag on Solaris. Third-party JVM ports do not1291* need to implement interruptible IO.1292*/1293#define JVM_IO_INTR (-2)12941295/* Write a string into the given buffer, in the platform's local encoding,1296* that describes the most recent system-level error to occur in this thread.1297* Return the length of the string or zero if no error occurred.1298*/1299JNIEXPORT jint JNICALL1300JVM_GetLastErrorString(char *buf, int len);13011302/*1303* Convert a pathname into native format. This function does syntactic1304* cleanup, such as removing redundant separator characters. It modifies1305* the given pathname string in place.1306*/1307JNIEXPORT char * JNICALL1308JVM_NativePath(char *);13091310/*1311* JVM I/O error codes1312*/1313#define JVM_EEXIST -10013141315/*1316* Open a file descriptor. This function returns a negative error code1317* on error, and a non-negative integer that is the file descriptor on1318* success.1319*/1320JNIEXPORT jint JNICALL1321JVM_Open(const char *fname, jint flags, jint mode);13221323/*1324* Close a file descriptor. This function returns -1 on error, and 01325* on success.1326*1327* fd the file descriptor to close.1328*/1329JNIEXPORT jint JNICALL1330JVM_Close(jint fd);13311332/*1333* Read data from a file decriptor into a char array.1334*1335* fd the file descriptor to read from.1336* buf the buffer where to put the read data.1337* nbytes the number of bytes to read.1338*1339* This function returns -1 on error, and 0 on success.1340*/1341JNIEXPORT jint JNICALL1342JVM_Read(jint fd, char *buf, jint nbytes);13431344/*1345* Write data from a char array to a file decriptor.1346*1347* fd the file descriptor to read from.1348* buf the buffer from which to fetch the data.1349* nbytes the number of bytes to write.1350*1351* This function returns -1 on error, and 0 on success.1352*/1353JNIEXPORT jint JNICALL1354JVM_Write(jint fd, char *buf, jint nbytes);13551356/*1357* Returns the number of bytes available for reading from a given file1358* descriptor1359*/1360JNIEXPORT jint JNICALL1361JVM_Available(jint fd, jlong *pbytes);13621363/*1364* Move the file descriptor pointer from whence by offset.1365*1366* fd the file descriptor to move.1367* offset the number of bytes to move it by.1368* whence the start from where to move it.1369*1370* This function returns the resulting pointer location.1371*/1372JNIEXPORT jlong JNICALL1373JVM_Lseek(jint fd, jlong offset, jint whence);13741375/*1376* Set the length of the file associated with the given descriptor to the given1377* length. If the new length is longer than the current length then the file1378* is extended; the contents of the extended portion are not defined. The1379* value of the file pointer is undefined after this procedure returns.1380*/1381JNIEXPORT jint JNICALL1382JVM_SetLength(jint fd, jlong length);13831384/*1385* Synchronize the file descriptor's in memory state with that of the1386* physical device. Return of -1 is an error, 0 is OK.1387*/1388JNIEXPORT jint JNICALL1389JVM_Sync(jint fd);13901391/*1392* Networking library support1393*/13941395JNIEXPORT jint JNICALL1396JVM_InitializeSocketLibrary(void);13971398struct sockaddr;13991400JNIEXPORT jint JNICALL1401JVM_Socket(jint domain, jint type, jint protocol);14021403JNIEXPORT jint JNICALL1404JVM_SocketClose(jint fd);14051406JNIEXPORT jint JNICALL1407JVM_SocketShutdown(jint fd, jint howto);14081409JNIEXPORT jint JNICALL1410JVM_Recv(jint fd, char *buf, jint nBytes, jint flags);14111412JNIEXPORT jint JNICALL1413JVM_Send(jint fd, char *buf, jint nBytes, jint flags);14141415JNIEXPORT jint JNICALL1416JVM_Timeout(int fd, long timeout);14171418JNIEXPORT jint JNICALL1419JVM_Listen(jint fd, jint count);14201421JNIEXPORT jint JNICALL1422JVM_Connect(jint fd, struct sockaddr *him, jint len);14231424JNIEXPORT jint JNICALL1425JVM_Bind(jint fd, struct sockaddr *him, jint len);14261427JNIEXPORT jint JNICALL1428JVM_Accept(jint fd, struct sockaddr *him, jint *len);14291430JNIEXPORT jint JNICALL1431JVM_RecvFrom(jint fd, char *buf, int nBytes,1432int flags, struct sockaddr *from, int *fromlen);14331434JNIEXPORT jint JNICALL1435JVM_SendTo(jint fd, char *buf, int len,1436int flags, struct sockaddr *to, int tolen);14371438JNIEXPORT jint JNICALL1439JVM_SocketAvailable(jint fd, jint *result);144014411442JNIEXPORT jint JNICALL1443JVM_GetSockName(jint fd, struct sockaddr *him, int *len);14441445JNIEXPORT jint JNICALL1446JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);14471448JNIEXPORT jint JNICALL1449JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);14501451JNIEXPORT int JNICALL1452JVM_GetHostName(char* name, int namelen);14531454/*1455* The standard printing functions supported by the Java VM. (Should they1456* be renamed to JVM_* in the future?1457*/14581459/*1460* BE CAREFUL! The following functions do not implement the1461* full feature set of standard C printf formats.1462*/1463JNIEXPORT int1464jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);14651466JNIEXPORT int1467jio_snprintf(char *str, size_t count, const char *fmt, ...);14681469JNIEXPORT int1470jio_fprintf(FILE *, const char *fmt, ...);14711472JNIEXPORT int1473jio_vfprintf(FILE *, const char *fmt, va_list args);147414751476JNIEXPORT void * JNICALL1477JVM_RawMonitorCreate(void);14781479JNIEXPORT void JNICALL1480JVM_RawMonitorDestroy(void *mon);14811482JNIEXPORT jint JNICALL1483JVM_RawMonitorEnter(void *mon);14841485JNIEXPORT void JNICALL1486JVM_RawMonitorExit(void *mon);14871488/*1489* java.lang.reflect.Method1490*/1491JNIEXPORT jobject JNICALL1492JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);14931494/*1495* java.lang.reflect.Constructor1496*/1497JNIEXPORT jobject JNICALL1498JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);14991500/*1501* java.lang.management support1502*/1503JNIEXPORT void* JNICALL1504JVM_GetManagement(jint version);15051506/*1507* com.sun.tools.attach.VirtualMachine support1508*1509* Initialize the agent properties with the properties maintained in the VM.1510*/1511JNIEXPORT jobject JNICALL1512JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);15131514JNIEXPORT jstring JNICALL1515JVM_GetTemporaryDirectory(JNIEnv *env);15161517/* Generics reflection support.1518*1519* Returns information about the given class's EnclosingMethod1520* attribute, if present, or null if the class had no enclosing1521* method.1522*1523* If non-null, the returned array contains three elements. Element 01524* is the java.lang.Class of which the enclosing method is a member,1525* and elements 1 and 2 are the java.lang.Strings for the enclosing1526* method's name and descriptor, respectively.1527*/1528JNIEXPORT jobjectArray JNICALL1529JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);15301531/*1532* Java thread state support1533*/1534enum {1535JAVA_THREAD_STATE_NEW = 0,1536JAVA_THREAD_STATE_RUNNABLE = 1,1537JAVA_THREAD_STATE_BLOCKED = 2,1538JAVA_THREAD_STATE_WAITING = 3,1539JAVA_THREAD_STATE_TIMED_WAITING = 4,1540JAVA_THREAD_STATE_TERMINATED = 5,1541JAVA_THREAD_STATE_COUNT = 61542};15431544/*1545* Returns an array of the threadStatus values representing the1546* given Java thread state. Returns NULL if the VM version is1547* incompatible with the JDK or doesn't support the given1548* Java thread state.1549*/1550JNIEXPORT jintArray JNICALL1551JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState);15521553/*1554* Returns an array of the substate names representing the1555* given Java thread state. Returns NULL if the VM version is1556* incompatible with the JDK or the VM doesn't support1557* the given Java thread state.1558* values must be the jintArray returned from JVM_GetThreadStateValues1559* and javaThreadState.1560*/1561JNIEXPORT jobjectArray JNICALL1562JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);15631564/*1565* Returns true if the JVM's lookup cache indicates that this class is1566* known to NOT exist for the given loader.1567*/1568JNIEXPORT jboolean JNICALL1569JVM_KnownToNotExist(JNIEnv *env, jobject loader, const char *classname);15701571/*1572* Returns an array of all URLs that are stored in the JVM's lookup cache1573* for the given loader. NULL if the lookup cache is unavailable.1574*/1575JNIEXPORT jobjectArray JNICALL1576JVM_GetResourceLookupCacheURLs(JNIEnv *env, jobject loader);15771578/*1579* Returns an array of all URLs that *may* contain the resource_name for the1580* given loader. This function returns an integer array, each element1581* of which can be used to index into the array returned by1582* JVM_GetResourceLookupCacheURLs of the same loader to determine the1583* URLs.1584*/1585JNIEXPORT jintArray JNICALL1586JVM_GetResourceLookupCache(JNIEnv *env, jobject loader, const char *resource_name);158715881589/* =========================================================================1590* The following defines a private JVM interface that the JDK can query1591* for the JVM version and capabilities. sun.misc.Version defines1592* the methods for getting the VM version and its capabilities.1593*1594* When a new bit is added, the following should be updated to provide1595* access to the new capability:1596* HS: JVM_GetVersionInfo and Abstract_VM_Version class1597* SDK: Version class1598*1599* Similary, a private JDK interface JDK_GetVersionInfo0 is defined for1600* JVM to query for the JDK version and capabilities.1601*1602* When a new bit is added, the following should be updated to provide1603* access to the new capability:1604* HS: JDK_Version class1605* SDK: JDK_GetVersionInfo01606*1607* ==========================================================================1608*/1609typedef struct {1610/* HotSpot Express VM version string:1611* <major>.<minor>-bxx[-<identifier>][-<debug_flavor>]1612*/1613unsigned int jvm_version; /* Consists of major.minor.0.build */1614unsigned int update_version : 8; /* 0 in HotSpot Express VM */1615unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */1616unsigned int reserved1 : 16;1617unsigned int reserved2;16181619/* The following bits represents JVM supports that JDK has dependency on.1620* JDK can use these bits to determine which JVM version1621* and support it has to maintain runtime compatibility.1622*1623* When a new bit is added in a minor or update release, make sure1624* the new bit is also added in the main/baseline.1625*/1626unsigned int is_attachable : 1;1627unsigned int : 31;1628unsigned int : 32;1629unsigned int : 32;1630} jvm_version_info;16311632#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)1633#define JVM_VERSION_MINOR(version) ((version & 0x00FFFF00) >> 8)1634// Micro version is 0 in HotSpot Express VM (set in jvm.cpp).1635#define JVM_VERSION_MICRO(version) 01636/* Build number is available in all HotSpot Express VM builds.1637* It is defined in make/hotspot_version file.1638*/1639#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))16401641JNIEXPORT void JNICALL1642JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);16431644typedef struct {1645// Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx1646unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */1647/* and build number (xx) */1648unsigned int update_version : 16; /* Update release version (uu) */1649unsigned int special_update_version : 8; /* Special update release version (c)*/1650unsigned int reserved1 : 8;1651unsigned int reserved2;16521653/* The following bits represents new JDK supports that VM has dependency on.1654* VM implementation can use these bits to determine which JDK version1655* and support it has to maintain runtime compatibility.1656*1657* When a new bit is added in a minor or update release, make sure1658* the new bit is also added in the main/baseline.1659*/1660unsigned int thread_park_blocker : 1;1661unsigned int post_vm_init_hook_enabled : 1;1662unsigned int pending_list_uses_discovered_field : 1;1663unsigned int : 29;1664unsigned int : 32;1665unsigned int : 32;1666} jdk_version_info;16671668#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)1669#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)1670#define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)16711672/* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN)1673* It will be zero for internal builds.1674*/1675#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))16761677/*1678* This is the function JDK_GetVersionInfo0 defined in libjava.so1679* that is dynamically looked up by JVM.1680*/1681typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);16821683/*1684* This structure is used by the launcher to get the default thread1685* stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a1686* version of 1.1. As it is not supported otherwise, it has been removed1687* from jni.h1688*/1689typedef struct JDK1_1InitArgs {1690jint version;16911692char **properties;1693jint checkSource;1694jint nativeStackSize;1695jint javaStackSize;1696jint minHeapSize;1697jint maxHeapSize;1698jint verifyMode;1699char *classpath;17001701jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);1702void (JNICALL *exit)(jint code);1703void (JNICALL *abort)(void);17041705jint enableClassGC;1706jint enableVerboseGC;1707jint disableAsyncGC;1708jint verbose;1709jboolean debugging;1710jint debugPort;1711} JDK1_1InitArgs;17121713#ifdef __cplusplus1714} /* extern "C" */1715#endif /* __cplusplus */17161717#endif /* !_JAVASOFT_JVM_H_ */17181719#endif // SHARE_VM_PRIMS_JVM_H172017211722