📄 jvm.h
字号:
/* * @(#)jvm.h 1.91 06/10/10 * * Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */#ifndef _JAVASOFT_JVM_H_#define _JAVASOFT_JVM_H_/* Fix for bug #6264809 JVM_O_DELETE is not really used anywhere. *//* #define JVM_O_DELETE 0x10000 */#include "javavm/include/porting/java_props.h"#ifdef JAVASE/* NOTE: This is a special case. xxx_md.h files are usually not included directly, but should go through the porting later in: src/share/javavm/include/porting/ Do not replicate this code pattern unless you really know what you are doing.*/#include "jvm_md.h"#endif#ifdef __cplusplusextern "C" {#endif/* * This file contains additional functions exported from the VM. * These functions are complementary to the standard JNI support. * There are three parts to this file: * * First, this file contains the VM-related functions needed by native * libraries in the standard Java API. For example, the java.lang.Object * class needs VM-level functions that wait for and notify monitors. * * Second, this file contains the functions and constant definitions * needed by the byte code verifier and class file format checker. * These functions allow the verifier and format checker to be written * in a VM-independent way. * * Third, this file contains various I/O and nerwork operations needed * by the standard Java I/O and network APIs. *//* * Bump the version number when either of the following happens: * * 1. There is a change in JVM_* functions. * * 2. There is a change in the contract between VM and Java classes. * For example, if the VM relies on a new private field in Thread * class. */#define JVM_INTERFACE_VERSION 4JNIEXPORT jint JNICALLJVM_GetInterfaceVersion(void);/************************************************************************* PART 1: Functions for Native Libraries ************************************************************************//* * java.lang.Object */JNIEXPORT jint JNICALLJVM_IHashCode(JNIEnv *env, jobject obj);JNIEXPORT void JNICALLJVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);JNIEXPORT void JNICALLJVM_MonitorNotify(JNIEnv *env, jobject obj);JNIEXPORT void JNICALLJVM_MonitorNotifyAll(JNIEnv *env, jobject obj);JNIEXPORT jobject JNICALLJVM_Clone(JNIEnv *env, jobject obj);/* * java.lang.String */JNIEXPORT jstring JNICALLJVM_InternString(JNIEnv *env, jstring str);/* * java.lang.System */JNIEXPORT jlong JNICALLJVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);JNIEXPORT void JNICALLJVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, jobject dst, jint dst_pos, jint length);/* * Initialize VM specific properties given a Properties object p, and an * sprops structure returned by the platform. */JNIEXPORT jobject JNICALLJVM_InitProperties(JNIEnv *env, jobject p, java_props_t *sprops);/* * java.io.File */JNIEXPORT void JNICALLJVM_OnExit(void (*func)(void));/* * java.lang.Runtime */JNIEXPORT void JNICALLJVM_Exit(jint code);JNIEXPORT void JNICALLJVM_Halt(jint code);JNIEXPORT void JNICALLJVM_GC(void);/* Returns the number of real-time milliseconds that have elapsed since the * least-recently-inspected heap object was last inspected by the garbage * collector. * * For simple stop-the-world collectors this value is just the time * since the most recent collection. For generational collectors it is the * time since the oldest generation was most recently collected. Other * collectors are free to return a pessimistic estimate of the elapsed time, or * simply the time since the last full collection was performed. * * Note that in the presence of reference objects, a given object that is no * longer strongly reachable may have to be inspected multiple times before it * can be reclaimed. */JNIEXPORT jlong JNICALLJVM_MaxObjectInspectionAge(void);JNIEXPORT void JNICALLJVM_TraceInstructions(jboolean on);JNIEXPORT void JNICALLJVM_TraceMethodCalls(jboolean on);JNIEXPORT jlong JNICALLJVM_TotalMemory(void);JNIEXPORT jlong JNICALLJVM_FreeMemory(void);#ifndef CDC_10JNIEXPORT jlong JNICALLJVM_MaxMemory(void);#endifJNIEXPORT jint JNICALLJVM_ActiveProcessorCount(void);JNIEXPORT void * JNICALL JVM_LoadLibrary(const char *name);JNIEXPORT void JNICALL JVM_UnloadLibrary(void * handle);JNIEXPORT void * JNICALL JVM_FindLibraryEntry(void *handle, const char *name);JNIEXPORT jboolean JNICALLJVM_IsSupportedJNIVersion(jint version);/* * java.lang.Float and java.lang.Double */JNIEXPORT jboolean JNICALLJVM_IsNaN(jdouble d);/* * java.lang.Throwable */JNIEXPORT void JNICALLJVM_FillInStackTrace(JNIEnv *env, jobject throwable);JNIEXPORT void JNICALLJVM_PrintStackTrace(JNIEnv *env, jobject throwable, jobject printable);#ifndef CDC_10JNIEXPORT jint JNICALLJVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);JNIEXPORT jobject JNICALLJVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);#endif/* * java.lang.Compiler */JNIEXPORT void JNICALLJVM_InitializeCompiler (JNIEnv *env, jclass compCls);JNIEXPORT jboolean JNICALLJVM_IsSilentCompiler(JNIEnv *env, jclass compCls);JNIEXPORT jboolean JNICALLJVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls);JNIEXPORT jboolean JNICALLJVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname);JNIEXPORT jobject JNICALLJVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg);JNIEXPORT void JNICALLJVM_EnableCompiler(JNIEnv *env, jclass compCls);JNIEXPORT void JNICALLJVM_DisableCompiler(JNIEnv *env, jclass compCls);/* * java.lang.Thread */JNIEXPORT void JNICALLJVM_StartThread(JNIEnv *env, jobject thread, jint priority);JNIEXPORT void JNICALLJVM_StopThread(JNIEnv *env, jobject thread, jobject exception);JNIEXPORT jboolean JNICALLJVM_IsThreadAlive(JNIEnv *env, jobject thread);JNIEXPORT void JNICALLJVM_SuspendThread(JNIEnv *env, jobject thread);JNIEXPORT void JNICALLJVM_ResumeThread(JNIEnv *env, jobject thread);JNIEXPORT void JNICALLJVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);JNIEXPORT void JNICALLJVM_Yield(JNIEnv *env, jclass threadClass);JNIEXPORT void JNICALLJVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);JNIEXPORT jobject JNICALLJVM_CurrentThread(JNIEnv *env, jclass threadClass);JNIEXPORT jint JNICALLJVM_CountStackFrames(JNIEnv *env, jobject thread);JNIEXPORT void JNICALLJVM_Interrupt(JNIEnv *env, jobject thread);JNIEXPORT jboolean JNICALLJVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);#ifndef CDC_10JNIEXPORT jboolean JNICALLJVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);#endif/* * java.lang.SecurityManager */JNIEXPORT jclass JNICALLJVM_CurrentLoadedClass(JNIEnv *env);JNIEXPORT jobject JNICALLJVM_CurrentClassLoader(JNIEnv *env);JNIEXPORT jobjectArray JNICALLJVM_GetClassContext(JNIEnv *env);JNIEXPORT jint JNICALLJVM_ClassDepth(JNIEnv *env, jstring name);JNIEXPORT jint JNICALLJVM_ClassLoaderDepth(JNIEnv *env);/* * java.lang.Package */JNIEXPORT jstring JNICALLJVM_GetSystemPackage(JNIEnv *env, jstring name);JNIEXPORT jobjectArray JNICALLJVM_GetSystemPackages(JNIEnv *env);/* * java.io.ObjectInputStream */JNIEXPORT jobject JNICALLJVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass, jclass initClass);JNIEXPORT jobject JNICALLJVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, jint length);JNIEXPORT jobject JNICALLJVM_LatestUserDefinedLoader(JNIEnv *env);/* * java.lang.reflect.Array */JNIEXPORT jint JNICALLJVM_GetArrayLength(JNIEnv *env, jobject arr);JNIEXPORT jobject JNICALLJVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);JNIEXPORT jvalue JNICALLJVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);JNIEXPORT void JNICALLJVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);JNIEXPORT void JNICALLJVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, CVMBasicType vCode);JNIEXPORT jobject JNICALLJVM_NewArray(JNIEnv *env, jclass eltClass, jint length);JNIEXPORT jobject JNICALLJVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);/* * java.lang.reflect.Field */JNIEXPORT jobject JNICALLJVM_GetField(JNIEnv *env, jobject field, jobject obj);JNIEXPORT jvalue JNICALLJVM_GetPrimitiveField(JNIEnv *env, jobject field, jobject obj, unsigned char wCode);JNIEXPORT void JNICALLJVM_SetField(JNIEnv *env, jobject field, jobject obj, jobject val);JNIEXPORT void JNICALLJVM_SetPrimitiveField(JNIEnv *env, jobject field, jobject obj, jvalue v, unsigned char vCode);/* * java.lang.reflect.Method */JNIEXPORT jobject JNICALLJVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);/* * java.lang.reflect.Constructor */JNIEXPORT jobject JNICALLJVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);/* * java.lang.Class and java.lang.ClassLoader *//* * Returns the class in which the code invoking the native method * belongs. * * Note that in JDK 1.1, native methods did not create a frame. * In 1.2, they do. Therefore native methods like Class.forName * can no longer look at the current frame for the caller class. */JNIEXPORT jclass JNICALLJVM_GetCallerClass(JNIEnv *env, int n);/* * Find primitive classes * utf: class name */JNIEXPORT jclass JNICALLJVM_FindPrimitiveClass(JNIEnv *env, const char *utf);/* * Link the class */JNIEXPORT void JNICALLJVM_ResolveClass(JNIEnv *env, jclass cls);/* * Find a class from a given class loader. Throw ClassNotFoundException * or NoClassDefFoundError depending on the value of the last * argument. */JNIEXPORT jclass JNICALLJVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init, jobject loader, jboolean throwError);/* Find a loaded class cached by the VM */JNIEXPORT jclass JNICALLJVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);/* Define a class */JNIEXPORT jclass JNICALLJVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd);/* * Reflection support functions */JNIEXPORT jstring JNICALLJVM_GetClassName(JNIEnv *env, jclass cls);JNIEXPORT jobjectArray JNICALLJVM_GetClassInterfaces(JNIEnv *env, jclass cls);JNIEXPORT jobject JNICALLJVM_GetClassLoader(JNIEnv *env, jclass cls);JNIEXPORT jboolean JNICALLJVM_IsInterface(JNIEnv *env, jclass cls);JNIEXPORT jobjectArray JNICALLJVM_GetClassSigners(JNIEnv *env, jclass cls);JNIEXPORT void JNICALLJVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);JNIEXPORT jobject JNICALLJVM_GetProtectionDomain(JNIEnv *env, jclass cls);JNIEXPORT void JNICALLJVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain);JNIEXPORT jboolean JNICALLJVM_IsArrayClass(JNIEnv *env, jclass cls);JNIEXPORT jboolean JNICALLJVM_IsPrimitiveClass(JNIEnv *env, jclass cls);JNIEXPORT jclass JNICALLJVM_GetComponentType(JNIEnv *env, jclass cls);JNIEXPORT jint JNICALLJVM_GetClassModifiers(JNIEnv *env, jclass cls);#ifdef JAVASE/* Generics support (JDK 1.5) */JNIEXPORT jstring JNICALLJVM_GetClassSignature(JNIEnv *env, jclass cls);/* Annotations support (JDK 1.5) */JNIEXPORT jbyteArray JNICALLJVM_GetClassAnnotations(JNIEnv *env, jclass cls);#endif/* * reflecting fields and methods. * which: 0 --- MEMBER_PUBLIC * 1 --- MEMBER_DECLARED */JNIEXPORT jobjectArray JNICALLJVM_GetClassFields(JNIEnv *env, jclass cls, jint which);JNIEXPORT jobjectArray JNICALLJVM_GetClassMethods(JNIEnv *env, jclass cls, jint which);JNIEXPORT jobjectArray JNICALLJVM_GetClassConstructors(JNIEnv *env, jclass cls, jint which);JNIEXPORT jobject JNICALLJVM_GetClassField(JNIEnv *env, jclass cls, jstring name, jint which);JNIEXPORT jobject JNICALLJVM_GetClassMethod(JNIEnv *env, jclass cls, jstring name, jobjectArray types, jint which);JNIEXPORT jobject JNICALLJVM_GetClassConstructor(JNIEnv *env, jclass cls, jobjectArray types, jint which);JNIEXPORT jobjectArray JNICALLJVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);JNIEXPORT jclass JNICALLJVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);/* * Implements Class.newInstance */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -