aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_PRIMS_JVM_H aoqi@0: #define SHARE_VM_PRIMS_JVM_H aoqi@0: aoqi@0: #include "prims/jni.h" aoqi@0: #ifdef TARGET_OS_FAMILY_linux aoqi@0: # include "jvm_linux.h" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_FAMILY_solaris aoqi@0: # include "jvm_solaris.h" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_FAMILY_windows aoqi@0: # include "jvm_windows.h" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_FAMILY_aix aoqi@0: # include "jvm_aix.h" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_FAMILY_bsd aoqi@0: # include "jvm_bsd.h" aoqi@0: #endif aoqi@0: aoqi@0: #ifndef _JAVASOFT_JVM_H_ aoqi@0: #define _JAVASOFT_JVM_H_ aoqi@0: aoqi@0: // HotSpot integration note: aoqi@0: // aoqi@0: // This file and jvm.h used with the JDK are identical, aoqi@0: // except for the three includes removed below aoqi@0: aoqi@0: // #include aoqi@0: // #include "jni.h" aoqi@0: // #include "jvm_md.h" aoqi@0: aoqi@0: aoqi@0: #ifdef __cplusplus aoqi@0: extern "C" { aoqi@0: #endif aoqi@0: aoqi@0: /* aoqi@0: * This file contains additional functions exported from the VM. aoqi@0: * These functions are complementary to the standard JNI support. aoqi@0: * There are three parts to this file: aoqi@0: * aoqi@0: * First, this file contains the VM-related functions needed by native aoqi@0: * libraries in the standard Java API. For example, the java.lang.Object aoqi@0: * class needs VM-level functions that wait for and notify monitors. aoqi@0: * aoqi@0: * Second, this file contains the functions and constant definitions aoqi@0: * needed by the byte code verifier and class file format checker. aoqi@0: * These functions allow the verifier and format checker to be written aoqi@0: * in a VM-independent way. aoqi@0: * aoqi@0: * Third, this file contains various I/O and nerwork operations needed aoqi@0: * by the standard Java I/O and network APIs. aoqi@0: */ aoqi@0: aoqi@0: /* aoqi@0: * Bump the version number when either of the following happens: aoqi@0: * aoqi@0: * 1. There is a change in JVM_* functions. aoqi@0: * aoqi@0: * 2. There is a change in the contract between VM and Java classes. aoqi@0: * For example, if the VM relies on a new private field in Thread aoqi@0: * class. aoqi@0: */ aoqi@0: aoqi@0: #define JVM_INTERFACE_VERSION 4 aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetMethodParameters(JNIEnv *env, jobject method); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetInterfaceVersion(void); aoqi@0: aoqi@0: /************************************************************************* aoqi@0: PART 1: Functions for Native Libraries aoqi@0: ************************************************************************/ aoqi@0: /* aoqi@0: * java.lang.Object aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_IHashCode(JNIEnv *env, jobject obj); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_MonitorNotify(JNIEnv *env, jobject obj); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_MonitorNotifyAll(JNIEnv *env, jobject obj); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_Clone(JNIEnv *env, jobject obj); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.String aoqi@0: */ aoqi@0: JNIEXPORT jstring JNICALL aoqi@0: JVM_InternString(JNIEnv *env, jstring str); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.System aoqi@0: */ aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); aoqi@0: aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_NanoTime(JNIEnv *env, jclass ignored); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, aoqi@0: jobject dst, jint dst_pos, jint length); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_InitProperties(JNIEnv *env, jobject p); aoqi@0: aoqi@0: /* aoqi@0: * java.io.File aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_OnExit(void (*func)(void)); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Runtime aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_Exit(jint code); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_Halt(jint code); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_GC(void); aoqi@0: aoqi@0: /* Returns the number of real-time milliseconds that have elapsed since the aoqi@0: * least-recently-inspected heap object was last inspected by the garbage aoqi@0: * collector. aoqi@0: * aoqi@0: * For simple stop-the-world collectors this value is just the time aoqi@0: * since the most recent collection. For generational collectors it is the aoqi@0: * time since the oldest generation was most recently collected. Other aoqi@0: * collectors are free to return a pessimistic estimate of the elapsed time, or aoqi@0: * simply the time since the last full collection was performed. aoqi@0: * aoqi@0: * Note that in the presence of reference objects, a given object that is no aoqi@0: * longer strongly reachable may have to be inspected multiple times before it aoqi@0: * can be reclaimed. aoqi@0: */ aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_MaxObjectInspectionAge(void); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_TraceInstructions(jboolean on); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_TraceMethodCalls(jboolean on); aoqi@0: aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_TotalMemory(void); aoqi@0: aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_FreeMemory(void); aoqi@0: aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_MaxMemory(void); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_ActiveProcessorCount(void); aoqi@0: aoqi@0: JNIEXPORT void * JNICALL aoqi@0: JVM_LoadLibrary(const char *name); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_UnloadLibrary(void * handle); aoqi@0: aoqi@0: JNIEXPORT void * JNICALL aoqi@0: JVM_FindLibraryEntry(void *handle, const char *name); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsSupportedJNIVersion(jint version); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Float and java.lang.Double aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsNaN(jdouble d); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Throwable aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_FillInStackTrace(JNIEnv *env, jobject throwable); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Compiler aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_InitializeCompiler (JNIEnv *env, jclass compCls); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsSilentCompiler(JNIEnv *env, jclass compCls); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_EnableCompiler(JNIEnv *env, jclass compCls); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_DisableCompiler(JNIEnv *env, jclass compCls); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Thread aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_StartThread(JNIEnv *env, jobject thread); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_StopThread(JNIEnv *env, jobject thread, jobject exception); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsThreadAlive(JNIEnv *env, jobject thread); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_SuspendThread(JNIEnv *env, jobject thread); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_ResumeThread(JNIEnv *env, jobject thread); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_Yield(JNIEnv *env, jclass threadClass); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_CurrentThread(JNIEnv *env, jclass threadClass); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_CountStackFrames(JNIEnv *env, jobject thread); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_Interrupt(JNIEnv *env, jobject thread); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_DumpAllStacks(JNIEnv *env, jclass unused); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetAllThreads(JNIEnv *env, jclass dummy); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name); aoqi@0: aoqi@0: /* getStackTrace() and getAllStackTraces() method */ aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.SecurityManager aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_CurrentLoadedClass(JNIEnv *env); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_CurrentClassLoader(JNIEnv *env); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetClassContext(JNIEnv *env); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_ClassDepth(JNIEnv *env, jstring name); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_ClassLoaderDepth(JNIEnv *env); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Package aoqi@0: */ aoqi@0: JNIEXPORT jstring JNICALL aoqi@0: JVM_GetSystemPackage(JNIEnv *env, jstring name); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetSystemPackages(JNIEnv *env); aoqi@0: aoqi@0: /* aoqi@0: * java.io.ObjectInputStream aoqi@0: */ aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass, aoqi@0: jclass initClass); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, aoqi@0: jint length); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_LatestUserDefinedLoader(JNIEnv *env); aoqi@0: aoqi@0: /* aoqi@0: * This function has been deprecated and should not be considered aoqi@0: * part of the specified JVM interface. aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass, aoqi@0: jstring currClassName); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.reflect.Array aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetArrayLength(JNIEnv *env, jobject arr); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); aoqi@0: aoqi@0: JNIEXPORT jvalue JNICALL aoqi@0: JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, aoqi@0: unsigned char vCode); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_NewArray(JNIEnv *env, jclass eltClass, jint length); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.Class and java.lang.ClassLoader aoqi@0: */ aoqi@0: aoqi@0: #define JVM_CALLER_DEPTH -1 aoqi@0: aoqi@0: /* aoqi@0: * Returns the class in which the code invoking the native method aoqi@0: * belongs. aoqi@0: * aoqi@0: * Note that in JDK 1.1, native methods did not create a frame. aoqi@0: * In 1.2, they do. Therefore native methods like Class.forName aoqi@0: * can no longer look at the current frame for the caller class. aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_GetCallerClass(JNIEnv *env, int n); aoqi@0: aoqi@0: /* aoqi@0: * Find primitive classes aoqi@0: * utf: class name aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); aoqi@0: aoqi@0: /* aoqi@0: * Link the class aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_ResolveClass(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: /* aoqi@0: * Find a class from a given class loader. Throw ClassNotFoundException aoqi@0: * or NoClassDefFoundError depending on the value of the last aoqi@0: * argument. aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init, aoqi@0: jobject loader, jboolean throwError); aoqi@0: aoqi@0: /* aoqi@0: * Find a class from a boot class loader. Returns NULL if class not found. aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); aoqi@0: aoqi@0: /* aoqi@0: * Find a class from a given class loader. Throws ClassNotFoundException. aoqi@0: * name: name of class aoqi@0: * init: whether initialization is done aoqi@0: * loader: class loader to look up the class. This may not be the same as the caller's aoqi@0: * class loader. aoqi@0: * caller: initiating class. The initiating class may be null when a security aoqi@0: * manager is not installed. aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init, aoqi@0: jobject loader, jclass caller); aoqi@0: aoqi@0: /* aoqi@0: * Find a class from a given class. aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, aoqi@0: jclass from); aoqi@0: aoqi@0: /* Find a loaded class cached by the VM */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name); aoqi@0: aoqi@0: /* Define a class */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, aoqi@0: jsize len, jobject pd); aoqi@0: aoqi@0: /* Define a class with a source (added in JDK1.5) */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, aoqi@0: const jbyte *buf, jsize len, jobject pd, aoqi@0: const char *source); aoqi@0: aoqi@0: /* Define a class with a source with conditional verification (added HSX 14) aoqi@0: * -Xverify:all will verify anyway, -Xverify:none will not verify, aoqi@0: * -Xverify:remote (default) will obey this conditional aoqi@0: * i.e. true = should_verify_class aoqi@0: */ aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name, aoqi@0: jobject loader, const jbyte *buf, aoqi@0: jsize len, jobject pd, const char *source, aoqi@0: jboolean verify); aoqi@0: aoqi@0: /* aoqi@0: * Reflection support functions aoqi@0: */ aoqi@0: aoqi@0: JNIEXPORT jstring JNICALL aoqi@0: JVM_GetClassName(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetClassInterfaces(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetClassLoader(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsInterface(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetClassSigners(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetProtectionDomain(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsArrayClass(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsPrimitiveClass(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_GetComponentType(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetClassModifiers(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass); aoqi@0: aoqi@0: JNIEXPORT jclass JNICALL aoqi@0: JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass); aoqi@0: aoqi@0: /* Generics support (JDK 1.5) */ aoqi@0: JNIEXPORT jstring JNICALL aoqi@0: JVM_GetClassSignature(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: /* Annotations support (JDK 1.5) */ aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetClassAnnotations(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: /* Annotations support (JDK 1.6) */ aoqi@0: aoqi@0: // field is a handle to a java.lang.reflect.Field object aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetFieldAnnotations(JNIEnv *env, jobject field); aoqi@0: aoqi@0: // method is a handle to a java.lang.reflect.Method object aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetMethodAnnotations(JNIEnv *env, jobject method); aoqi@0: aoqi@0: // method is a handle to a java.lang.reflect.Method object aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method); aoqi@0: aoqi@0: // method is a handle to a java.lang.reflect.Method object aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method); aoqi@0: aoqi@0: /* Type use annotations support (JDK 1.8) */ aoqi@0: aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: // field is a handle to a java.lang.reflect.Field object aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field); aoqi@0: aoqi@0: // method is a handle to a java.lang.reflect.Method object aoqi@0: JNIEXPORT jbyteArray JNICALL aoqi@0: JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method); aoqi@0: aoqi@0: /* aoqi@0: * New (JDK 1.4) reflection implementation aoqi@0: */ aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly); aoqi@0: aoqi@0: /* Differs from JVM_GetClassModifiers in treatment of inner classes. aoqi@0: This returns the access flags for the class as specified in the aoqi@0: class file rather than searching the InnerClasses attribute (if aoqi@0: present) to find the source-level access flags. Only the values of aoqi@0: the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be aoqi@0: valid. */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetClassAccessFlags(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: /* aoqi@0: * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5) aoqi@0: */ aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetClassConstantPool(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize aoqi@0: (JNIEnv *env, jobject obj, jobject unused); aoqi@0: aoqi@0: JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At aoqi@0: (JNIEnv *env, jobject obj, jobject unused, jint index); aoqi@0: aoqi@0: /* aoqi@0: * java.security.* aoqi@0: */ aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_DoPrivileged(JNIEnv *env, jclass cls, aoqi@0: jobject action, jobject context, jboolean wrapException); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls); aoqi@0: aoqi@0: /* aoqi@0: * Signal support, used to implement the shutdown sequence. Every VM must aoqi@0: * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts aoqi@0: * (^C) and the latter for external termination (kill, system shutdown, etc.). aoqi@0: * Other platform-dependent signal values may also be supported. aoqi@0: */ aoqi@0: aoqi@0: JNIEXPORT void * JNICALL aoqi@0: JVM_RegisterSignal(jint sig, void *handler); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_RaiseSignal(jint sig); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_FindSignal(const char *name); aoqi@0: aoqi@0: /* aoqi@0: * Retrieve the assertion directives for the specified class. aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls); aoqi@0: aoqi@0: /* aoqi@0: * Retrieve the assertion directives from the VM. aoqi@0: */ aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused); aoqi@0: aoqi@0: /* aoqi@0: * java.util.concurrent.atomic.AtomicLong aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_SupportsCX8(void); aoqi@0: aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal); aoqi@0: aoqi@0: /* aoqi@0: * com.sun.dtrace.jsdt support aoqi@0: */ aoqi@0: aoqi@0: #define JVM_TRACING_DTRACE_VERSION 1 aoqi@0: aoqi@0: /* aoqi@0: * Structure to pass one probe description to JVM. aoqi@0: * aoqi@0: * The VM will overwrite the definition of the referenced method with aoqi@0: * code that will fire the probe. aoqi@0: */ aoqi@0: typedef struct { aoqi@0: jmethodID method; aoqi@0: jstring function; aoqi@0: jstring name; aoqi@0: void* reserved[4]; // for future use aoqi@0: } JVM_DTraceProbe; aoqi@0: aoqi@0: /** aoqi@0: * Encapsulates the stability ratings for a DTrace provider field aoqi@0: */ aoqi@0: typedef struct { aoqi@0: jint nameStability; aoqi@0: jint dataStability; aoqi@0: jint dependencyClass; aoqi@0: } JVM_DTraceInterfaceAttributes; aoqi@0: aoqi@0: /* aoqi@0: * Structure to pass one provider description to JVM aoqi@0: */ aoqi@0: typedef struct { aoqi@0: jstring name; aoqi@0: JVM_DTraceProbe* probes; aoqi@0: jint probe_count; aoqi@0: JVM_DTraceInterfaceAttributes providerAttributes; aoqi@0: JVM_DTraceInterfaceAttributes moduleAttributes; aoqi@0: JVM_DTraceInterfaceAttributes functionAttributes; aoqi@0: JVM_DTraceInterfaceAttributes nameAttributes; aoqi@0: JVM_DTraceInterfaceAttributes argsAttributes; aoqi@0: void* reserved[4]; // for future use aoqi@0: } JVM_DTraceProvider; aoqi@0: aoqi@0: /* aoqi@0: * Get the version number the JVM was built with aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_DTraceGetVersion(JNIEnv* env); aoqi@0: aoqi@0: /* aoqi@0: * Register new probe with given signature, return global handle aoqi@0: * aoqi@0: * The version passed in is the version that the library code was aoqi@0: * built with. aoqi@0: */ aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name, aoqi@0: jint providers_count, JVM_DTraceProvider* providers); aoqi@0: aoqi@0: /* aoqi@0: * Check JSDT probe aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method); aoqi@0: aoqi@0: /* aoqi@0: * Destroy custom DOF aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_DTraceDispose(JNIEnv* env, jlong handle); aoqi@0: aoqi@0: /* aoqi@0: * Check to see if DTrace is supported by OS aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_DTraceIsSupported(JNIEnv* env); aoqi@0: aoqi@0: /************************************************************************* aoqi@0: PART 2: Support for the Verifier and Class File Format Checker aoqi@0: ************************************************************************/ aoqi@0: /* aoqi@0: * Return the class name in UTF format. The result is valid aoqi@0: * until JVM_ReleaseUTf is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetClassNameUTF(JNIEnv *env, jclass cb); aoqi@0: aoqi@0: /* aoqi@0: * Returns the constant pool types in the buffer provided by "types." aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types); aoqi@0: aoqi@0: /* aoqi@0: * Returns the number of Constant Pool entries. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb); aoqi@0: aoqi@0: /* aoqi@0: * Returns the number of *declared* fields or methods. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetClassFieldsCount(JNIEnv *env, jclass cb); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetClassMethodsCount(JNIEnv *env, jclass cb); aoqi@0: aoqi@0: /* aoqi@0: * Returns the CP indexes of exceptions raised by a given method. aoqi@0: * Places the result in the given buffer. aoqi@0: * aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index, aoqi@0: unsigned short *exceptions); aoqi@0: /* aoqi@0: * Returns the number of exceptions raised by a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the byte code sequence of a given method. aoqi@0: * Places the result in the given buffer. aoqi@0: * aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index, aoqi@0: unsigned char *code); aoqi@0: aoqi@0: /* aoqi@0: * Returns the length of the byte code sequence of a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index); aoqi@0: aoqi@0: /* aoqi@0: * A structure used to a capture exception table entry in a Java method. aoqi@0: */ aoqi@0: typedef struct { aoqi@0: jint start_pc; aoqi@0: jint end_pc; aoqi@0: jint handler_pc; aoqi@0: jint catchType; aoqi@0: } JVM_ExceptionTableEntryType; aoqi@0: aoqi@0: /* aoqi@0: * Returns the exception table entry at entry_index of a given method. aoqi@0: * Places the result in the given buffer. aoqi@0: * aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index, aoqi@0: jint entry_index, aoqi@0: JVM_ExceptionTableEntryType *entry); aoqi@0: aoqi@0: /* aoqi@0: * Returns the length of the exception table of a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the modifiers of a given field. aoqi@0: * The field is identified by field_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the modifiers of a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the number of local variables of a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the number of arguments (including this pointer) of a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the maximum amount of stack (in words) used by a given method. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Is a given method a constructor. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Is the given method generated by the VM. aoqi@0: * The method is identified by method_index. aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the name of a given method in UTF format. aoqi@0: * The result remains valid until JVM_ReleaseUTF is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the signature of a given method in UTF format. aoqi@0: * The result remains valid until JVM_ReleaseUTF is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the name of the field refered to at a given constant pool aoqi@0: * index. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the name of the method refered to at a given constant pool aoqi@0: * index. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the signature of the method refered to at a given constant pool aoqi@0: * index. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the signature of the field refered to at a given constant pool aoqi@0: * index. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the class name refered to at a given constant pool index. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the class name refered to at a given constant pool index. aoqi@0: * aoqi@0: * The constant pool entry must refer to a CONSTANT_Fieldref. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the class name refered to at a given constant pool index. aoqi@0: * aoqi@0: * The constant pool entry must refer to CONSTANT_Methodref or aoqi@0: * CONSTANT_InterfaceMethodref. aoqi@0: * aoqi@0: * The result is in UTF format and remains valid until JVM_ReleaseUTF aoqi@0: * is called. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: */ aoqi@0: JNIEXPORT const char * JNICALL aoqi@0: JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index); aoqi@0: aoqi@0: /* aoqi@0: * Returns the modifiers of a field in calledClass. The field is aoqi@0: * referred to in class cb at constant pool entry index. aoqi@0: * aoqi@0: * The caller must treat the string as a constant and not modify it aoqi@0: * in any way. aoqi@0: * aoqi@0: * Returns -1 if the field does not exist in calledClass. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); aoqi@0: aoqi@0: /* aoqi@0: * Returns the modifiers of a method in calledClass. The method is aoqi@0: * referred to in class cb at constant pool entry index. aoqi@0: * aoqi@0: * Returns -1 if the method does not exist in calledClass. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); aoqi@0: aoqi@0: /* aoqi@0: * Releases the UTF string obtained from the VM. aoqi@0: */ aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_ReleaseUTF(const char *utf); aoqi@0: aoqi@0: /* aoqi@0: * Compare if two classes are in the same package. aoqi@0: */ aoqi@0: JNIEXPORT jboolean JNICALL aoqi@0: JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2); aoqi@0: aoqi@0: /* Constants in class files */ aoqi@0: aoqi@0: #define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */ aoqi@0: #define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */ aoqi@0: #define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */ aoqi@0: #define JVM_ACC_STATIC 0x0008 /* instance variable is static */ aoqi@0: #define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */ aoqi@0: #define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */ aoqi@0: #define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */ aoqi@0: #define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */ aoqi@0: #define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */ aoqi@0: #define JVM_ACC_TRANSIENT 0x0080 /* not persistent */ aoqi@0: #define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */ aoqi@0: #define JVM_ACC_NATIVE 0x0100 /* implemented in C */ aoqi@0: #define JVM_ACC_INTERFACE 0x0200 /* class is an interface */ aoqi@0: #define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */ aoqi@0: #define JVM_ACC_STRICT 0x0800 /* strict floating point */ aoqi@0: #define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */ aoqi@0: #define JVM_ACC_ANNOTATION 0x2000 /* annotation type */ aoqi@0: #define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */ aoqi@0: aoqi@0: #define JVM_ACC_PUBLIC_BIT 0 aoqi@0: #define JVM_ACC_PRIVATE_BIT 1 aoqi@0: #define JVM_ACC_PROTECTED_BIT 2 aoqi@0: #define JVM_ACC_STATIC_BIT 3 aoqi@0: #define JVM_ACC_FINAL_BIT 4 aoqi@0: #define JVM_ACC_SYNCHRONIZED_BIT 5 aoqi@0: #define JVM_ACC_SUPER_BIT 5 aoqi@0: #define JVM_ACC_VOLATILE_BIT 6 aoqi@0: #define JVM_ACC_BRIDGE_BIT 6 aoqi@0: #define JVM_ACC_TRANSIENT_BIT 7 aoqi@0: #define JVM_ACC_VARARGS_BIT 7 aoqi@0: #define JVM_ACC_NATIVE_BIT 8 aoqi@0: #define JVM_ACC_INTERFACE_BIT 9 aoqi@0: #define JVM_ACC_ABSTRACT_BIT 10 aoqi@0: #define JVM_ACC_STRICT_BIT 11 aoqi@0: #define JVM_ACC_SYNTHETIC_BIT 12 aoqi@0: #define JVM_ACC_ANNOTATION_BIT 13 aoqi@0: #define JVM_ACC_ENUM_BIT 14 aoqi@0: aoqi@0: // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java aoqi@0: enum { aoqi@0: JVM_CONSTANT_Utf8 = 1, aoqi@0: JVM_CONSTANT_Unicode, /* unused */ aoqi@0: JVM_CONSTANT_Integer, aoqi@0: JVM_CONSTANT_Float, aoqi@0: JVM_CONSTANT_Long, aoqi@0: JVM_CONSTANT_Double, aoqi@0: JVM_CONSTANT_Class, aoqi@0: JVM_CONSTANT_String, aoqi@0: JVM_CONSTANT_Fieldref, aoqi@0: JVM_CONSTANT_Methodref, aoqi@0: JVM_CONSTANT_InterfaceMethodref, aoqi@0: JVM_CONSTANT_NameAndType, aoqi@0: JVM_CONSTANT_MethodHandle = 15, // JSR 292 aoqi@0: JVM_CONSTANT_MethodType = 16, // JSR 292 aoqi@0: //JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only aoqi@0: JVM_CONSTANT_InvokeDynamic = 18, // JSR 292 aoqi@0: JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles aoqi@0: }; aoqi@0: aoqi@0: /* JVM_CONSTANT_MethodHandle subtypes */ aoqi@0: enum { aoqi@0: JVM_REF_getField = 1, aoqi@0: JVM_REF_getStatic = 2, aoqi@0: JVM_REF_putField = 3, aoqi@0: JVM_REF_putStatic = 4, aoqi@0: JVM_REF_invokeVirtual = 5, aoqi@0: JVM_REF_invokeStatic = 6, aoqi@0: JVM_REF_invokeSpecial = 7, aoqi@0: JVM_REF_newInvokeSpecial = 8, aoqi@0: JVM_REF_invokeInterface = 9 aoqi@0: }; aoqi@0: aoqi@0: /* Used in the newarray instruction. */ aoqi@0: aoqi@0: #define JVM_T_BOOLEAN 4 aoqi@0: #define JVM_T_CHAR 5 aoqi@0: #define JVM_T_FLOAT 6 aoqi@0: #define JVM_T_DOUBLE 7 aoqi@0: #define JVM_T_BYTE 8 aoqi@0: #define JVM_T_SHORT 9 aoqi@0: #define JVM_T_INT 10 aoqi@0: #define JVM_T_LONG 11 aoqi@0: aoqi@0: /* JVM method signatures */ aoqi@0: aoqi@0: #define JVM_SIGNATURE_ARRAY '[' aoqi@0: #define JVM_SIGNATURE_BYTE 'B' aoqi@0: #define JVM_SIGNATURE_CHAR 'C' aoqi@0: #define JVM_SIGNATURE_CLASS 'L' aoqi@0: #define JVM_SIGNATURE_ENDCLASS ';' aoqi@0: #define JVM_SIGNATURE_ENUM 'E' aoqi@0: #define JVM_SIGNATURE_FLOAT 'F' aoqi@0: #define JVM_SIGNATURE_DOUBLE 'D' aoqi@0: #define JVM_SIGNATURE_FUNC '(' aoqi@0: #define JVM_SIGNATURE_ENDFUNC ')' aoqi@0: #define JVM_SIGNATURE_INT 'I' aoqi@0: #define JVM_SIGNATURE_LONG 'J' aoqi@0: #define JVM_SIGNATURE_SHORT 'S' aoqi@0: #define JVM_SIGNATURE_VOID 'V' aoqi@0: #define JVM_SIGNATURE_BOOLEAN 'Z' aoqi@0: aoqi@0: /* aoqi@0: * A function defined by the byte-code verifier and called by the VM. aoqi@0: * This is not a function implemented in the VM. aoqi@0: * aoqi@0: * Returns JNI_FALSE if verification fails. A detailed error message aoqi@0: * will be places in msg_buf, whose length is specified by buf_len. aoqi@0: */ aoqi@0: typedef jboolean (*verifier_fn_t)(JNIEnv *env, aoqi@0: jclass cb, aoqi@0: char * msg_buf, aoqi@0: jint buf_len); aoqi@0: aoqi@0: aoqi@0: /* aoqi@0: * Support for a VM-independent class format checker. aoqi@0: */ aoqi@0: typedef struct { aoqi@0: unsigned long code; /* byte code */ aoqi@0: unsigned long excs; /* exceptions */ aoqi@0: unsigned long etab; /* catch table */ aoqi@0: unsigned long lnum; /* line number */ aoqi@0: unsigned long lvar; /* local vars */ aoqi@0: } method_size_info; aoqi@0: aoqi@0: typedef struct { aoqi@0: unsigned int constants; /* constant pool */ aoqi@0: unsigned int fields; aoqi@0: unsigned int methods; aoqi@0: unsigned int interfaces; aoqi@0: unsigned int fields2; /* number of static 2-word fields */ aoqi@0: unsigned int innerclasses; /* # of records in InnerClasses attr */ aoqi@0: aoqi@0: method_size_info clinit; /* memory used in clinit */ aoqi@0: method_size_info main; /* used everywhere else */ aoqi@0: } class_size_info; aoqi@0: aoqi@0: /* aoqi@0: * Functions defined in libjava.so to perform string conversions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str); aoqi@0: aoqi@0: typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b); aoqi@0: aoqi@0: /* This is the function defined in libjava.so that performs class aoqi@0: * format checks. This functions fills in size information about aoqi@0: * the class file and returns: aoqi@0: * aoqi@0: * 0: good aoqi@0: * -1: out of memory aoqi@0: * -2: bad format aoqi@0: * -3: unsupported version aoqi@0: * -4: bad class name aoqi@0: */ aoqi@0: aoqi@0: typedef jint (*check_format_fn_t)(char *class_name, aoqi@0: unsigned char *data, aoqi@0: unsigned int data_size, aoqi@0: class_size_info *class_size, aoqi@0: char *message_buffer, aoqi@0: jint buffer_length, aoqi@0: jboolean measure_only, aoqi@0: jboolean check_relaxed); aoqi@0: aoqi@0: #define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \ aoqi@0: JVM_ACC_FINAL | \ aoqi@0: JVM_ACC_SUPER | \ aoqi@0: JVM_ACC_INTERFACE | \ aoqi@0: JVM_ACC_ABSTRACT | \ aoqi@0: JVM_ACC_ANNOTATION | \ aoqi@0: JVM_ACC_ENUM | \ aoqi@0: JVM_ACC_SYNTHETIC) aoqi@0: aoqi@0: #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \ aoqi@0: JVM_ACC_PRIVATE | \ aoqi@0: JVM_ACC_PROTECTED | \ aoqi@0: JVM_ACC_STATIC | \ aoqi@0: JVM_ACC_FINAL | \ aoqi@0: JVM_ACC_VOLATILE | \ aoqi@0: JVM_ACC_TRANSIENT | \ aoqi@0: JVM_ACC_ENUM | \ aoqi@0: JVM_ACC_SYNTHETIC) aoqi@0: aoqi@0: #define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \ aoqi@0: JVM_ACC_PRIVATE | \ aoqi@0: JVM_ACC_PROTECTED | \ aoqi@0: JVM_ACC_STATIC | \ aoqi@0: JVM_ACC_FINAL | \ aoqi@0: JVM_ACC_SYNCHRONIZED | \ aoqi@0: JVM_ACC_BRIDGE | \ aoqi@0: JVM_ACC_VARARGS | \ aoqi@0: JVM_ACC_NATIVE | \ aoqi@0: JVM_ACC_ABSTRACT | \ aoqi@0: JVM_ACC_STRICT | \ aoqi@0: JVM_ACC_SYNTHETIC) aoqi@0: aoqi@0: /* aoqi@0: * This is the function defined in libjava.so to perform path aoqi@0: * canonicalization. VM call this function before opening jar files aoqi@0: * to load system classes. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); aoqi@0: aoqi@0: /************************************************************************* aoqi@0: PART 3: I/O and Network Support aoqi@0: ************************************************************************/ aoqi@0: aoqi@0: /* Note that the JVM IO functions are expected to return JVM_IO_ERR aoqi@0: * when there is any kind of error. The caller can then use the aoqi@0: * platform specific support (e.g., errno) to get the detailed aoqi@0: * error info. The JVM_GetLastErrorString procedure may also be used aoqi@0: * to obtain a descriptive error string. aoqi@0: */ aoqi@0: #define JVM_IO_ERR (-1) aoqi@0: aoqi@0: /* For interruptible IO. Returning JVM_IO_INTR indicates that an IO aoqi@0: * operation has been disrupted by Thread.interrupt. There are a aoqi@0: * number of technical difficulties related to interruptible IO that aoqi@0: * need to be solved. For example, most existing programs do not handle aoqi@0: * InterruptedIOExceptions specially, they simply treat those as any aoqi@0: * IOExceptions, which typically indicate fatal errors. aoqi@0: * aoqi@0: * There are also two modes of operation for interruptible IO. In the aoqi@0: * resumption mode, an interrupted IO operation is guaranteed not to aoqi@0: * have any side-effects, and can be restarted. In the termination mode, aoqi@0: * an interrupted IO operation corrupts the underlying IO stream, so aoqi@0: * that the only reasonable operation on an interrupted stream is to aoqi@0: * close that stream. The resumption mode seems to be impossible to aoqi@0: * implement on Win32 and Solaris. Implementing the termination mode is aoqi@0: * easier, but it's not clear that's the right semantics. aoqi@0: * aoqi@0: * Interruptible IO is not supported on Win32.It can be enabled/disabled aoqi@0: * using a compile-time flag on Solaris. Third-party JVM ports do not aoqi@0: * need to implement interruptible IO. aoqi@0: */ aoqi@0: #define JVM_IO_INTR (-2) aoqi@0: aoqi@0: /* Write a string into the given buffer, in the platform's local encoding, aoqi@0: * that describes the most recent system-level error to occur in this thread. aoqi@0: * Return the length of the string or zero if no error occurred. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetLastErrorString(char *buf, int len); aoqi@0: aoqi@0: /* aoqi@0: * Convert a pathname into native format. This function does syntactic aoqi@0: * cleanup, such as removing redundant separator characters. It modifies aoqi@0: * the given pathname string in place. aoqi@0: */ aoqi@0: JNIEXPORT char * JNICALL aoqi@0: JVM_NativePath(char *); aoqi@0: aoqi@0: /* aoqi@0: * JVM I/O error codes aoqi@0: */ aoqi@0: #define JVM_EEXIST -100 aoqi@0: aoqi@0: /* aoqi@0: * Open a file descriptor. This function returns a negative error code aoqi@0: * on error, and a non-negative integer that is the file descriptor on aoqi@0: * success. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Open(const char *fname, jint flags, jint mode); aoqi@0: aoqi@0: /* aoqi@0: * Close a file descriptor. This function returns -1 on error, and 0 aoqi@0: * on success. aoqi@0: * aoqi@0: * fd the file descriptor to close. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Close(jint fd); aoqi@0: aoqi@0: /* aoqi@0: * Read data from a file decriptor into a char array. aoqi@0: * aoqi@0: * fd the file descriptor to read from. aoqi@0: * buf the buffer where to put the read data. aoqi@0: * nbytes the number of bytes to read. aoqi@0: * aoqi@0: * This function returns -1 on error, and 0 on success. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Read(jint fd, char *buf, jint nbytes); aoqi@0: aoqi@0: /* aoqi@0: * Write data from a char array to a file decriptor. aoqi@0: * aoqi@0: * fd the file descriptor to read from. aoqi@0: * buf the buffer from which to fetch the data. aoqi@0: * nbytes the number of bytes to write. aoqi@0: * aoqi@0: * This function returns -1 on error, and 0 on success. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Write(jint fd, char *buf, jint nbytes); aoqi@0: aoqi@0: /* aoqi@0: * Returns the number of bytes available for reading from a given file aoqi@0: * descriptor aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Available(jint fd, jlong *pbytes); aoqi@0: aoqi@0: /* aoqi@0: * Move the file descriptor pointer from whence by offset. aoqi@0: * aoqi@0: * fd the file descriptor to move. aoqi@0: * offset the number of bytes to move it by. aoqi@0: * whence the start from where to move it. aoqi@0: * aoqi@0: * This function returns the resulting pointer location. aoqi@0: */ aoqi@0: JNIEXPORT jlong JNICALL aoqi@0: JVM_Lseek(jint fd, jlong offset, jint whence); aoqi@0: aoqi@0: /* aoqi@0: * Set the length of the file associated with the given descriptor to the given aoqi@0: * length. If the new length is longer than the current length then the file aoqi@0: * is extended; the contents of the extended portion are not defined. The aoqi@0: * value of the file pointer is undefined after this procedure returns. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_SetLength(jint fd, jlong length); aoqi@0: aoqi@0: /* aoqi@0: * Synchronize the file descriptor's in memory state with that of the aoqi@0: * physical device. Return of -1 is an error, 0 is OK. aoqi@0: */ aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Sync(jint fd); aoqi@0: aoqi@0: /* aoqi@0: * Networking library support aoqi@0: */ aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_InitializeSocketLibrary(void); aoqi@0: aoqi@0: struct sockaddr; aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Socket(jint domain, jint type, jint protocol); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_SocketClose(jint fd); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_SocketShutdown(jint fd, jint howto); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Recv(jint fd, char *buf, jint nBytes, jint flags); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Send(jint fd, char *buf, jint nBytes, jint flags); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Timeout(int fd, long timeout); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Listen(jint fd, jint count); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Connect(jint fd, struct sockaddr *him, jint len); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Bind(jint fd, struct sockaddr *him, jint len); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_Accept(jint fd, struct sockaddr *him, jint *len); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_RecvFrom(jint fd, char *buf, int nBytes, aoqi@0: int flags, struct sockaddr *from, int *fromlen); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_SendTo(jint fd, char *buf, int len, aoqi@0: int flags, struct sockaddr *to, int tolen); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_SocketAvailable(jint fd, jint *result); aoqi@0: aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetSockName(jint fd, struct sockaddr *him, int *len); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen); aoqi@0: aoqi@0: JNIEXPORT int JNICALL aoqi@0: JVM_GetHostName(char* name, int namelen); aoqi@0: aoqi@0: /* aoqi@0: * The standard printing functions supported by the Java VM. (Should they aoqi@0: * be renamed to JVM_* in the future? aoqi@0: */ aoqi@0: aoqi@0: /* aoqi@0: * BE CAREFUL! The following functions do not implement the aoqi@0: * full feature set of standard C printf formats. aoqi@0: */ aoqi@0: JNIEXPORT int aoqi@0: jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); aoqi@0: aoqi@0: JNIEXPORT int aoqi@0: jio_snprintf(char *str, size_t count, const char *fmt, ...); aoqi@0: aoqi@0: JNIEXPORT int aoqi@0: jio_fprintf(FILE *, const char *fmt, ...); aoqi@0: aoqi@0: JNIEXPORT int aoqi@0: jio_vfprintf(FILE *, const char *fmt, va_list args); aoqi@0: aoqi@0: aoqi@0: JNIEXPORT void * JNICALL aoqi@0: JVM_RawMonitorCreate(void); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_RawMonitorDestroy(void *mon); aoqi@0: aoqi@0: JNIEXPORT jint JNICALL aoqi@0: JVM_RawMonitorEnter(void *mon); aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_RawMonitorExit(void *mon); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.reflect.Method aoqi@0: */ aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.reflect.Constructor aoqi@0: */ aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0); aoqi@0: aoqi@0: /* aoqi@0: * java.lang.management support aoqi@0: */ aoqi@0: JNIEXPORT void* JNICALL aoqi@0: JVM_GetManagement(jint version); aoqi@0: aoqi@0: /* aoqi@0: * com.sun.tools.attach.VirtualMachine support aoqi@0: * aoqi@0: * Initialize the agent properties with the properties maintained in the VM. aoqi@0: */ aoqi@0: JNIEXPORT jobject JNICALL aoqi@0: JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); aoqi@0: aoqi@0: JNIEXPORT jstring JNICALL aoqi@0: JVM_GetTemporaryDirectory(JNIEnv *env); aoqi@0: aoqi@0: /* Generics reflection support. aoqi@0: * aoqi@0: * Returns information about the given class's EnclosingMethod aoqi@0: * attribute, if present, or null if the class had no enclosing aoqi@0: * method. aoqi@0: * aoqi@0: * If non-null, the returned array contains three elements. Element 0 aoqi@0: * is the java.lang.Class of which the enclosing method is a member, aoqi@0: * and elements 1 and 2 are the java.lang.Strings for the enclosing aoqi@0: * method's name and descriptor, respectively. aoqi@0: */ aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); aoqi@0: aoqi@0: /* aoqi@0: * Java thread state support aoqi@0: */ aoqi@0: enum { aoqi@0: JAVA_THREAD_STATE_NEW = 0, aoqi@0: JAVA_THREAD_STATE_RUNNABLE = 1, aoqi@0: JAVA_THREAD_STATE_BLOCKED = 2, aoqi@0: JAVA_THREAD_STATE_WAITING = 3, aoqi@0: JAVA_THREAD_STATE_TIMED_WAITING = 4, aoqi@0: JAVA_THREAD_STATE_TERMINATED = 5, aoqi@0: JAVA_THREAD_STATE_COUNT = 6 aoqi@0: }; aoqi@0: aoqi@0: /* aoqi@0: * Returns an array of the threadStatus values representing the aoqi@0: * given Java thread state. Returns NULL if the VM version is aoqi@0: * incompatible with the JDK or doesn't support the given aoqi@0: * Java thread state. aoqi@0: */ aoqi@0: JNIEXPORT jintArray JNICALL aoqi@0: JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState); aoqi@0: aoqi@0: /* aoqi@0: * Returns an array of the substate names representing the aoqi@0: * given Java thread state. Returns NULL if the VM version is aoqi@0: * incompatible with the JDK or the VM doesn't support aoqi@0: * the given Java thread state. aoqi@0: * values must be the jintArray returned from JVM_GetThreadStateValues aoqi@0: * and javaThreadState. aoqi@0: */ aoqi@0: JNIEXPORT jobjectArray JNICALL aoqi@0: JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values); aoqi@0: aoqi@0: /* ========================================================================= aoqi@0: * The following defines a private JVM interface that the JDK can query aoqi@0: * for the JVM version and capabilities. sun.misc.Version defines aoqi@0: * the methods for getting the VM version and its capabilities. aoqi@0: * aoqi@0: * When a new bit is added, the following should be updated to provide aoqi@0: * access to the new capability: aoqi@0: * HS: JVM_GetVersionInfo and Abstract_VM_Version class aoqi@0: * SDK: Version class aoqi@0: * aoqi@0: * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for aoqi@0: * JVM to query for the JDK version and capabilities. aoqi@0: * aoqi@0: * When a new bit is added, the following should be updated to provide aoqi@0: * access to the new capability: aoqi@0: * HS: JDK_Version class aoqi@0: * SDK: JDK_GetVersionInfo0 aoqi@0: * aoqi@0: * ========================================================================== aoqi@0: */ aoqi@0: typedef struct { aoqi@0: /* HotSpot Express VM version string: aoqi@0: * .-bxx[-][-] aoqi@0: */ aoqi@0: unsigned int jvm_version; /* Consists of major.minor.0.build */ aoqi@0: unsigned int update_version : 8; /* 0 in HotSpot Express VM */ aoqi@0: unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */ aoqi@0: unsigned int reserved1 : 16; aoqi@0: unsigned int reserved2; aoqi@0: aoqi@0: /* The following bits represents JVM supports that JDK has dependency on. aoqi@0: * JDK can use these bits to determine which JVM version aoqi@0: * and support it has to maintain runtime compatibility. aoqi@0: * aoqi@0: * When a new bit is added in a minor or update release, make sure aoqi@0: * the new bit is also added in the main/baseline. aoqi@0: */ aoqi@0: unsigned int is_attachable : 1; aoqi@0: unsigned int : 31; aoqi@0: unsigned int : 32; aoqi@0: unsigned int : 32; aoqi@0: } jvm_version_info; aoqi@0: aoqi@0: #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) aoqi@0: #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) aoqi@0: // Micro version is 0 in HotSpot Express VM (set in jvm.cpp). aoqi@0: #define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) aoqi@0: /* Build number is available in all HotSpot Express VM builds. aoqi@0: * It is defined in make/hotspot_version file. aoqi@0: */ aoqi@0: #define JVM_VERSION_BUILD(version) ((version & 0x000000FF)) aoqi@0: aoqi@0: JNIEXPORT void JNICALL aoqi@0: JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size); aoqi@0: aoqi@0: typedef struct { aoqi@0: // Naming convention of RE build version string: n.n.n[_uu[c]][-]-bxx aoqi@0: unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */ aoqi@0: /* and build number (xx) */ aoqi@0: unsigned int update_version : 8; /* Update release version (uu) */ aoqi@0: unsigned int special_update_version : 8; /* Special update release version (c)*/ aoqi@0: unsigned int reserved1 : 16; aoqi@0: unsigned int reserved2; aoqi@0: aoqi@0: /* The following bits represents new JDK supports that VM has dependency on. aoqi@0: * VM implementation can use these bits to determine which JDK version aoqi@0: * and support it has to maintain runtime compatibility. aoqi@0: * aoqi@0: * When a new bit is added in a minor or update release, make sure aoqi@0: * the new bit is also added in the main/baseline. aoqi@0: */ aoqi@0: unsigned int thread_park_blocker : 1; aoqi@0: unsigned int post_vm_init_hook_enabled : 1; aoqi@0: unsigned int pending_list_uses_discovered_field : 1; aoqi@0: unsigned int : 29; aoqi@0: unsigned int : 32; aoqi@0: unsigned int : 32; aoqi@0: } jdk_version_info; aoqi@0: aoqi@0: #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) aoqi@0: #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) aoqi@0: #define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) aoqi@0: aoqi@0: /* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN) aoqi@0: * It will be zero for internal builds. aoqi@0: */ aoqi@0: #define JDK_VERSION_BUILD(version) ((version & 0x000000FF)) aoqi@0: aoqi@0: /* aoqi@0: * This is the function JDK_GetVersionInfo0 defined in libjava.so aoqi@0: * that is dynamically looked up by JVM. aoqi@0: */ aoqi@0: typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size); aoqi@0: aoqi@0: /* aoqi@0: * This structure is used by the launcher to get the default thread aoqi@0: * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a aoqi@0: * version of 1.1. As it is not supported otherwise, it has been removed aoqi@0: * from jni.h aoqi@0: */ aoqi@0: typedef struct JDK1_1InitArgs { aoqi@0: jint version; aoqi@0: aoqi@0: char **properties; aoqi@0: jint checkSource; aoqi@0: jint nativeStackSize; aoqi@0: jint javaStackSize; aoqi@0: jint minHeapSize; aoqi@0: jint maxHeapSize; aoqi@0: jint verifyMode; aoqi@0: char *classpath; aoqi@0: aoqi@0: jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); aoqi@0: void (JNICALL *exit)(jint code); aoqi@0: void (JNICALL *abort)(void); aoqi@0: aoqi@0: jint enableClassGC; aoqi@0: jint enableVerboseGC; aoqi@0: jint disableAsyncGC; aoqi@0: jint verbose; aoqi@0: jboolean debugging; aoqi@0: jint debugPort; aoqi@0: } JDK1_1InitArgs; aoqi@0: aoqi@0: #ifdef __cplusplus aoqi@0: } /* extern "C" */ aoqi@0: #endif /* __cplusplus */ aoqi@0: aoqi@0: #endif /* !_JAVASOFT_JVM_H_ */ aoqi@0: aoqi@0: #endif // SHARE_VM_PRIMS_JVM_H