annotate src/share/javavm/export/jvm.h @ 4338:9b8c96f96a0f

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