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