Tue, 17 Oct 2017 12:58:25 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_PRIMS_JVM_H |
aoqi@0 | 26 | #define SHARE_VM_PRIMS_JVM_H |
aoqi@0 | 27 | |
aoqi@0 | 28 | #include "prims/jni.h" |
aoqi@0 | 29 | #ifdef TARGET_OS_FAMILY_linux |
aoqi@0 | 30 | # include "jvm_linux.h" |
aoqi@0 | 31 | #endif |
aoqi@0 | 32 | #ifdef TARGET_OS_FAMILY_solaris |
aoqi@0 | 33 | # include "jvm_solaris.h" |
aoqi@0 | 34 | #endif |
aoqi@0 | 35 | #ifdef TARGET_OS_FAMILY_windows |
aoqi@0 | 36 | # include "jvm_windows.h" |
aoqi@0 | 37 | #endif |
aoqi@0 | 38 | #ifdef TARGET_OS_FAMILY_aix |
aoqi@0 | 39 | # include "jvm_aix.h" |
aoqi@0 | 40 | #endif |
aoqi@0 | 41 | #ifdef TARGET_OS_FAMILY_bsd |
aoqi@0 | 42 | # include "jvm_bsd.h" |
aoqi@0 | 43 | #endif |
aoqi@0 | 44 | |
aoqi@0 | 45 | #ifndef _JAVASOFT_JVM_H_ |
aoqi@0 | 46 | #define _JAVASOFT_JVM_H_ |
aoqi@0 | 47 | |
aoqi@0 | 48 | // HotSpot integration note: |
aoqi@0 | 49 | // |
aoqi@0 | 50 | // This file and jvm.h used with the JDK are identical, |
aoqi@0 | 51 | // except for the three includes removed below |
aoqi@0 | 52 | |
aoqi@0 | 53 | // #include <sys/stat.h> |
aoqi@0 | 54 | // #include "jni.h" |
aoqi@0 | 55 | // #include "jvm_md.h" |
aoqi@0 | 56 | |
aoqi@0 | 57 | |
aoqi@0 | 58 | #ifdef __cplusplus |
aoqi@0 | 59 | extern "C" { |
aoqi@0 | 60 | #endif |
aoqi@0 | 61 | |
aoqi@0 | 62 | /* |
aoqi@0 | 63 | * This file contains additional functions exported from the VM. |
aoqi@0 | 64 | * These functions are complementary to the standard JNI support. |
aoqi@0 | 65 | * There are three parts to this file: |
aoqi@0 | 66 | * |
aoqi@0 | 67 | * First, this file contains the VM-related functions needed by native |
aoqi@0 | 68 | * libraries in the standard Java API. For example, the java.lang.Object |
aoqi@0 | 69 | * class needs VM-level functions that wait for and notify monitors. |
aoqi@0 | 70 | * |
aoqi@0 | 71 | * Second, this file contains the functions and constant definitions |
aoqi@0 | 72 | * needed by the byte code verifier and class file format checker. |
aoqi@0 | 73 | * These functions allow the verifier and format checker to be written |
aoqi@0 | 74 | * in a VM-independent way. |
aoqi@0 | 75 | * |
aoqi@0 | 76 | * Third, this file contains various I/O and nerwork operations needed |
aoqi@0 | 77 | * by the standard Java I/O and network APIs. |
aoqi@0 | 78 | */ |
aoqi@0 | 79 | |
aoqi@0 | 80 | /* |
aoqi@0 | 81 | * Bump the version number when either of the following happens: |
aoqi@0 | 82 | * |
aoqi@0 | 83 | * 1. There is a change in JVM_* functions. |
aoqi@0 | 84 | * |
aoqi@0 | 85 | * 2. There is a change in the contract between VM and Java classes. |
aoqi@0 | 86 | * For example, if the VM relies on a new private field in Thread |
aoqi@0 | 87 | * class. |
aoqi@0 | 88 | */ |
aoqi@0 | 89 | |
aoqi@0 | 90 | #define JVM_INTERFACE_VERSION 4 |
aoqi@0 | 91 | |
aoqi@0 | 92 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 93 | JVM_GetMethodParameters(JNIEnv *env, jobject method); |
aoqi@0 | 94 | |
aoqi@0 | 95 | JNIEXPORT jint JNICALL |
aoqi@0 | 96 | JVM_GetInterfaceVersion(void); |
aoqi@0 | 97 | |
aoqi@0 | 98 | /************************************************************************* |
aoqi@0 | 99 | PART 1: Functions for Native Libraries |
aoqi@0 | 100 | ************************************************************************/ |
aoqi@0 | 101 | /* |
aoqi@0 | 102 | * java.lang.Object |
aoqi@0 | 103 | */ |
aoqi@0 | 104 | JNIEXPORT jint JNICALL |
aoqi@0 | 105 | JVM_IHashCode(JNIEnv *env, jobject obj); |
aoqi@0 | 106 | |
aoqi@0 | 107 | JNIEXPORT void JNICALL |
aoqi@0 | 108 | JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms); |
aoqi@0 | 109 | |
aoqi@0 | 110 | JNIEXPORT void JNICALL |
aoqi@0 | 111 | JVM_MonitorNotify(JNIEnv *env, jobject obj); |
aoqi@0 | 112 | |
aoqi@0 | 113 | JNIEXPORT void JNICALL |
aoqi@0 | 114 | JVM_MonitorNotifyAll(JNIEnv *env, jobject obj); |
aoqi@0 | 115 | |
aoqi@0 | 116 | JNIEXPORT jobject JNICALL |
aoqi@0 | 117 | JVM_Clone(JNIEnv *env, jobject obj); |
aoqi@0 | 118 | |
aoqi@0 | 119 | /* |
aoqi@0 | 120 | * java.lang.String |
aoqi@0 | 121 | */ |
aoqi@0 | 122 | JNIEXPORT jstring JNICALL |
aoqi@0 | 123 | JVM_InternString(JNIEnv *env, jstring str); |
aoqi@0 | 124 | |
aoqi@0 | 125 | /* |
aoqi@0 | 126 | * java.lang.System |
aoqi@0 | 127 | */ |
aoqi@0 | 128 | JNIEXPORT jlong JNICALL |
aoqi@0 | 129 | JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); |
aoqi@0 | 130 | |
aoqi@0 | 131 | JNIEXPORT jlong JNICALL |
aoqi@0 | 132 | JVM_NanoTime(JNIEnv *env, jclass ignored); |
aoqi@0 | 133 | |
aoqi@0 | 134 | JNIEXPORT void JNICALL |
aoqi@0 | 135 | JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, |
aoqi@0 | 136 | jobject dst, jint dst_pos, jint length); |
aoqi@0 | 137 | |
aoqi@0 | 138 | JNIEXPORT jobject JNICALL |
aoqi@0 | 139 | JVM_InitProperties(JNIEnv *env, jobject p); |
aoqi@0 | 140 | |
aoqi@0 | 141 | /* |
aoqi@0 | 142 | * java.io.File |
aoqi@0 | 143 | */ |
aoqi@0 | 144 | JNIEXPORT void JNICALL |
aoqi@0 | 145 | JVM_OnExit(void (*func)(void)); |
aoqi@0 | 146 | |
aoqi@0 | 147 | /* |
aoqi@0 | 148 | * java.lang.Runtime |
aoqi@0 | 149 | */ |
aoqi@0 | 150 | JNIEXPORT void JNICALL |
aoqi@0 | 151 | JVM_Exit(jint code); |
aoqi@0 | 152 | |
aoqi@0 | 153 | JNIEXPORT void JNICALL |
aoqi@0 | 154 | JVM_Halt(jint code); |
aoqi@0 | 155 | |
aoqi@0 | 156 | JNIEXPORT void JNICALL |
aoqi@0 | 157 | JVM_GC(void); |
aoqi@0 | 158 | |
aoqi@0 | 159 | /* Returns the number of real-time milliseconds that have elapsed since the |
aoqi@0 | 160 | * least-recently-inspected heap object was last inspected by the garbage |
aoqi@0 | 161 | * collector. |
aoqi@0 | 162 | * |
aoqi@0 | 163 | * For simple stop-the-world collectors this value is just the time |
aoqi@0 | 164 | * since the most recent collection. For generational collectors it is the |
aoqi@0 | 165 | * time since the oldest generation was most recently collected. Other |
aoqi@0 | 166 | * collectors are free to return a pessimistic estimate of the elapsed time, or |
aoqi@0 | 167 | * simply the time since the last full collection was performed. |
aoqi@0 | 168 | * |
aoqi@0 | 169 | * Note that in the presence of reference objects, a given object that is no |
aoqi@0 | 170 | * longer strongly reachable may have to be inspected multiple times before it |
aoqi@0 | 171 | * can be reclaimed. |
aoqi@0 | 172 | */ |
aoqi@0 | 173 | JNIEXPORT jlong JNICALL |
aoqi@0 | 174 | JVM_MaxObjectInspectionAge(void); |
aoqi@0 | 175 | |
aoqi@0 | 176 | JNIEXPORT void JNICALL |
aoqi@0 | 177 | JVM_TraceInstructions(jboolean on); |
aoqi@0 | 178 | |
aoqi@0 | 179 | JNIEXPORT void JNICALL |
aoqi@0 | 180 | JVM_TraceMethodCalls(jboolean on); |
aoqi@0 | 181 | |
aoqi@0 | 182 | JNIEXPORT jlong JNICALL |
aoqi@0 | 183 | JVM_TotalMemory(void); |
aoqi@0 | 184 | |
aoqi@0 | 185 | JNIEXPORT jlong JNICALL |
aoqi@0 | 186 | JVM_FreeMemory(void); |
aoqi@0 | 187 | |
aoqi@0 | 188 | JNIEXPORT jlong JNICALL |
aoqi@0 | 189 | JVM_MaxMemory(void); |
aoqi@0 | 190 | |
aoqi@0 | 191 | JNIEXPORT jint JNICALL |
aoqi@0 | 192 | JVM_ActiveProcessorCount(void); |
aoqi@0 | 193 | |
aoqi@0 | 194 | JNIEXPORT void * JNICALL |
aoqi@0 | 195 | JVM_LoadLibrary(const char *name); |
aoqi@0 | 196 | |
aoqi@0 | 197 | JNIEXPORT void JNICALL |
aoqi@0 | 198 | JVM_UnloadLibrary(void * handle); |
aoqi@0 | 199 | |
aoqi@0 | 200 | JNIEXPORT void * JNICALL |
aoqi@0 | 201 | JVM_FindLibraryEntry(void *handle, const char *name); |
aoqi@0 | 202 | |
aoqi@0 | 203 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 204 | JVM_IsSupportedJNIVersion(jint version); |
aoqi@0 | 205 | |
aoqi@0 | 206 | /* |
aoqi@0 | 207 | * java.lang.Float and java.lang.Double |
aoqi@0 | 208 | */ |
aoqi@0 | 209 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 210 | JVM_IsNaN(jdouble d); |
aoqi@0 | 211 | |
aoqi@0 | 212 | /* |
aoqi@0 | 213 | * java.lang.Throwable |
aoqi@0 | 214 | */ |
aoqi@0 | 215 | JNIEXPORT void JNICALL |
aoqi@0 | 216 | JVM_FillInStackTrace(JNIEnv *env, jobject throwable); |
aoqi@0 | 217 | |
aoqi@0 | 218 | JNIEXPORT jint JNICALL |
aoqi@0 | 219 | JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable); |
aoqi@0 | 220 | |
aoqi@0 | 221 | JNIEXPORT jobject JNICALL |
aoqi@0 | 222 | JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index); |
aoqi@0 | 223 | |
aoqi@0 | 224 | /* |
aoqi@0 | 225 | * java.lang.Compiler |
aoqi@0 | 226 | */ |
aoqi@0 | 227 | JNIEXPORT void JNICALL |
aoqi@0 | 228 | JVM_InitializeCompiler (JNIEnv *env, jclass compCls); |
aoqi@0 | 229 | |
aoqi@0 | 230 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 231 | JVM_IsSilentCompiler(JNIEnv *env, jclass compCls); |
aoqi@0 | 232 | |
aoqi@0 | 233 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 234 | JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls); |
aoqi@0 | 235 | |
aoqi@0 | 236 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 237 | JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname); |
aoqi@0 | 238 | |
aoqi@0 | 239 | JNIEXPORT jobject JNICALL |
aoqi@0 | 240 | JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg); |
aoqi@0 | 241 | |
aoqi@0 | 242 | JNIEXPORT void JNICALL |
aoqi@0 | 243 | JVM_EnableCompiler(JNIEnv *env, jclass compCls); |
aoqi@0 | 244 | |
aoqi@0 | 245 | JNIEXPORT void JNICALL |
aoqi@0 | 246 | JVM_DisableCompiler(JNIEnv *env, jclass compCls); |
aoqi@0 | 247 | |
aoqi@0 | 248 | /* |
aoqi@0 | 249 | * java.lang.Thread |
aoqi@0 | 250 | */ |
aoqi@0 | 251 | JNIEXPORT void JNICALL |
aoqi@0 | 252 | JVM_StartThread(JNIEnv *env, jobject thread); |
aoqi@0 | 253 | |
aoqi@0 | 254 | JNIEXPORT void JNICALL |
aoqi@0 | 255 | JVM_StopThread(JNIEnv *env, jobject thread, jobject exception); |
aoqi@0 | 256 | |
aoqi@0 | 257 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 258 | JVM_IsThreadAlive(JNIEnv *env, jobject thread); |
aoqi@0 | 259 | |
aoqi@0 | 260 | JNIEXPORT void JNICALL |
aoqi@0 | 261 | JVM_SuspendThread(JNIEnv *env, jobject thread); |
aoqi@0 | 262 | |
aoqi@0 | 263 | JNIEXPORT void JNICALL |
aoqi@0 | 264 | JVM_ResumeThread(JNIEnv *env, jobject thread); |
aoqi@0 | 265 | |
aoqi@0 | 266 | JNIEXPORT void JNICALL |
aoqi@0 | 267 | JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); |
aoqi@0 | 268 | |
aoqi@0 | 269 | JNIEXPORT void JNICALL |
aoqi@0 | 270 | JVM_Yield(JNIEnv *env, jclass threadClass); |
aoqi@0 | 271 | |
aoqi@0 | 272 | JNIEXPORT void JNICALL |
aoqi@0 | 273 | JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis); |
aoqi@0 | 274 | |
aoqi@0 | 275 | JNIEXPORT jobject JNICALL |
aoqi@0 | 276 | JVM_CurrentThread(JNIEnv *env, jclass threadClass); |
aoqi@0 | 277 | |
aoqi@0 | 278 | JNIEXPORT jint JNICALL |
aoqi@0 | 279 | JVM_CountStackFrames(JNIEnv *env, jobject thread); |
aoqi@0 | 280 | |
aoqi@0 | 281 | JNIEXPORT void JNICALL |
aoqi@0 | 282 | JVM_Interrupt(JNIEnv *env, jobject thread); |
aoqi@0 | 283 | |
aoqi@0 | 284 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 285 | JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted); |
aoqi@0 | 286 | |
aoqi@0 | 287 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 288 | JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj); |
aoqi@0 | 289 | |
aoqi@0 | 290 | JNIEXPORT void JNICALL |
aoqi@0 | 291 | JVM_DumpAllStacks(JNIEnv *env, jclass unused); |
aoqi@0 | 292 | |
aoqi@0 | 293 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 294 | JVM_GetAllThreads(JNIEnv *env, jclass dummy); |
aoqi@0 | 295 | |
aoqi@0 | 296 | JNIEXPORT void JNICALL |
aoqi@0 | 297 | JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name); |
aoqi@0 | 298 | |
aoqi@0 | 299 | /* getStackTrace() and getAllStackTraces() method */ |
aoqi@0 | 300 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 301 | JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads); |
aoqi@0 | 302 | |
aoqi@0 | 303 | /* |
aoqi@0 | 304 | * java.lang.SecurityManager |
aoqi@0 | 305 | */ |
aoqi@0 | 306 | JNIEXPORT jclass JNICALL |
aoqi@0 | 307 | JVM_CurrentLoadedClass(JNIEnv *env); |
aoqi@0 | 308 | |
aoqi@0 | 309 | JNIEXPORT jobject JNICALL |
aoqi@0 | 310 | JVM_CurrentClassLoader(JNIEnv *env); |
aoqi@0 | 311 | |
aoqi@0 | 312 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 313 | JVM_GetClassContext(JNIEnv *env); |
aoqi@0 | 314 | |
aoqi@0 | 315 | JNIEXPORT jint JNICALL |
aoqi@0 | 316 | JVM_ClassDepth(JNIEnv *env, jstring name); |
aoqi@0 | 317 | |
aoqi@0 | 318 | JNIEXPORT jint JNICALL |
aoqi@0 | 319 | JVM_ClassLoaderDepth(JNIEnv *env); |
aoqi@0 | 320 | |
aoqi@0 | 321 | /* |
aoqi@0 | 322 | * java.lang.Package |
aoqi@0 | 323 | */ |
aoqi@0 | 324 | JNIEXPORT jstring JNICALL |
aoqi@0 | 325 | JVM_GetSystemPackage(JNIEnv *env, jstring name); |
aoqi@0 | 326 | |
aoqi@0 | 327 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 328 | JVM_GetSystemPackages(JNIEnv *env); |
aoqi@0 | 329 | |
aoqi@0 | 330 | /* |
aoqi@0 | 331 | * java.io.ObjectInputStream |
aoqi@0 | 332 | */ |
aoqi@0 | 333 | JNIEXPORT jobject JNICALL |
aoqi@0 | 334 | JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass, |
aoqi@0 | 335 | jclass initClass); |
aoqi@0 | 336 | |
aoqi@0 | 337 | JNIEXPORT jobject JNICALL |
aoqi@0 | 338 | JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, |
aoqi@0 | 339 | jint length); |
aoqi@0 | 340 | |
aoqi@0 | 341 | JNIEXPORT jobject JNICALL |
aoqi@0 | 342 | JVM_LatestUserDefinedLoader(JNIEnv *env); |
aoqi@0 | 343 | |
aoqi@0 | 344 | /* |
aoqi@0 | 345 | * This function has been deprecated and should not be considered |
aoqi@0 | 346 | * part of the specified JVM interface. |
aoqi@0 | 347 | */ |
aoqi@0 | 348 | JNIEXPORT jclass JNICALL |
aoqi@0 | 349 | JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass, |
aoqi@0 | 350 | jstring currClassName); |
aoqi@0 | 351 | |
aoqi@0 | 352 | /* |
aoqi@0 | 353 | * java.lang.reflect.Array |
aoqi@0 | 354 | */ |
aoqi@0 | 355 | JNIEXPORT jint JNICALL |
aoqi@0 | 356 | JVM_GetArrayLength(JNIEnv *env, jobject arr); |
aoqi@0 | 357 | |
aoqi@0 | 358 | JNIEXPORT jobject JNICALL |
aoqi@0 | 359 | JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); |
aoqi@0 | 360 | |
aoqi@0 | 361 | JNIEXPORT jvalue JNICALL |
aoqi@0 | 362 | JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); |
aoqi@0 | 363 | |
aoqi@0 | 364 | JNIEXPORT void JNICALL |
aoqi@0 | 365 | JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); |
aoqi@0 | 366 | |
aoqi@0 | 367 | JNIEXPORT void JNICALL |
aoqi@0 | 368 | JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, |
aoqi@0 | 369 | unsigned char vCode); |
aoqi@0 | 370 | |
aoqi@0 | 371 | JNIEXPORT jobject JNICALL |
aoqi@0 | 372 | JVM_NewArray(JNIEnv *env, jclass eltClass, jint length); |
aoqi@0 | 373 | |
aoqi@0 | 374 | JNIEXPORT jobject JNICALL |
aoqi@0 | 375 | JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim); |
aoqi@0 | 376 | |
aoqi@0 | 377 | /* |
aoqi@0 | 378 | * java.lang.Class and java.lang.ClassLoader |
aoqi@0 | 379 | */ |
aoqi@0 | 380 | |
aoqi@0 | 381 | #define JVM_CALLER_DEPTH -1 |
aoqi@0 | 382 | |
aoqi@0 | 383 | /* |
aoqi@0 | 384 | * Returns the class in which the code invoking the native method |
aoqi@0 | 385 | * belongs. |
aoqi@0 | 386 | * |
aoqi@0 | 387 | * Note that in JDK 1.1, native methods did not create a frame. |
aoqi@0 | 388 | * In 1.2, they do. Therefore native methods like Class.forName |
aoqi@0 | 389 | * can no longer look at the current frame for the caller class. |
aoqi@0 | 390 | */ |
aoqi@0 | 391 | JNIEXPORT jclass JNICALL |
aoqi@0 | 392 | JVM_GetCallerClass(JNIEnv *env, int n); |
aoqi@0 | 393 | |
aoqi@0 | 394 | /* |
aoqi@0 | 395 | * Find primitive classes |
aoqi@0 | 396 | * utf: class name |
aoqi@0 | 397 | */ |
aoqi@0 | 398 | JNIEXPORT jclass JNICALL |
aoqi@0 | 399 | JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); |
aoqi@0 | 400 | |
aoqi@0 | 401 | /* |
aoqi@0 | 402 | * Link the class |
aoqi@0 | 403 | */ |
aoqi@0 | 404 | JNIEXPORT void JNICALL |
aoqi@0 | 405 | JVM_ResolveClass(JNIEnv *env, jclass cls); |
aoqi@0 | 406 | |
aoqi@0 | 407 | /* |
aoqi@0 | 408 | * Find a class from a given class loader. Throw ClassNotFoundException |
aoqi@0 | 409 | * or NoClassDefFoundError depending on the value of the last |
aoqi@0 | 410 | * argument. |
aoqi@0 | 411 | */ |
aoqi@0 | 412 | JNIEXPORT jclass JNICALL |
aoqi@0 | 413 | JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init, |
aoqi@0 | 414 | jobject loader, jboolean throwError); |
aoqi@0 | 415 | |
aoqi@0 | 416 | /* |
aoqi@0 | 417 | * Find a class from a boot class loader. Returns NULL if class not found. |
aoqi@0 | 418 | */ |
aoqi@0 | 419 | JNIEXPORT jclass JNICALL |
aoqi@0 | 420 | JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); |
aoqi@0 | 421 | |
aoqi@0 | 422 | /* |
aoqi@0 | 423 | * Find a class from a given class loader. Throws ClassNotFoundException. |
aoqi@0 | 424 | * name: name of class |
aoqi@0 | 425 | * init: whether initialization is done |
aoqi@0 | 426 | * loader: class loader to look up the class. This may not be the same as the caller's |
aoqi@0 | 427 | * class loader. |
aoqi@0 | 428 | * caller: initiating class. The initiating class may be null when a security |
aoqi@0 | 429 | * manager is not installed. |
aoqi@0 | 430 | */ |
aoqi@0 | 431 | JNIEXPORT jclass JNICALL |
aoqi@0 | 432 | JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init, |
aoqi@0 | 433 | jobject loader, jclass caller); |
aoqi@0 | 434 | |
aoqi@0 | 435 | /* |
aoqi@0 | 436 | * Find a class from a given class. |
aoqi@0 | 437 | */ |
aoqi@0 | 438 | JNIEXPORT jclass JNICALL |
aoqi@0 | 439 | JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, |
aoqi@0 | 440 | jclass from); |
aoqi@0 | 441 | |
aoqi@0 | 442 | /* Find a loaded class cached by the VM */ |
aoqi@0 | 443 | JNIEXPORT jclass JNICALL |
aoqi@0 | 444 | JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name); |
aoqi@0 | 445 | |
aoqi@0 | 446 | /* Define a class */ |
aoqi@0 | 447 | JNIEXPORT jclass JNICALL |
aoqi@0 | 448 | JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, |
aoqi@0 | 449 | jsize len, jobject pd); |
aoqi@0 | 450 | |
aoqi@0 | 451 | /* Define a class with a source (added in JDK1.5) */ |
aoqi@0 | 452 | JNIEXPORT jclass JNICALL |
aoqi@0 | 453 | JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, |
aoqi@0 | 454 | const jbyte *buf, jsize len, jobject pd, |
aoqi@0 | 455 | const char *source); |
aoqi@0 | 456 | |
aoqi@0 | 457 | /* Define a class with a source with conditional verification (added HSX 14) |
aoqi@0 | 458 | * -Xverify:all will verify anyway, -Xverify:none will not verify, |
aoqi@0 | 459 | * -Xverify:remote (default) will obey this conditional |
aoqi@0 | 460 | * i.e. true = should_verify_class |
aoqi@0 | 461 | */ |
aoqi@0 | 462 | JNIEXPORT jclass JNICALL |
aoqi@0 | 463 | JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name, |
aoqi@0 | 464 | jobject loader, const jbyte *buf, |
aoqi@0 | 465 | jsize len, jobject pd, const char *source, |
aoqi@0 | 466 | jboolean verify); |
aoqi@0 | 467 | |
aoqi@0 | 468 | /* |
aoqi@0 | 469 | * Reflection support functions |
aoqi@0 | 470 | */ |
aoqi@0 | 471 | |
aoqi@0 | 472 | JNIEXPORT jstring JNICALL |
aoqi@0 | 473 | JVM_GetClassName(JNIEnv *env, jclass cls); |
aoqi@0 | 474 | |
aoqi@0 | 475 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 476 | JVM_GetClassInterfaces(JNIEnv *env, jclass cls); |
aoqi@0 | 477 | |
aoqi@0 | 478 | JNIEXPORT jobject JNICALL |
aoqi@0 | 479 | JVM_GetClassLoader(JNIEnv *env, jclass cls); |
aoqi@0 | 480 | |
aoqi@0 | 481 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 482 | JVM_IsInterface(JNIEnv *env, jclass cls); |
aoqi@0 | 483 | |
aoqi@0 | 484 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 485 | JVM_GetClassSigners(JNIEnv *env, jclass cls); |
aoqi@0 | 486 | |
aoqi@0 | 487 | JNIEXPORT void JNICALL |
aoqi@0 | 488 | JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers); |
aoqi@0 | 489 | |
aoqi@0 | 490 | JNIEXPORT jobject JNICALL |
aoqi@0 | 491 | JVM_GetProtectionDomain(JNIEnv *env, jclass cls); |
aoqi@0 | 492 | |
aoqi@0 | 493 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 494 | JVM_IsArrayClass(JNIEnv *env, jclass cls); |
aoqi@0 | 495 | |
aoqi@0 | 496 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 497 | JVM_IsPrimitiveClass(JNIEnv *env, jclass cls); |
aoqi@0 | 498 | |
aoqi@0 | 499 | JNIEXPORT jclass JNICALL |
aoqi@0 | 500 | JVM_GetComponentType(JNIEnv *env, jclass cls); |
aoqi@0 | 501 | |
aoqi@0 | 502 | JNIEXPORT jint JNICALL |
aoqi@0 | 503 | JVM_GetClassModifiers(JNIEnv *env, jclass cls); |
aoqi@0 | 504 | |
aoqi@0 | 505 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 506 | JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass); |
aoqi@0 | 507 | |
aoqi@0 | 508 | JNIEXPORT jclass JNICALL |
aoqi@0 | 509 | JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass); |
aoqi@0 | 510 | |
aoqi@0 | 511 | /* Generics support (JDK 1.5) */ |
aoqi@0 | 512 | JNIEXPORT jstring JNICALL |
aoqi@0 | 513 | JVM_GetClassSignature(JNIEnv *env, jclass cls); |
aoqi@0 | 514 | |
aoqi@0 | 515 | /* Annotations support (JDK 1.5) */ |
aoqi@0 | 516 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 517 | JVM_GetClassAnnotations(JNIEnv *env, jclass cls); |
aoqi@0 | 518 | |
aoqi@0 | 519 | /* Annotations support (JDK 1.6) */ |
aoqi@0 | 520 | |
aoqi@0 | 521 | // field is a handle to a java.lang.reflect.Field object |
aoqi@0 | 522 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 523 | JVM_GetFieldAnnotations(JNIEnv *env, jobject field); |
aoqi@0 | 524 | |
aoqi@0 | 525 | // method is a handle to a java.lang.reflect.Method object |
aoqi@0 | 526 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 527 | JVM_GetMethodAnnotations(JNIEnv *env, jobject method); |
aoqi@0 | 528 | |
aoqi@0 | 529 | // method is a handle to a java.lang.reflect.Method object |
aoqi@0 | 530 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 531 | JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method); |
aoqi@0 | 532 | |
aoqi@0 | 533 | // method is a handle to a java.lang.reflect.Method object |
aoqi@0 | 534 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 535 | JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method); |
aoqi@0 | 536 | |
aoqi@0 | 537 | /* Type use annotations support (JDK 1.8) */ |
aoqi@0 | 538 | |
aoqi@0 | 539 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 540 | JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls); |
aoqi@0 | 541 | |
aoqi@0 | 542 | // field is a handle to a java.lang.reflect.Field object |
aoqi@0 | 543 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 544 | JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field); |
aoqi@0 | 545 | |
aoqi@0 | 546 | // method is a handle to a java.lang.reflect.Method object |
aoqi@0 | 547 | JNIEXPORT jbyteArray JNICALL |
aoqi@0 | 548 | JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method); |
aoqi@0 | 549 | |
aoqi@0 | 550 | /* |
aoqi@0 | 551 | * New (JDK 1.4) reflection implementation |
aoqi@0 | 552 | */ |
aoqi@0 | 553 | |
aoqi@0 | 554 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 555 | JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly); |
aoqi@0 | 556 | |
aoqi@0 | 557 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 558 | JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly); |
aoqi@0 | 559 | |
aoqi@0 | 560 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 561 | JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly); |
aoqi@0 | 562 | |
aoqi@0 | 563 | /* Differs from JVM_GetClassModifiers in treatment of inner classes. |
aoqi@0 | 564 | This returns the access flags for the class as specified in the |
aoqi@0 | 565 | class file rather than searching the InnerClasses attribute (if |
aoqi@0 | 566 | present) to find the source-level access flags. Only the values of |
aoqi@0 | 567 | the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be |
aoqi@0 | 568 | valid. */ |
aoqi@0 | 569 | JNIEXPORT jint JNICALL |
aoqi@0 | 570 | JVM_GetClassAccessFlags(JNIEnv *env, jclass cls); |
aoqi@0 | 571 | |
aoqi@0 | 572 | /* |
aoqi@0 | 573 | * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5) |
aoqi@0 | 574 | */ |
aoqi@0 | 575 | |
aoqi@0 | 576 | JNIEXPORT jobject JNICALL |
aoqi@0 | 577 | JVM_GetClassConstantPool(JNIEnv *env, jclass cls); |
aoqi@0 | 578 | |
aoqi@0 | 579 | JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize |
aoqi@0 | 580 | (JNIEnv *env, jobject obj, jobject unused); |
aoqi@0 | 581 | |
aoqi@0 | 582 | JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt |
aoqi@0 | 583 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 584 | |
aoqi@0 | 585 | JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded |
aoqi@0 | 586 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 587 | |
aoqi@0 | 588 | JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt |
aoqi@0 | 589 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 590 | |
aoqi@0 | 591 | JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded |
aoqi@0 | 592 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 593 | |
aoqi@0 | 594 | JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt |
aoqi@0 | 595 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 596 | |
aoqi@0 | 597 | JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded |
aoqi@0 | 598 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 599 | |
aoqi@0 | 600 | JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt |
aoqi@0 | 601 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 602 | |
aoqi@0 | 603 | JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt |
aoqi@0 | 604 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 605 | |
aoqi@0 | 606 | JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt |
aoqi@0 | 607 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 608 | |
aoqi@0 | 609 | JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt |
aoqi@0 | 610 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 611 | |
aoqi@0 | 612 | JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt |
aoqi@0 | 613 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 614 | |
aoqi@0 | 615 | JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt |
aoqi@0 | 616 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 617 | |
aoqi@0 | 618 | JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At |
aoqi@0 | 619 | (JNIEnv *env, jobject obj, jobject unused, jint index); |
aoqi@0 | 620 | |
aoqi@0 | 621 | /* |
aoqi@0 | 622 | * java.security.* |
aoqi@0 | 623 | */ |
aoqi@0 | 624 | |
aoqi@0 | 625 | JNIEXPORT jobject JNICALL |
aoqi@0 | 626 | JVM_DoPrivileged(JNIEnv *env, jclass cls, |
aoqi@0 | 627 | jobject action, jobject context, jboolean wrapException); |
aoqi@0 | 628 | |
aoqi@0 | 629 | JNIEXPORT jobject JNICALL |
aoqi@0 | 630 | JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls); |
aoqi@0 | 631 | |
aoqi@0 | 632 | JNIEXPORT jobject JNICALL |
aoqi@0 | 633 | JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls); |
aoqi@0 | 634 | |
aoqi@0 | 635 | /* |
aoqi@0 | 636 | * Signal support, used to implement the shutdown sequence. Every VM must |
aoqi@0 | 637 | * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts |
aoqi@0 | 638 | * (^C) and the latter for external termination (kill, system shutdown, etc.). |
aoqi@0 | 639 | * Other platform-dependent signal values may also be supported. |
aoqi@0 | 640 | */ |
aoqi@0 | 641 | |
aoqi@0 | 642 | JNIEXPORT void * JNICALL |
aoqi@0 | 643 | JVM_RegisterSignal(jint sig, void *handler); |
aoqi@0 | 644 | |
aoqi@0 | 645 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 646 | JVM_RaiseSignal(jint sig); |
aoqi@0 | 647 | |
aoqi@0 | 648 | JNIEXPORT jint JNICALL |
aoqi@0 | 649 | JVM_FindSignal(const char *name); |
aoqi@0 | 650 | |
aoqi@0 | 651 | /* |
aoqi@0 | 652 | * Retrieve the assertion directives for the specified class. |
aoqi@0 | 653 | */ |
aoqi@0 | 654 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 655 | JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls); |
aoqi@0 | 656 | |
aoqi@0 | 657 | /* |
aoqi@0 | 658 | * Retrieve the assertion directives from the VM. |
aoqi@0 | 659 | */ |
aoqi@0 | 660 | JNIEXPORT jobject JNICALL |
aoqi@0 | 661 | JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused); |
aoqi@0 | 662 | |
aoqi@0 | 663 | /* |
aoqi@0 | 664 | * java.util.concurrent.atomic.AtomicLong |
aoqi@0 | 665 | */ |
aoqi@0 | 666 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 667 | JVM_SupportsCX8(void); |
aoqi@0 | 668 | |
aoqi@0 | 669 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 670 | JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal); |
aoqi@0 | 671 | |
aoqi@0 | 672 | /* |
aoqi@0 | 673 | * com.sun.dtrace.jsdt support |
aoqi@0 | 674 | */ |
aoqi@0 | 675 | |
aoqi@0 | 676 | #define JVM_TRACING_DTRACE_VERSION 1 |
aoqi@0 | 677 | |
aoqi@0 | 678 | /* |
aoqi@0 | 679 | * Structure to pass one probe description to JVM. |
aoqi@0 | 680 | * |
aoqi@0 | 681 | * The VM will overwrite the definition of the referenced method with |
aoqi@0 | 682 | * code that will fire the probe. |
aoqi@0 | 683 | */ |
aoqi@0 | 684 | typedef struct { |
aoqi@0 | 685 | jmethodID method; |
aoqi@0 | 686 | jstring function; |
aoqi@0 | 687 | jstring name; |
aoqi@0 | 688 | void* reserved[4]; // for future use |
aoqi@0 | 689 | } JVM_DTraceProbe; |
aoqi@0 | 690 | |
aoqi@0 | 691 | /** |
aoqi@0 | 692 | * Encapsulates the stability ratings for a DTrace provider field |
aoqi@0 | 693 | */ |
aoqi@0 | 694 | typedef struct { |
aoqi@0 | 695 | jint nameStability; |
aoqi@0 | 696 | jint dataStability; |
aoqi@0 | 697 | jint dependencyClass; |
aoqi@0 | 698 | } JVM_DTraceInterfaceAttributes; |
aoqi@0 | 699 | |
aoqi@0 | 700 | /* |
aoqi@0 | 701 | * Structure to pass one provider description to JVM |
aoqi@0 | 702 | */ |
aoqi@0 | 703 | typedef struct { |
aoqi@0 | 704 | jstring name; |
aoqi@0 | 705 | JVM_DTraceProbe* probes; |
aoqi@0 | 706 | jint probe_count; |
aoqi@0 | 707 | JVM_DTraceInterfaceAttributes providerAttributes; |
aoqi@0 | 708 | JVM_DTraceInterfaceAttributes moduleAttributes; |
aoqi@0 | 709 | JVM_DTraceInterfaceAttributes functionAttributes; |
aoqi@0 | 710 | JVM_DTraceInterfaceAttributes nameAttributes; |
aoqi@0 | 711 | JVM_DTraceInterfaceAttributes argsAttributes; |
aoqi@0 | 712 | void* reserved[4]; // for future use |
aoqi@0 | 713 | } JVM_DTraceProvider; |
aoqi@0 | 714 | |
aoqi@0 | 715 | /* |
aoqi@0 | 716 | * Get the version number the JVM was built with |
aoqi@0 | 717 | */ |
aoqi@0 | 718 | JNIEXPORT jint JNICALL |
aoqi@0 | 719 | JVM_DTraceGetVersion(JNIEnv* env); |
aoqi@0 | 720 | |
aoqi@0 | 721 | /* |
aoqi@0 | 722 | * Register new probe with given signature, return global handle |
aoqi@0 | 723 | * |
aoqi@0 | 724 | * The version passed in is the version that the library code was |
aoqi@0 | 725 | * built with. |
aoqi@0 | 726 | */ |
aoqi@0 | 727 | JNIEXPORT jlong JNICALL |
aoqi@0 | 728 | JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name, |
aoqi@0 | 729 | jint providers_count, JVM_DTraceProvider* providers); |
aoqi@0 | 730 | |
aoqi@0 | 731 | /* |
aoqi@0 | 732 | * Check JSDT probe |
aoqi@0 | 733 | */ |
aoqi@0 | 734 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 735 | JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method); |
aoqi@0 | 736 | |
aoqi@0 | 737 | /* |
aoqi@0 | 738 | * Destroy custom DOF |
aoqi@0 | 739 | */ |
aoqi@0 | 740 | JNIEXPORT void JNICALL |
aoqi@0 | 741 | JVM_DTraceDispose(JNIEnv* env, jlong handle); |
aoqi@0 | 742 | |
aoqi@0 | 743 | /* |
aoqi@0 | 744 | * Check to see if DTrace is supported by OS |
aoqi@0 | 745 | */ |
aoqi@0 | 746 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 747 | JVM_DTraceIsSupported(JNIEnv* env); |
aoqi@0 | 748 | |
aoqi@0 | 749 | /************************************************************************* |
aoqi@0 | 750 | PART 2: Support for the Verifier and Class File Format Checker |
aoqi@0 | 751 | ************************************************************************/ |
aoqi@0 | 752 | /* |
aoqi@0 | 753 | * Return the class name in UTF format. The result is valid |
aoqi@0 | 754 | * until JVM_ReleaseUTf is called. |
aoqi@0 | 755 | * |
aoqi@0 | 756 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 757 | * in any way. |
aoqi@0 | 758 | */ |
aoqi@0 | 759 | JNIEXPORT const char * JNICALL |
aoqi@0 | 760 | JVM_GetClassNameUTF(JNIEnv *env, jclass cb); |
aoqi@0 | 761 | |
aoqi@0 | 762 | /* |
aoqi@0 | 763 | * Returns the constant pool types in the buffer provided by "types." |
aoqi@0 | 764 | */ |
aoqi@0 | 765 | JNIEXPORT void JNICALL |
aoqi@0 | 766 | JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types); |
aoqi@0 | 767 | |
aoqi@0 | 768 | /* |
aoqi@0 | 769 | * Returns the number of Constant Pool entries. |
aoqi@0 | 770 | */ |
aoqi@0 | 771 | JNIEXPORT jint JNICALL |
aoqi@0 | 772 | JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb); |
aoqi@0 | 773 | |
aoqi@0 | 774 | /* |
aoqi@0 | 775 | * Returns the number of *declared* fields or methods. |
aoqi@0 | 776 | */ |
aoqi@0 | 777 | JNIEXPORT jint JNICALL |
aoqi@0 | 778 | JVM_GetClassFieldsCount(JNIEnv *env, jclass cb); |
aoqi@0 | 779 | |
aoqi@0 | 780 | JNIEXPORT jint JNICALL |
aoqi@0 | 781 | JVM_GetClassMethodsCount(JNIEnv *env, jclass cb); |
aoqi@0 | 782 | |
aoqi@0 | 783 | /* |
aoqi@0 | 784 | * Returns the CP indexes of exceptions raised by a given method. |
aoqi@0 | 785 | * Places the result in the given buffer. |
aoqi@0 | 786 | * |
aoqi@0 | 787 | * The method is identified by method_index. |
aoqi@0 | 788 | */ |
aoqi@0 | 789 | JNIEXPORT void JNICALL |
aoqi@0 | 790 | JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index, |
aoqi@0 | 791 | unsigned short *exceptions); |
aoqi@0 | 792 | /* |
aoqi@0 | 793 | * Returns the number of exceptions raised by a given method. |
aoqi@0 | 794 | * The method is identified by method_index. |
aoqi@0 | 795 | */ |
aoqi@0 | 796 | JNIEXPORT jint JNICALL |
aoqi@0 | 797 | JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index); |
aoqi@0 | 798 | |
aoqi@0 | 799 | /* |
aoqi@0 | 800 | * Returns the byte code sequence of a given method. |
aoqi@0 | 801 | * Places the result in the given buffer. |
aoqi@0 | 802 | * |
aoqi@0 | 803 | * The method is identified by method_index. |
aoqi@0 | 804 | */ |
aoqi@0 | 805 | JNIEXPORT void JNICALL |
aoqi@0 | 806 | JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index, |
aoqi@0 | 807 | unsigned char *code); |
aoqi@0 | 808 | |
aoqi@0 | 809 | /* |
aoqi@0 | 810 | * Returns the length of the byte code sequence of a given method. |
aoqi@0 | 811 | * The method is identified by method_index. |
aoqi@0 | 812 | */ |
aoqi@0 | 813 | JNIEXPORT jint JNICALL |
aoqi@0 | 814 | JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index); |
aoqi@0 | 815 | |
aoqi@0 | 816 | /* |
aoqi@0 | 817 | * A structure used to a capture exception table entry in a Java method. |
aoqi@0 | 818 | */ |
aoqi@0 | 819 | typedef struct { |
aoqi@0 | 820 | jint start_pc; |
aoqi@0 | 821 | jint end_pc; |
aoqi@0 | 822 | jint handler_pc; |
aoqi@0 | 823 | jint catchType; |
aoqi@0 | 824 | } JVM_ExceptionTableEntryType; |
aoqi@0 | 825 | |
aoqi@0 | 826 | /* |
aoqi@0 | 827 | * Returns the exception table entry at entry_index of a given method. |
aoqi@0 | 828 | * Places the result in the given buffer. |
aoqi@0 | 829 | * |
aoqi@0 | 830 | * The method is identified by method_index. |
aoqi@0 | 831 | */ |
aoqi@0 | 832 | JNIEXPORT void JNICALL |
aoqi@0 | 833 | JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index, |
aoqi@0 | 834 | jint entry_index, |
aoqi@0 | 835 | JVM_ExceptionTableEntryType *entry); |
aoqi@0 | 836 | |
aoqi@0 | 837 | /* |
aoqi@0 | 838 | * Returns the length of the exception table of a given method. |
aoqi@0 | 839 | * The method is identified by method_index. |
aoqi@0 | 840 | */ |
aoqi@0 | 841 | JNIEXPORT jint JNICALL |
aoqi@0 | 842 | JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 843 | |
aoqi@0 | 844 | /* |
aoqi@0 | 845 | * Returns the modifiers of a given field. |
aoqi@0 | 846 | * The field is identified by field_index. |
aoqi@0 | 847 | */ |
aoqi@0 | 848 | JNIEXPORT jint JNICALL |
aoqi@0 | 849 | JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 850 | |
aoqi@0 | 851 | /* |
aoqi@0 | 852 | * Returns the modifiers of a given method. |
aoqi@0 | 853 | * The method is identified by method_index. |
aoqi@0 | 854 | */ |
aoqi@0 | 855 | JNIEXPORT jint JNICALL |
aoqi@0 | 856 | JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 857 | |
aoqi@0 | 858 | /* |
aoqi@0 | 859 | * Returns the number of local variables of a given method. |
aoqi@0 | 860 | * The method is identified by method_index. |
aoqi@0 | 861 | */ |
aoqi@0 | 862 | JNIEXPORT jint JNICALL |
aoqi@0 | 863 | JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 864 | |
aoqi@0 | 865 | /* |
aoqi@0 | 866 | * Returns the number of arguments (including this pointer) of a given method. |
aoqi@0 | 867 | * The method is identified by method_index. |
aoqi@0 | 868 | */ |
aoqi@0 | 869 | JNIEXPORT jint JNICALL |
aoqi@0 | 870 | JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 871 | |
aoqi@0 | 872 | /* |
aoqi@0 | 873 | * Returns the maximum amount of stack (in words) used by a given method. |
aoqi@0 | 874 | * The method is identified by method_index. |
aoqi@0 | 875 | */ |
aoqi@0 | 876 | JNIEXPORT jint JNICALL |
aoqi@0 | 877 | JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 878 | |
aoqi@0 | 879 | /* |
aoqi@0 | 880 | * Is a given method a constructor. |
aoqi@0 | 881 | * The method is identified by method_index. |
aoqi@0 | 882 | */ |
aoqi@0 | 883 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 884 | JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 885 | |
aoqi@0 | 886 | /* |
aoqi@0 | 887 | * Is the given method generated by the VM. |
aoqi@0 | 888 | * The method is identified by method_index. |
aoqi@0 | 889 | */ |
aoqi@0 | 890 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 891 | JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index); |
aoqi@0 | 892 | |
aoqi@0 | 893 | /* |
aoqi@0 | 894 | * Returns the name of a given method in UTF format. |
aoqi@0 | 895 | * The result remains valid until JVM_ReleaseUTF is called. |
aoqi@0 | 896 | * |
aoqi@0 | 897 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 898 | * in any way. |
aoqi@0 | 899 | */ |
aoqi@0 | 900 | JNIEXPORT const char * JNICALL |
aoqi@0 | 901 | JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 902 | |
aoqi@0 | 903 | /* |
aoqi@0 | 904 | * Returns the signature of a given method in UTF format. |
aoqi@0 | 905 | * The result remains valid until JVM_ReleaseUTF is called. |
aoqi@0 | 906 | * |
aoqi@0 | 907 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 908 | * in any way. |
aoqi@0 | 909 | */ |
aoqi@0 | 910 | JNIEXPORT const char * JNICALL |
aoqi@0 | 911 | JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 912 | |
aoqi@0 | 913 | /* |
aoqi@0 | 914 | * Returns the name of the field refered to at a given constant pool |
aoqi@0 | 915 | * index. |
aoqi@0 | 916 | * |
aoqi@0 | 917 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 918 | * is called. |
aoqi@0 | 919 | * |
aoqi@0 | 920 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 921 | * in any way. |
aoqi@0 | 922 | */ |
aoqi@0 | 923 | JNIEXPORT const char * JNICALL |
aoqi@0 | 924 | JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 925 | |
aoqi@0 | 926 | /* |
aoqi@0 | 927 | * Returns the name of the method refered to at a given constant pool |
aoqi@0 | 928 | * index. |
aoqi@0 | 929 | * |
aoqi@0 | 930 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 931 | * is called. |
aoqi@0 | 932 | * |
aoqi@0 | 933 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 934 | * in any way. |
aoqi@0 | 935 | */ |
aoqi@0 | 936 | JNIEXPORT const char * JNICALL |
aoqi@0 | 937 | JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 938 | |
aoqi@0 | 939 | /* |
aoqi@0 | 940 | * Returns the signature of the method refered to at a given constant pool |
aoqi@0 | 941 | * index. |
aoqi@0 | 942 | * |
aoqi@0 | 943 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 944 | * is called. |
aoqi@0 | 945 | * |
aoqi@0 | 946 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 947 | * in any way. |
aoqi@0 | 948 | */ |
aoqi@0 | 949 | JNIEXPORT const char * JNICALL |
aoqi@0 | 950 | JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 951 | |
aoqi@0 | 952 | /* |
aoqi@0 | 953 | * Returns the signature of the field refered to at a given constant pool |
aoqi@0 | 954 | * index. |
aoqi@0 | 955 | * |
aoqi@0 | 956 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 957 | * is called. |
aoqi@0 | 958 | * |
aoqi@0 | 959 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 960 | * in any way. |
aoqi@0 | 961 | */ |
aoqi@0 | 962 | JNIEXPORT const char * JNICALL |
aoqi@0 | 963 | JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 964 | |
aoqi@0 | 965 | /* |
aoqi@0 | 966 | * Returns the class name refered to at a given constant pool index. |
aoqi@0 | 967 | * |
aoqi@0 | 968 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 969 | * is called. |
aoqi@0 | 970 | * |
aoqi@0 | 971 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 972 | * in any way. |
aoqi@0 | 973 | */ |
aoqi@0 | 974 | JNIEXPORT const char * JNICALL |
aoqi@0 | 975 | JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 976 | |
aoqi@0 | 977 | /* |
aoqi@0 | 978 | * Returns the class name refered to at a given constant pool index. |
aoqi@0 | 979 | * |
aoqi@0 | 980 | * The constant pool entry must refer to a CONSTANT_Fieldref. |
aoqi@0 | 981 | * |
aoqi@0 | 982 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 983 | * is called. |
aoqi@0 | 984 | * |
aoqi@0 | 985 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 986 | * in any way. |
aoqi@0 | 987 | */ |
aoqi@0 | 988 | JNIEXPORT const char * JNICALL |
aoqi@0 | 989 | JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 990 | |
aoqi@0 | 991 | /* |
aoqi@0 | 992 | * Returns the class name refered to at a given constant pool index. |
aoqi@0 | 993 | * |
aoqi@0 | 994 | * The constant pool entry must refer to CONSTANT_Methodref or |
aoqi@0 | 995 | * CONSTANT_InterfaceMethodref. |
aoqi@0 | 996 | * |
aoqi@0 | 997 | * The result is in UTF format and remains valid until JVM_ReleaseUTF |
aoqi@0 | 998 | * is called. |
aoqi@0 | 999 | * |
aoqi@0 | 1000 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 1001 | * in any way. |
aoqi@0 | 1002 | */ |
aoqi@0 | 1003 | JNIEXPORT const char * JNICALL |
aoqi@0 | 1004 | JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index); |
aoqi@0 | 1005 | |
aoqi@0 | 1006 | /* |
aoqi@0 | 1007 | * Returns the modifiers of a field in calledClass. The field is |
aoqi@0 | 1008 | * referred to in class cb at constant pool entry index. |
aoqi@0 | 1009 | * |
aoqi@0 | 1010 | * The caller must treat the string as a constant and not modify it |
aoqi@0 | 1011 | * in any way. |
aoqi@0 | 1012 | * |
aoqi@0 | 1013 | * Returns -1 if the field does not exist in calledClass. |
aoqi@0 | 1014 | */ |
aoqi@0 | 1015 | JNIEXPORT jint JNICALL |
aoqi@0 | 1016 | JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); |
aoqi@0 | 1017 | |
aoqi@0 | 1018 | /* |
aoqi@0 | 1019 | * Returns the modifiers of a method in calledClass. The method is |
aoqi@0 | 1020 | * referred to in class cb at constant pool entry index. |
aoqi@0 | 1021 | * |
aoqi@0 | 1022 | * Returns -1 if the method does not exist in calledClass. |
aoqi@0 | 1023 | */ |
aoqi@0 | 1024 | JNIEXPORT jint JNICALL |
aoqi@0 | 1025 | JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); |
aoqi@0 | 1026 | |
aoqi@0 | 1027 | /* |
aoqi@0 | 1028 | * Releases the UTF string obtained from the VM. |
aoqi@0 | 1029 | */ |
aoqi@0 | 1030 | JNIEXPORT void JNICALL |
aoqi@0 | 1031 | JVM_ReleaseUTF(const char *utf); |
aoqi@0 | 1032 | |
aoqi@0 | 1033 | /* |
aoqi@0 | 1034 | * Compare if two classes are in the same package. |
aoqi@0 | 1035 | */ |
aoqi@0 | 1036 | JNIEXPORT jboolean JNICALL |
aoqi@0 | 1037 | JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2); |
aoqi@0 | 1038 | |
aoqi@0 | 1039 | /* Constants in class files */ |
aoqi@0 | 1040 | |
aoqi@0 | 1041 | #define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */ |
aoqi@0 | 1042 | #define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */ |
aoqi@0 | 1043 | #define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */ |
aoqi@0 | 1044 | #define JVM_ACC_STATIC 0x0008 /* instance variable is static */ |
aoqi@0 | 1045 | #define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */ |
aoqi@0 | 1046 | #define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */ |
aoqi@0 | 1047 | #define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */ |
aoqi@0 | 1048 | #define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */ |
aoqi@0 | 1049 | #define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */ |
aoqi@0 | 1050 | #define JVM_ACC_TRANSIENT 0x0080 /* not persistent */ |
aoqi@0 | 1051 | #define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */ |
aoqi@0 | 1052 | #define JVM_ACC_NATIVE 0x0100 /* implemented in C */ |
aoqi@0 | 1053 | #define JVM_ACC_INTERFACE 0x0200 /* class is an interface */ |
aoqi@0 | 1054 | #define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */ |
aoqi@0 | 1055 | #define JVM_ACC_STRICT 0x0800 /* strict floating point */ |
aoqi@0 | 1056 | #define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */ |
aoqi@0 | 1057 | #define JVM_ACC_ANNOTATION 0x2000 /* annotation type */ |
aoqi@0 | 1058 | #define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */ |
aoqi@0 | 1059 | |
aoqi@0 | 1060 | #define JVM_ACC_PUBLIC_BIT 0 |
aoqi@0 | 1061 | #define JVM_ACC_PRIVATE_BIT 1 |
aoqi@0 | 1062 | #define JVM_ACC_PROTECTED_BIT 2 |
aoqi@0 | 1063 | #define JVM_ACC_STATIC_BIT 3 |
aoqi@0 | 1064 | #define JVM_ACC_FINAL_BIT 4 |
aoqi@0 | 1065 | #define JVM_ACC_SYNCHRONIZED_BIT 5 |
aoqi@0 | 1066 | #define JVM_ACC_SUPER_BIT 5 |
aoqi@0 | 1067 | #define JVM_ACC_VOLATILE_BIT 6 |
aoqi@0 | 1068 | #define JVM_ACC_BRIDGE_BIT 6 |
aoqi@0 | 1069 | #define JVM_ACC_TRANSIENT_BIT 7 |
aoqi@0 | 1070 | #define JVM_ACC_VARARGS_BIT 7 |
aoqi@0 | 1071 | #define JVM_ACC_NATIVE_BIT 8 |
aoqi@0 | 1072 | #define JVM_ACC_INTERFACE_BIT 9 |
aoqi@0 | 1073 | #define JVM_ACC_ABSTRACT_BIT 10 |
aoqi@0 | 1074 | #define JVM_ACC_STRICT_BIT 11 |
aoqi@0 | 1075 | #define JVM_ACC_SYNTHETIC_BIT 12 |
aoqi@0 | 1076 | #define JVM_ACC_ANNOTATION_BIT 13 |
aoqi@0 | 1077 | #define JVM_ACC_ENUM_BIT 14 |
aoqi@0 | 1078 | |
aoqi@0 | 1079 | // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java |
aoqi@0 | 1080 | enum { |
aoqi@0 | 1081 | JVM_CONSTANT_Utf8 = 1, |
aoqi@0 | 1082 | JVM_CONSTANT_Unicode, /* unused */ |
aoqi@0 | 1083 | JVM_CONSTANT_Integer, |
aoqi@0 | 1084 | JVM_CONSTANT_Float, |
aoqi@0 | 1085 | JVM_CONSTANT_Long, |
aoqi@0 | 1086 | JVM_CONSTANT_Double, |
aoqi@0 | 1087 | JVM_CONSTANT_Class, |
aoqi@0 | 1088 | JVM_CONSTANT_String, |
aoqi@0 | 1089 | JVM_CONSTANT_Fieldref, |
aoqi@0 | 1090 | JVM_CONSTANT_Methodref, |
aoqi@0 | 1091 | JVM_CONSTANT_InterfaceMethodref, |
aoqi@0 | 1092 | JVM_CONSTANT_NameAndType, |
aoqi@0 | 1093 | JVM_CONSTANT_MethodHandle = 15, // JSR 292 |
aoqi@0 | 1094 | JVM_CONSTANT_MethodType = 16, // JSR 292 |
aoqi@0 | 1095 | //JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only |
aoqi@0 | 1096 | JVM_CONSTANT_InvokeDynamic = 18, // JSR 292 |
aoqi@0 | 1097 | JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles |
aoqi@0 | 1098 | }; |
aoqi@0 | 1099 | |
aoqi@0 | 1100 | /* JVM_CONSTANT_MethodHandle subtypes */ |
aoqi@0 | 1101 | enum { |
aoqi@0 | 1102 | JVM_REF_getField = 1, |
aoqi@0 | 1103 | JVM_REF_getStatic = 2, |
aoqi@0 | 1104 | JVM_REF_putField = 3, |
aoqi@0 | 1105 | JVM_REF_putStatic = 4, |
aoqi@0 | 1106 | JVM_REF_invokeVirtual = 5, |
aoqi@0 | 1107 | JVM_REF_invokeStatic = 6, |
aoqi@0 | 1108 | JVM_REF_invokeSpecial = 7, |
aoqi@0 | 1109 | JVM_REF_newInvokeSpecial = 8, |
aoqi@0 | 1110 | JVM_REF_invokeInterface = 9 |
aoqi@0 | 1111 | }; |
aoqi@0 | 1112 | |
aoqi@0 | 1113 | /* Used in the newarray instruction. */ |
aoqi@0 | 1114 | |
aoqi@0 | 1115 | #define JVM_T_BOOLEAN 4 |
aoqi@0 | 1116 | #define JVM_T_CHAR 5 |
aoqi@0 | 1117 | #define JVM_T_FLOAT 6 |
aoqi@0 | 1118 | #define JVM_T_DOUBLE 7 |
aoqi@0 | 1119 | #define JVM_T_BYTE 8 |
aoqi@0 | 1120 | #define JVM_T_SHORT 9 |
aoqi@0 | 1121 | #define JVM_T_INT 10 |
aoqi@0 | 1122 | #define JVM_T_LONG 11 |
aoqi@0 | 1123 | |
aoqi@0 | 1124 | /* JVM method signatures */ |
aoqi@0 | 1125 | |
aoqi@0 | 1126 | #define JVM_SIGNATURE_ARRAY '[' |
aoqi@0 | 1127 | #define JVM_SIGNATURE_BYTE 'B' |
aoqi@0 | 1128 | #define JVM_SIGNATURE_CHAR 'C' |
aoqi@0 | 1129 | #define JVM_SIGNATURE_CLASS 'L' |
aoqi@0 | 1130 | #define JVM_SIGNATURE_ENDCLASS ';' |
aoqi@0 | 1131 | #define JVM_SIGNATURE_ENUM 'E' |
aoqi@0 | 1132 | #define JVM_SIGNATURE_FLOAT 'F' |
aoqi@0 | 1133 | #define JVM_SIGNATURE_DOUBLE 'D' |
aoqi@0 | 1134 | #define JVM_SIGNATURE_FUNC '(' |
aoqi@0 | 1135 | #define JVM_SIGNATURE_ENDFUNC ')' |
aoqi@0 | 1136 | #define JVM_SIGNATURE_INT 'I' |
aoqi@0 | 1137 | #define JVM_SIGNATURE_LONG 'J' |
aoqi@0 | 1138 | #define JVM_SIGNATURE_SHORT 'S' |
aoqi@0 | 1139 | #define JVM_SIGNATURE_VOID 'V' |
aoqi@0 | 1140 | #define JVM_SIGNATURE_BOOLEAN 'Z' |
aoqi@0 | 1141 | |
aoqi@0 | 1142 | /* |
aoqi@0 | 1143 | * A function defined by the byte-code verifier and called by the VM. |
aoqi@0 | 1144 | * This is not a function implemented in the VM. |
aoqi@0 | 1145 | * |
aoqi@0 | 1146 | * Returns JNI_FALSE if verification fails. A detailed error message |
aoqi@0 | 1147 | * will be places in msg_buf, whose length is specified by buf_len. |
aoqi@0 | 1148 | */ |
aoqi@0 | 1149 | typedef jboolean (*verifier_fn_t)(JNIEnv *env, |
aoqi@0 | 1150 | jclass cb, |
aoqi@0 | 1151 | char * msg_buf, |
aoqi@0 | 1152 | jint buf_len); |
aoqi@0 | 1153 | |
aoqi@0 | 1154 | |
aoqi@0 | 1155 | /* |
aoqi@0 | 1156 | * Support for a VM-independent class format checker. |
aoqi@0 | 1157 | */ |
aoqi@0 | 1158 | typedef struct { |
aoqi@0 | 1159 | unsigned long code; /* byte code */ |
aoqi@0 | 1160 | unsigned long excs; /* exceptions */ |
aoqi@0 | 1161 | unsigned long etab; /* catch table */ |
aoqi@0 | 1162 | unsigned long lnum; /* line number */ |
aoqi@0 | 1163 | unsigned long lvar; /* local vars */ |
aoqi@0 | 1164 | } method_size_info; |
aoqi@0 | 1165 | |
aoqi@0 | 1166 | typedef struct { |
aoqi@0 | 1167 | unsigned int constants; /* constant pool */ |
aoqi@0 | 1168 | unsigned int fields; |
aoqi@0 | 1169 | unsigned int methods; |
aoqi@0 | 1170 | unsigned int interfaces; |
aoqi@0 | 1171 | unsigned int fields2; /* number of static 2-word fields */ |
aoqi@0 | 1172 | unsigned int innerclasses; /* # of records in InnerClasses attr */ |
aoqi@0 | 1173 | |
aoqi@0 | 1174 | method_size_info clinit; /* memory used in clinit */ |
aoqi@0 | 1175 | method_size_info main; /* used everywhere else */ |
aoqi@0 | 1176 | } class_size_info; |
aoqi@0 | 1177 | |
aoqi@0 | 1178 | /* |
aoqi@0 | 1179 | * Functions defined in libjava.so to perform string conversions. |
aoqi@0 | 1180 | * |
aoqi@0 | 1181 | */ |
aoqi@0 | 1182 | |
aoqi@0 | 1183 | typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str); |
aoqi@0 | 1184 | |
aoqi@0 | 1185 | typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b); |
aoqi@0 | 1186 | |
aoqi@0 | 1187 | /* This is the function defined in libjava.so that performs class |
aoqi@0 | 1188 | * format checks. This functions fills in size information about |
aoqi@0 | 1189 | * the class file and returns: |
aoqi@0 | 1190 | * |
aoqi@0 | 1191 | * 0: good |
aoqi@0 | 1192 | * -1: out of memory |
aoqi@0 | 1193 | * -2: bad format |
aoqi@0 | 1194 | * -3: unsupported version |
aoqi@0 | 1195 | * -4: bad class name |
aoqi@0 | 1196 | */ |
aoqi@0 | 1197 | |
aoqi@0 | 1198 | typedef jint (*check_format_fn_t)(char *class_name, |
aoqi@0 | 1199 | unsigned char *data, |
aoqi@0 | 1200 | unsigned int data_size, |
aoqi@0 | 1201 | class_size_info *class_size, |
aoqi@0 | 1202 | char *message_buffer, |
aoqi@0 | 1203 | jint buffer_length, |
aoqi@0 | 1204 | jboolean measure_only, |
aoqi@0 | 1205 | jboolean check_relaxed); |
aoqi@0 | 1206 | |
aoqi@0 | 1207 | #define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \ |
aoqi@0 | 1208 | JVM_ACC_FINAL | \ |
aoqi@0 | 1209 | JVM_ACC_SUPER | \ |
aoqi@0 | 1210 | JVM_ACC_INTERFACE | \ |
aoqi@0 | 1211 | JVM_ACC_ABSTRACT | \ |
aoqi@0 | 1212 | JVM_ACC_ANNOTATION | \ |
aoqi@0 | 1213 | JVM_ACC_ENUM | \ |
aoqi@0 | 1214 | JVM_ACC_SYNTHETIC) |
aoqi@0 | 1215 | |
aoqi@0 | 1216 | #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \ |
aoqi@0 | 1217 | JVM_ACC_PRIVATE | \ |
aoqi@0 | 1218 | JVM_ACC_PROTECTED | \ |
aoqi@0 | 1219 | JVM_ACC_STATIC | \ |
aoqi@0 | 1220 | JVM_ACC_FINAL | \ |
aoqi@0 | 1221 | JVM_ACC_VOLATILE | \ |
aoqi@0 | 1222 | JVM_ACC_TRANSIENT | \ |
aoqi@0 | 1223 | JVM_ACC_ENUM | \ |
aoqi@0 | 1224 | JVM_ACC_SYNTHETIC) |
aoqi@0 | 1225 | |
aoqi@0 | 1226 | #define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \ |
aoqi@0 | 1227 | JVM_ACC_PRIVATE | \ |
aoqi@0 | 1228 | JVM_ACC_PROTECTED | \ |
aoqi@0 | 1229 | JVM_ACC_STATIC | \ |
aoqi@0 | 1230 | JVM_ACC_FINAL | \ |
aoqi@0 | 1231 | JVM_ACC_SYNCHRONIZED | \ |
aoqi@0 | 1232 | JVM_ACC_BRIDGE | \ |
aoqi@0 | 1233 | JVM_ACC_VARARGS | \ |
aoqi@0 | 1234 | JVM_ACC_NATIVE | \ |
aoqi@0 | 1235 | JVM_ACC_ABSTRACT | \ |
aoqi@0 | 1236 | JVM_ACC_STRICT | \ |
aoqi@0 | 1237 | JVM_ACC_SYNTHETIC) |
aoqi@0 | 1238 | |
aoqi@0 | 1239 | /* |
aoqi@0 | 1240 | * This is the function defined in libjava.so to perform path |
aoqi@0 | 1241 | * canonicalization. VM call this function before opening jar files |
aoqi@0 | 1242 | * to load system classes. |
aoqi@0 | 1243 | * |
aoqi@0 | 1244 | */ |
aoqi@0 | 1245 | |
aoqi@0 | 1246 | typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); |
aoqi@0 | 1247 | |
aoqi@0 | 1248 | /************************************************************************* |
aoqi@0 | 1249 | PART 3: I/O and Network Support |
aoqi@0 | 1250 | ************************************************************************/ |
aoqi@0 | 1251 | |
aoqi@0 | 1252 | /* Note that the JVM IO functions are expected to return JVM_IO_ERR |
aoqi@0 | 1253 | * when there is any kind of error. The caller can then use the |
aoqi@0 | 1254 | * platform specific support (e.g., errno) to get the detailed |
aoqi@0 | 1255 | * error info. The JVM_GetLastErrorString procedure may also be used |
aoqi@0 | 1256 | * to obtain a descriptive error string. |
aoqi@0 | 1257 | */ |
aoqi@0 | 1258 | #define JVM_IO_ERR (-1) |
aoqi@0 | 1259 | |
aoqi@0 | 1260 | /* For interruptible IO. Returning JVM_IO_INTR indicates that an IO |
aoqi@0 | 1261 | * operation has been disrupted by Thread.interrupt. There are a |
aoqi@0 | 1262 | * number of technical difficulties related to interruptible IO that |
aoqi@0 | 1263 | * need to be solved. For example, most existing programs do not handle |
aoqi@0 | 1264 | * InterruptedIOExceptions specially, they simply treat those as any |
aoqi@0 | 1265 | * IOExceptions, which typically indicate fatal errors. |
aoqi@0 | 1266 | * |
aoqi@0 | 1267 | * There are also two modes of operation for interruptible IO. In the |
aoqi@0 | 1268 | * resumption mode, an interrupted IO operation is guaranteed not to |
aoqi@0 | 1269 | * have any side-effects, and can be restarted. In the termination mode, |
aoqi@0 | 1270 | * an interrupted IO operation corrupts the underlying IO stream, so |
aoqi@0 | 1271 | * that the only reasonable operation on an interrupted stream is to |
aoqi@0 | 1272 | * close that stream. The resumption mode seems to be impossible to |
aoqi@0 | 1273 | * implement on Win32 and Solaris. Implementing the termination mode is |
aoqi@0 | 1274 | * easier, but it's not clear that's the right semantics. |
aoqi@0 | 1275 | * |
aoqi@0 | 1276 | * Interruptible IO is not supported on Win32.It can be enabled/disabled |
aoqi@0 | 1277 | * using a compile-time flag on Solaris. Third-party JVM ports do not |
aoqi@0 | 1278 | * need to implement interruptible IO. |
aoqi@0 | 1279 | */ |
aoqi@0 | 1280 | #define JVM_IO_INTR (-2) |
aoqi@0 | 1281 | |
aoqi@0 | 1282 | /* Write a string into the given buffer, in the platform's local encoding, |
aoqi@0 | 1283 | * that describes the most recent system-level error to occur in this thread. |
aoqi@0 | 1284 | * Return the length of the string or zero if no error occurred. |
aoqi@0 | 1285 | */ |
aoqi@0 | 1286 | JNIEXPORT jint JNICALL |
aoqi@0 | 1287 | JVM_GetLastErrorString(char *buf, int len); |
aoqi@0 | 1288 | |
aoqi@0 | 1289 | /* |
aoqi@0 | 1290 | * Convert a pathname into native format. This function does syntactic |
aoqi@0 | 1291 | * cleanup, such as removing redundant separator characters. It modifies |
aoqi@0 | 1292 | * the given pathname string in place. |
aoqi@0 | 1293 | */ |
aoqi@0 | 1294 | JNIEXPORT char * JNICALL |
aoqi@0 | 1295 | JVM_NativePath(char *); |
aoqi@0 | 1296 | |
aoqi@0 | 1297 | /* |
aoqi@0 | 1298 | * JVM I/O error codes |
aoqi@0 | 1299 | */ |
aoqi@0 | 1300 | #define JVM_EEXIST -100 |
aoqi@0 | 1301 | |
aoqi@0 | 1302 | /* |
aoqi@0 | 1303 | * Open a file descriptor. This function returns a negative error code |
aoqi@0 | 1304 | * on error, and a non-negative integer that is the file descriptor on |
aoqi@0 | 1305 | * success. |
aoqi@0 | 1306 | */ |
aoqi@0 | 1307 | JNIEXPORT jint JNICALL |
aoqi@0 | 1308 | JVM_Open(const char *fname, jint flags, jint mode); |
aoqi@0 | 1309 | |
aoqi@0 | 1310 | /* |
aoqi@0 | 1311 | * Close a file descriptor. This function returns -1 on error, and 0 |
aoqi@0 | 1312 | * on success. |
aoqi@0 | 1313 | * |
aoqi@0 | 1314 | * fd the file descriptor to close. |
aoqi@0 | 1315 | */ |
aoqi@0 | 1316 | JNIEXPORT jint JNICALL |
aoqi@0 | 1317 | JVM_Close(jint fd); |
aoqi@0 | 1318 | |
aoqi@0 | 1319 | /* |
aoqi@0 | 1320 | * Read data from a file decriptor into a char array. |
aoqi@0 | 1321 | * |
aoqi@0 | 1322 | * fd the file descriptor to read from. |
aoqi@0 | 1323 | * buf the buffer where to put the read data. |
aoqi@0 | 1324 | * nbytes the number of bytes to read. |
aoqi@0 | 1325 | * |
aoqi@0 | 1326 | * This function returns -1 on error, and 0 on success. |
aoqi@0 | 1327 | */ |
aoqi@0 | 1328 | JNIEXPORT jint JNICALL |
aoqi@0 | 1329 | JVM_Read(jint fd, char *buf, jint nbytes); |
aoqi@0 | 1330 | |
aoqi@0 | 1331 | /* |
aoqi@0 | 1332 | * Write data from a char array to a file decriptor. |
aoqi@0 | 1333 | * |
aoqi@0 | 1334 | * fd the file descriptor to read from. |
aoqi@0 | 1335 | * buf the buffer from which to fetch the data. |
aoqi@0 | 1336 | * nbytes the number of bytes to write. |
aoqi@0 | 1337 | * |
aoqi@0 | 1338 | * This function returns -1 on error, and 0 on success. |
aoqi@0 | 1339 | */ |
aoqi@0 | 1340 | JNIEXPORT jint JNICALL |
aoqi@0 | 1341 | JVM_Write(jint fd, char *buf, jint nbytes); |
aoqi@0 | 1342 | |
aoqi@0 | 1343 | /* |
aoqi@0 | 1344 | * Returns the number of bytes available for reading from a given file |
aoqi@0 | 1345 | * descriptor |
aoqi@0 | 1346 | */ |
aoqi@0 | 1347 | JNIEXPORT jint JNICALL |
aoqi@0 | 1348 | JVM_Available(jint fd, jlong *pbytes); |
aoqi@0 | 1349 | |
aoqi@0 | 1350 | /* |
aoqi@0 | 1351 | * Move the file descriptor pointer from whence by offset. |
aoqi@0 | 1352 | * |
aoqi@0 | 1353 | * fd the file descriptor to move. |
aoqi@0 | 1354 | * offset the number of bytes to move it by. |
aoqi@0 | 1355 | * whence the start from where to move it. |
aoqi@0 | 1356 | * |
aoqi@0 | 1357 | * This function returns the resulting pointer location. |
aoqi@0 | 1358 | */ |
aoqi@0 | 1359 | JNIEXPORT jlong JNICALL |
aoqi@0 | 1360 | JVM_Lseek(jint fd, jlong offset, jint whence); |
aoqi@0 | 1361 | |
aoqi@0 | 1362 | /* |
aoqi@0 | 1363 | * Set the length of the file associated with the given descriptor to the given |
aoqi@0 | 1364 | * length. If the new length is longer than the current length then the file |
aoqi@0 | 1365 | * is extended; the contents of the extended portion are not defined. The |
aoqi@0 | 1366 | * value of the file pointer is undefined after this procedure returns. |
aoqi@0 | 1367 | */ |
aoqi@0 | 1368 | JNIEXPORT jint JNICALL |
aoqi@0 | 1369 | JVM_SetLength(jint fd, jlong length); |
aoqi@0 | 1370 | |
aoqi@0 | 1371 | /* |
aoqi@0 | 1372 | * Synchronize the file descriptor's in memory state with that of the |
aoqi@0 | 1373 | * physical device. Return of -1 is an error, 0 is OK. |
aoqi@0 | 1374 | */ |
aoqi@0 | 1375 | JNIEXPORT jint JNICALL |
aoqi@0 | 1376 | JVM_Sync(jint fd); |
aoqi@0 | 1377 | |
aoqi@0 | 1378 | /* |
aoqi@0 | 1379 | * Networking library support |
aoqi@0 | 1380 | */ |
aoqi@0 | 1381 | |
aoqi@0 | 1382 | JNIEXPORT jint JNICALL |
aoqi@0 | 1383 | JVM_InitializeSocketLibrary(void); |
aoqi@0 | 1384 | |
aoqi@0 | 1385 | struct sockaddr; |
aoqi@0 | 1386 | |
aoqi@0 | 1387 | JNIEXPORT jint JNICALL |
aoqi@0 | 1388 | JVM_Socket(jint domain, jint type, jint protocol); |
aoqi@0 | 1389 | |
aoqi@0 | 1390 | JNIEXPORT jint JNICALL |
aoqi@0 | 1391 | JVM_SocketClose(jint fd); |
aoqi@0 | 1392 | |
aoqi@0 | 1393 | JNIEXPORT jint JNICALL |
aoqi@0 | 1394 | JVM_SocketShutdown(jint fd, jint howto); |
aoqi@0 | 1395 | |
aoqi@0 | 1396 | JNIEXPORT jint JNICALL |
aoqi@0 | 1397 | JVM_Recv(jint fd, char *buf, jint nBytes, jint flags); |
aoqi@0 | 1398 | |
aoqi@0 | 1399 | JNIEXPORT jint JNICALL |
aoqi@0 | 1400 | JVM_Send(jint fd, char *buf, jint nBytes, jint flags); |
aoqi@0 | 1401 | |
aoqi@0 | 1402 | JNIEXPORT jint JNICALL |
aoqi@0 | 1403 | JVM_Timeout(int fd, long timeout); |
aoqi@0 | 1404 | |
aoqi@0 | 1405 | JNIEXPORT jint JNICALL |
aoqi@0 | 1406 | JVM_Listen(jint fd, jint count); |
aoqi@0 | 1407 | |
aoqi@0 | 1408 | JNIEXPORT jint JNICALL |
aoqi@0 | 1409 | JVM_Connect(jint fd, struct sockaddr *him, jint len); |
aoqi@0 | 1410 | |
aoqi@0 | 1411 | JNIEXPORT jint JNICALL |
aoqi@0 | 1412 | JVM_Bind(jint fd, struct sockaddr *him, jint len); |
aoqi@0 | 1413 | |
aoqi@0 | 1414 | JNIEXPORT jint JNICALL |
aoqi@0 | 1415 | JVM_Accept(jint fd, struct sockaddr *him, jint *len); |
aoqi@0 | 1416 | |
aoqi@0 | 1417 | JNIEXPORT jint JNICALL |
aoqi@0 | 1418 | JVM_RecvFrom(jint fd, char *buf, int nBytes, |
aoqi@0 | 1419 | int flags, struct sockaddr *from, int *fromlen); |
aoqi@0 | 1420 | |
aoqi@0 | 1421 | JNIEXPORT jint JNICALL |
aoqi@0 | 1422 | JVM_SendTo(jint fd, char *buf, int len, |
aoqi@0 | 1423 | int flags, struct sockaddr *to, int tolen); |
aoqi@0 | 1424 | |
aoqi@0 | 1425 | JNIEXPORT jint JNICALL |
aoqi@0 | 1426 | JVM_SocketAvailable(jint fd, jint *result); |
aoqi@0 | 1427 | |
aoqi@0 | 1428 | |
aoqi@0 | 1429 | JNIEXPORT jint JNICALL |
aoqi@0 | 1430 | JVM_GetSockName(jint fd, struct sockaddr *him, int *len); |
aoqi@0 | 1431 | |
aoqi@0 | 1432 | JNIEXPORT jint JNICALL |
aoqi@0 | 1433 | JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen); |
aoqi@0 | 1434 | |
aoqi@0 | 1435 | JNIEXPORT jint JNICALL |
aoqi@0 | 1436 | JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen); |
aoqi@0 | 1437 | |
aoqi@0 | 1438 | JNIEXPORT int JNICALL |
aoqi@0 | 1439 | JVM_GetHostName(char* name, int namelen); |
aoqi@0 | 1440 | |
aoqi@0 | 1441 | /* |
aoqi@0 | 1442 | * The standard printing functions supported by the Java VM. (Should they |
aoqi@0 | 1443 | * be renamed to JVM_* in the future? |
aoqi@0 | 1444 | */ |
aoqi@0 | 1445 | |
aoqi@0 | 1446 | /* |
aoqi@0 | 1447 | * BE CAREFUL! The following functions do not implement the |
aoqi@0 | 1448 | * full feature set of standard C printf formats. |
aoqi@0 | 1449 | */ |
aoqi@0 | 1450 | JNIEXPORT int |
aoqi@0 | 1451 | jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); |
aoqi@0 | 1452 | |
aoqi@0 | 1453 | JNIEXPORT int |
aoqi@0 | 1454 | jio_snprintf(char *str, size_t count, const char *fmt, ...); |
aoqi@0 | 1455 | |
aoqi@0 | 1456 | JNIEXPORT int |
aoqi@0 | 1457 | jio_fprintf(FILE *, const char *fmt, ...); |
aoqi@0 | 1458 | |
aoqi@0 | 1459 | JNIEXPORT int |
aoqi@0 | 1460 | jio_vfprintf(FILE *, const char *fmt, va_list args); |
aoqi@0 | 1461 | |
aoqi@0 | 1462 | |
aoqi@0 | 1463 | JNIEXPORT void * JNICALL |
aoqi@0 | 1464 | JVM_RawMonitorCreate(void); |
aoqi@0 | 1465 | |
aoqi@0 | 1466 | JNIEXPORT void JNICALL |
aoqi@0 | 1467 | JVM_RawMonitorDestroy(void *mon); |
aoqi@0 | 1468 | |
aoqi@0 | 1469 | JNIEXPORT jint JNICALL |
aoqi@0 | 1470 | JVM_RawMonitorEnter(void *mon); |
aoqi@0 | 1471 | |
aoqi@0 | 1472 | JNIEXPORT void JNICALL |
aoqi@0 | 1473 | JVM_RawMonitorExit(void *mon); |
aoqi@0 | 1474 | |
aoqi@0 | 1475 | /* |
aoqi@0 | 1476 | * java.lang.reflect.Method |
aoqi@0 | 1477 | */ |
aoqi@0 | 1478 | JNIEXPORT jobject JNICALL |
aoqi@0 | 1479 | JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0); |
aoqi@0 | 1480 | |
aoqi@0 | 1481 | /* |
aoqi@0 | 1482 | * java.lang.reflect.Constructor |
aoqi@0 | 1483 | */ |
aoqi@0 | 1484 | JNIEXPORT jobject JNICALL |
aoqi@0 | 1485 | JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0); |
aoqi@0 | 1486 | |
aoqi@0 | 1487 | /* |
aoqi@0 | 1488 | * java.lang.management support |
aoqi@0 | 1489 | */ |
aoqi@0 | 1490 | JNIEXPORT void* JNICALL |
aoqi@0 | 1491 | JVM_GetManagement(jint version); |
aoqi@0 | 1492 | |
aoqi@0 | 1493 | /* |
aoqi@0 | 1494 | * com.sun.tools.attach.VirtualMachine support |
aoqi@0 | 1495 | * |
aoqi@0 | 1496 | * Initialize the agent properties with the properties maintained in the VM. |
aoqi@0 | 1497 | */ |
aoqi@0 | 1498 | JNIEXPORT jobject JNICALL |
aoqi@0 | 1499 | JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); |
aoqi@0 | 1500 | |
aoqi@0 | 1501 | JNIEXPORT jstring JNICALL |
aoqi@0 | 1502 | JVM_GetTemporaryDirectory(JNIEnv *env); |
aoqi@0 | 1503 | |
aoqi@0 | 1504 | /* Generics reflection support. |
aoqi@0 | 1505 | * |
aoqi@0 | 1506 | * Returns information about the given class's EnclosingMethod |
aoqi@0 | 1507 | * attribute, if present, or null if the class had no enclosing |
aoqi@0 | 1508 | * method. |
aoqi@0 | 1509 | * |
aoqi@0 | 1510 | * If non-null, the returned array contains three elements. Element 0 |
aoqi@0 | 1511 | * is the java.lang.Class of which the enclosing method is a member, |
aoqi@0 | 1512 | * and elements 1 and 2 are the java.lang.Strings for the enclosing |
aoqi@0 | 1513 | * method's name and descriptor, respectively. |
aoqi@0 | 1514 | */ |
aoqi@0 | 1515 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 1516 | JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); |
aoqi@0 | 1517 | |
aoqi@0 | 1518 | /* |
aoqi@0 | 1519 | * Java thread state support |
aoqi@0 | 1520 | */ |
aoqi@0 | 1521 | enum { |
aoqi@0 | 1522 | JAVA_THREAD_STATE_NEW = 0, |
aoqi@0 | 1523 | JAVA_THREAD_STATE_RUNNABLE = 1, |
aoqi@0 | 1524 | JAVA_THREAD_STATE_BLOCKED = 2, |
aoqi@0 | 1525 | JAVA_THREAD_STATE_WAITING = 3, |
aoqi@0 | 1526 | JAVA_THREAD_STATE_TIMED_WAITING = 4, |
aoqi@0 | 1527 | JAVA_THREAD_STATE_TERMINATED = 5, |
aoqi@0 | 1528 | JAVA_THREAD_STATE_COUNT = 6 |
aoqi@0 | 1529 | }; |
aoqi@0 | 1530 | |
aoqi@0 | 1531 | /* |
aoqi@0 | 1532 | * Returns an array of the threadStatus values representing the |
aoqi@0 | 1533 | * given Java thread state. Returns NULL if the VM version is |
aoqi@0 | 1534 | * incompatible with the JDK or doesn't support the given |
aoqi@0 | 1535 | * Java thread state. |
aoqi@0 | 1536 | */ |
aoqi@0 | 1537 | JNIEXPORT jintArray JNICALL |
aoqi@0 | 1538 | JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState); |
aoqi@0 | 1539 | |
aoqi@0 | 1540 | /* |
aoqi@0 | 1541 | * Returns an array of the substate names representing the |
aoqi@0 | 1542 | * given Java thread state. Returns NULL if the VM version is |
aoqi@0 | 1543 | * incompatible with the JDK or the VM doesn't support |
aoqi@0 | 1544 | * the given Java thread state. |
aoqi@0 | 1545 | * values must be the jintArray returned from JVM_GetThreadStateValues |
aoqi@0 | 1546 | * and javaThreadState. |
aoqi@0 | 1547 | */ |
aoqi@0 | 1548 | JNIEXPORT jobjectArray JNICALL |
aoqi@0 | 1549 | JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values); |
aoqi@0 | 1550 | |
iklam@7322 | 1551 | /* |
iklam@7322 | 1552 | * Returns true if the JVM's lookup cache indicates that this class is |
iklam@7322 | 1553 | * known to NOT exist for the given loader. |
iklam@7322 | 1554 | */ |
iklam@7322 | 1555 | JNIEXPORT jboolean JNICALL |
iklam@7322 | 1556 | JVM_KnownToNotExist(JNIEnv *env, jobject loader, const char *classname); |
iklam@7322 | 1557 | |
iklam@7322 | 1558 | /* |
iklam@7322 | 1559 | * Returns an array of all URLs that are stored in the JVM's lookup cache |
iklam@7322 | 1560 | * for the given loader. NULL if the lookup cache is unavailable. |
iklam@7322 | 1561 | */ |
iklam@7322 | 1562 | JNIEXPORT jobjectArray JNICALL |
iklam@7322 | 1563 | JVM_GetResourceLookupCacheURLs(JNIEnv *env, jobject loader); |
iklam@7322 | 1564 | |
iklam@7322 | 1565 | /* |
iklam@7322 | 1566 | * Returns an array of all URLs that *may* contain the resource_name for the |
iklam@7322 | 1567 | * given loader. This function returns an integer array, each element |
iklam@7322 | 1568 | * of which can be used to index into the array returned by |
iklam@7322 | 1569 | * JVM_GetResourceLookupCacheURLs of the same loader to determine the |
iklam@7322 | 1570 | * URLs. |
iklam@7322 | 1571 | */ |
iklam@7322 | 1572 | JNIEXPORT jintArray JNICALL |
iklam@7322 | 1573 | JVM_GetResourceLookupCache(JNIEnv *env, jobject loader, const char *resource_name); |
iklam@7322 | 1574 | |
iklam@7322 | 1575 | |
aoqi@0 | 1576 | /* ========================================================================= |
aoqi@0 | 1577 | * The following defines a private JVM interface that the JDK can query |
aoqi@0 | 1578 | * for the JVM version and capabilities. sun.misc.Version defines |
aoqi@0 | 1579 | * the methods for getting the VM version and its capabilities. |
aoqi@0 | 1580 | * |
aoqi@0 | 1581 | * When a new bit is added, the following should be updated to provide |
aoqi@0 | 1582 | * access to the new capability: |
aoqi@0 | 1583 | * HS: JVM_GetVersionInfo and Abstract_VM_Version class |
aoqi@0 | 1584 | * SDK: Version class |
aoqi@0 | 1585 | * |
aoqi@0 | 1586 | * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for |
aoqi@0 | 1587 | * JVM to query for the JDK version and capabilities. |
aoqi@0 | 1588 | * |
aoqi@0 | 1589 | * When a new bit is added, the following should be updated to provide |
aoqi@0 | 1590 | * access to the new capability: |
aoqi@0 | 1591 | * HS: JDK_Version class |
aoqi@0 | 1592 | * SDK: JDK_GetVersionInfo0 |
aoqi@0 | 1593 | * |
aoqi@0 | 1594 | * ========================================================================== |
aoqi@0 | 1595 | */ |
aoqi@0 | 1596 | typedef struct { |
aoqi@0 | 1597 | /* HotSpot Express VM version string: |
aoqi@0 | 1598 | * <major>.<minor>-bxx[-<identifier>][-<debug_flavor>] |
aoqi@0 | 1599 | */ |
aoqi@0 | 1600 | unsigned int jvm_version; /* Consists of major.minor.0.build */ |
aoqi@0 | 1601 | unsigned int update_version : 8; /* 0 in HotSpot Express VM */ |
aoqi@0 | 1602 | unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */ |
aoqi@0 | 1603 | unsigned int reserved1 : 16; |
aoqi@0 | 1604 | unsigned int reserved2; |
aoqi@0 | 1605 | |
aoqi@0 | 1606 | /* The following bits represents JVM supports that JDK has dependency on. |
aoqi@0 | 1607 | * JDK can use these bits to determine which JVM version |
aoqi@0 | 1608 | * and support it has to maintain runtime compatibility. |
aoqi@0 | 1609 | * |
aoqi@0 | 1610 | * When a new bit is added in a minor or update release, make sure |
aoqi@0 | 1611 | * the new bit is also added in the main/baseline. |
aoqi@0 | 1612 | */ |
aoqi@0 | 1613 | unsigned int is_attachable : 1; |
aoqi@0 | 1614 | unsigned int : 31; |
aoqi@0 | 1615 | unsigned int : 32; |
aoqi@0 | 1616 | unsigned int : 32; |
aoqi@0 | 1617 | } jvm_version_info; |
aoqi@0 | 1618 | |
aoqi@0 | 1619 | #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) |
aoqi@0 | 1620 | #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) |
aoqi@0 | 1621 | // Micro version is 0 in HotSpot Express VM (set in jvm.cpp). |
aoqi@0 | 1622 | #define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) |
aoqi@0 | 1623 | /* Build number is available in all HotSpot Express VM builds. |
aoqi@0 | 1624 | * It is defined in make/hotspot_version file. |
aoqi@0 | 1625 | */ |
aoqi@0 | 1626 | #define JVM_VERSION_BUILD(version) ((version & 0x000000FF)) |
aoqi@0 | 1627 | |
aoqi@0 | 1628 | JNIEXPORT void JNICALL |
aoqi@0 | 1629 | JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size); |
aoqi@0 | 1630 | |
aoqi@0 | 1631 | typedef struct { |
aoqi@0 | 1632 | // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx |
aoqi@0 | 1633 | unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */ |
aoqi@0 | 1634 | /* and build number (xx) */ |
aoqi@0 | 1635 | unsigned int update_version : 8; /* Update release version (uu) */ |
aoqi@0 | 1636 | unsigned int special_update_version : 8; /* Special update release version (c)*/ |
aoqi@0 | 1637 | unsigned int reserved1 : 16; |
aoqi@0 | 1638 | unsigned int reserved2; |
aoqi@0 | 1639 | |
aoqi@0 | 1640 | /* The following bits represents new JDK supports that VM has dependency on. |
aoqi@0 | 1641 | * VM implementation can use these bits to determine which JDK version |
aoqi@0 | 1642 | * and support it has to maintain runtime compatibility. |
aoqi@0 | 1643 | * |
aoqi@0 | 1644 | * When a new bit is added in a minor or update release, make sure |
aoqi@0 | 1645 | * the new bit is also added in the main/baseline. |
aoqi@0 | 1646 | */ |
aoqi@0 | 1647 | unsigned int thread_park_blocker : 1; |
aoqi@0 | 1648 | unsigned int post_vm_init_hook_enabled : 1; |
aoqi@0 | 1649 | unsigned int pending_list_uses_discovered_field : 1; |
aoqi@0 | 1650 | unsigned int : 29; |
aoqi@0 | 1651 | unsigned int : 32; |
aoqi@0 | 1652 | unsigned int : 32; |
aoqi@0 | 1653 | } jdk_version_info; |
aoqi@0 | 1654 | |
aoqi@0 | 1655 | #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) |
aoqi@0 | 1656 | #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) |
aoqi@0 | 1657 | #define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) |
aoqi@0 | 1658 | |
aoqi@0 | 1659 | /* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN) |
aoqi@0 | 1660 | * It will be zero for internal builds. |
aoqi@0 | 1661 | */ |
aoqi@0 | 1662 | #define JDK_VERSION_BUILD(version) ((version & 0x000000FF)) |
aoqi@0 | 1663 | |
aoqi@0 | 1664 | /* |
aoqi@0 | 1665 | * This is the function JDK_GetVersionInfo0 defined in libjava.so |
aoqi@0 | 1666 | * that is dynamically looked up by JVM. |
aoqi@0 | 1667 | */ |
aoqi@0 | 1668 | typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size); |
aoqi@0 | 1669 | |
aoqi@0 | 1670 | /* |
aoqi@0 | 1671 | * This structure is used by the launcher to get the default thread |
aoqi@0 | 1672 | * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a |
aoqi@0 | 1673 | * version of 1.1. As it is not supported otherwise, it has been removed |
aoqi@0 | 1674 | * from jni.h |
aoqi@0 | 1675 | */ |
aoqi@0 | 1676 | typedef struct JDK1_1InitArgs { |
aoqi@0 | 1677 | jint version; |
aoqi@0 | 1678 | |
aoqi@0 | 1679 | char **properties; |
aoqi@0 | 1680 | jint checkSource; |
aoqi@0 | 1681 | jint nativeStackSize; |
aoqi@0 | 1682 | jint javaStackSize; |
aoqi@0 | 1683 | jint minHeapSize; |
aoqi@0 | 1684 | jint maxHeapSize; |
aoqi@0 | 1685 | jint verifyMode; |
aoqi@0 | 1686 | char *classpath; |
aoqi@0 | 1687 | |
aoqi@0 | 1688 | jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); |
aoqi@0 | 1689 | void (JNICALL *exit)(jint code); |
aoqi@0 | 1690 | void (JNICALL *abort)(void); |
aoqi@0 | 1691 | |
aoqi@0 | 1692 | jint enableClassGC; |
aoqi@0 | 1693 | jint enableVerboseGC; |
aoqi@0 | 1694 | jint disableAsyncGC; |
aoqi@0 | 1695 | jint verbose; |
aoqi@0 | 1696 | jboolean debugging; |
aoqi@0 | 1697 | jint debugPort; |
aoqi@0 | 1698 | } JDK1_1InitArgs; |
aoqi@0 | 1699 | |
aoqi@0 | 1700 | #ifdef __cplusplus |
aoqi@0 | 1701 | } /* extern "C" */ |
aoqi@0 | 1702 | #endif /* __cplusplus */ |
aoqi@0 | 1703 | |
aoqi@0 | 1704 | #endif /* !_JAVASOFT_JVM_H_ */ |
aoqi@0 | 1705 | |
aoqi@0 | 1706 | #endif // SHARE_VM_PRIMS_JVM_H |