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_SetNativeThreadName0(const char *name);
 252 
 253 JNIEXPORT void JNICALL
 254 JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);
 255 
 256 /* getStackTrace() and getAllStackTraces() method */
 257 JNIEXPORT jobjectArray JNICALL
 258 JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);
 259 
 260 /*
 261  * java.lang.SecurityManager
 262  */
 263 JNIEXPORT jclass JNICALL
 264 JVM_CurrentLoadedClass(JNIEnv *env);
 265 
 266 JNIEXPORT jobject JNICALL
 267 JVM_CurrentClassLoader(JNIEnv *env);
 268 
 269 JNIEXPORT jobjectArray JNICALL
 270 JVM_GetClassContext(JNIEnv *env);
 271 
 272 JNIEXPORT jint JNICALL
 273 JVM_ClassDepth(JNIEnv *env, jstring name);
 274 
 275 JNIEXPORT jint JNICALL
 276 JVM_ClassLoaderDepth(JNIEnv *env);
 277 
 278 /*
 279  * java.lang.Package
 280  */
 281 JNIEXPORT jstring JNICALL
 282 JVM_GetSystemPackage(JNIEnv *env, jstring name);
 283 
 284 JNIEXPORT jobjectArray JNICALL
 285 JVM_GetSystemPackages(JNIEnv *env);
 286 
 287 /*
 288  * java.io.ObjectInputStream
 289  */
 290 JNIEXPORT jobject JNICALL
 291 JVM_LatestUserDefinedLoader(JNIEnv *env);
 292 
 293 /*
 294  * java.lang.reflect.Array
 295  */
 296 JNIEXPORT jint JNICALL
 297 JVM_GetArrayLength(JNIEnv *env, jobject arr);
 298 
 299 JNIEXPORT jobject JNICALL
 300 JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
 301 
 302 JNIEXPORT jvalue JNICALL
 303 JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
 304 
 305 JNIEXPORT void JNICALL
 306 JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
 307 
 308 JNIEXPORT void JNICALL
 309 JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
 310                              unsigned char vCode);
 311 
 312 JNIEXPORT jobject JNICALL
 313 JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);
 314 
 315 JNIEXPORT jobject JNICALL
 316 JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
 317 
 318 /*
 319  * java.lang.Class and java.lang.ClassLoader
 320  */
 321 
 322 #define JVM_CALLER_DEPTH -1
 323 
 324 /*
 325  * Returns the immediate caller class of the native method invoking
 326  * JVM_GetCallerClass.  The Method.invoke and other frames due to
 327  * reflection machinery are skipped.
 328  *
 329  * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
 330  * to be marked with sun.reflect.CallerSensitive.  The JVM will throw
 331  * an error if it is not marked propertly.
 332  */
 333 JNIEXPORT jclass JNICALL
 334 JVM_GetCallerClass(JNIEnv *env, int depth);
 335 
 336 
 337 /*
 338  * Find primitive classes
 339  * utf: class name
 340  */
 341 JNIEXPORT jclass JNICALL
 342 JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
 343 
 344 
 345 /*
 346  * Find a class from a boot class loader. Returns NULL if class not found.
 347  */
 348 JNIEXPORT jclass JNICALL
 349 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
 350 
 351 /*
 352  * Find a class from a given class loader.  Throws ClassNotFoundException.
 353  *  name:   name of class
 354  *  init:   whether initialization is done
 355  *  loader: class loader to look up the class. This may not be the same as the caller's
 356  *          class loader.
 357  *  caller: initiating class. The initiating class may be null when a security
 358  *          manager is not installed.
 359  */
 360 JNIEXPORT jclass JNICALL
 361 JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,
 362                         jobject loader, jclass caller);
 363 
 364 /*
 365  * Find a class from a given class.
 366  */
 367 JNIEXPORT jclass JNICALL
 368 JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
 369                              jclass from);
 370 
 371 /* Find a loaded class cached by the VM */
 372 JNIEXPORT jclass JNICALL
 373 JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);
 374 
 375 /* Define a class */
 376 JNIEXPORT jclass JNICALL
 377 JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
 378                 jsize len, jobject pd);
 379 
 380 /* Define a class with a source (added in JDK1.5) */
 381 JNIEXPORT jclass JNICALL
 382 JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
 383                           const jbyte *buf, jsize len, jobject pd,
 384                           const char *source);
 385 
 386 /*
 387  * Module support funcions
 388  */
 389 
 390 JNIEXPORT void JNICALL
 391 JVM_DefineModule(JNIEnv *env, jobject module, jstring version, jstring location,
 392                  jobjectArray packages);
 393 
 394 JNIEXPORT void JNICALL
 395 JVM_SetBootLoaderUnnamedModule(JNIEnv *env, jobject module);
 396 
 397 JNIEXPORT void JNICALL
 398 JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject to_module);
 399 
 400 JNIEXPORT jboolean JNICALL
 401 JVM_CanReadModule(JNIEnv *env, jobject asking_module, jobject source_module);
 402 
 403 JNIEXPORT void JNICALL
 404 JVM_AddModuleExports(JNIEnv *env, jobject from_module, jstring package, jobject to_module);
 405 
 406 JNIEXPORT void JNICALL
 407 JVM_AddModuleExportsToAll(JNIEnv *env, jobject from_module, jstring package);
 408 
 409 JNIEXPORT void JNICALL
 410 JVM_AddModuleExportsToAllUnnamed(JNIEnv *env, jobject from_module, jstring package);
 411 
 412 JNIEXPORT jboolean JNICALL
 413 JVM_IsExportedToModule(JNIEnv *env, jobject from_module, jstring package, jobject to_module);
 414 
 415 JNIEXPORT void JNICALL
 416 JVM_AddModulePackage(JNIEnv* env,  jobject module, jstring package);
 417 
 418 JNIEXPORT jobject JNICALL
 419 JVM_GetModuleByPackageName(JNIEnv *env, jobject cl, jstring pkg);
 420 
 421 /*
 422  * Reflection support functions
 423  */
 424 
 425 JNIEXPORT jstring JNICALL
 426 JVM_GetClassName(JNIEnv *env, jclass cls);
 427 
 428 JNIEXPORT jobjectArray JNICALL
 429 JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
 430 
 431 JNIEXPORT jboolean JNICALL
 432 JVM_IsInterface(JNIEnv *env, jclass cls);
 433 
 434 JNIEXPORT jobjectArray JNICALL
 435 JVM_GetClassSigners(JNIEnv *env, jclass cls);
 436 
 437 JNIEXPORT void JNICALL
 438 JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
 439 
 440 JNIEXPORT jobject JNICALL
 441 JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
 442 
 443 JNIEXPORT jboolean JNICALL
 444 JVM_IsArrayClass(JNIEnv *env, jclass cls);
 445 
 446 JNIEXPORT jboolean JNICALL
 447 JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
 448 
 449 JNIEXPORT jint JNICALL
 450 JVM_GetClassModifiers(JNIEnv *env, jclass cls);
 451 
 452 JNIEXPORT jobjectArray JNICALL
 453 JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
 454 
 455 JNIEXPORT jclass JNICALL
 456 JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
 457 
 458 JNIEXPORT jstring JNICALL
 459 JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass);
 460 
 461 /* Generics support (JDK 1.5) */
 462 JNIEXPORT jstring JNICALL
 463 JVM_GetClassSignature(JNIEnv *env, jclass cls);
 464 
 465 /* Annotations support (JDK 1.5) */
 466 JNIEXPORT jbyteArray JNICALL
 467 JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
 468 
 469 /* Type use annotations support (JDK 1.8) */
 470 
 471 JNIEXPORT jbyteArray JNICALL
 472 JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
 473 
 474 JNIEXPORT jbyteArray JNICALL
 475 JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
 476 
 477 JNIEXPORT jbyteArray JNICALL
 478 JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
 479 
 480 /*
 481  * New (JDK 1.4) reflection implementation
 482  */
 483 
 484 JNIEXPORT jobjectArray JNICALL
 485 JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 486 
 487 JNIEXPORT jobjectArray JNICALL
 488 JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 489 
 490 JNIEXPORT jobjectArray JNICALL
 491 JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 492 
 493 /* Differs from JVM_GetClassModifiers in treatment of inner classes.
 494    This returns the access flags for the class as specified in the
 495    class file rather than searching the InnerClasses attribute (if
 496    present) to find the source-level access flags. Only the values of
 497    the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
 498    valid. */
 499 JNIEXPORT jint JNICALL
 500 JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
 501 
 502 /* The following two reflection routines are still needed due to startup time issues */
 503 /*
 504  * java.lang.reflect.Method
 505  */
 506 JNIEXPORT jobject JNICALL
 507 JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
 508 
 509 /*
 510  * java.lang.reflect.Constructor
 511  */
 512 JNIEXPORT jobject JNICALL
 513 JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
 514 
 515 /*
 516  * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
 517  */
 518 
 519 JNIEXPORT jobject JNICALL
 520 JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
 521 
 522 JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
 523 (JNIEnv *env, jobject unused, jobject jcpool);
 524 
 525 JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
 526 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 527 
 528 JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
 529 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 530 
 531 JNIEXPORT jint JNICALL JVM_ConstantPoolGetClassRefIndexAt
 532 (JNIEnv *env, jobject obj, jobject unused, jint index);
 533 
 534 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
 535 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 536 
 537 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
 538 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 539 
 540 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
 541 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 542 
 543 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
 544 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 545 
 546 JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
 547 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 548 
 549 JNIEXPORT jint JNICALL JVM_ConstantPoolGetNameAndTypeRefIndexAt
 550 (JNIEnv *env, jobject obj, jobject unused, jint index);
 551 
 552 JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt
 553 (JNIEnv *env, jobject obj, jobject unused, jint index);
 554 
 555 JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
 556 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 557 
 558 JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
 559 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 560 
 561 JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
 562 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 563 
 564 JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
 565 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 566 
 567 JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
 568 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 569 
 570 JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
 571 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 572 
 573 JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt
 574 (JNIEnv *env, jobject unused, jobject jcpool, jint index);
 575 
 576 /*
 577  * Parameter reflection
 578  */
 579 
 580 JNIEXPORT jobjectArray JNICALL
 581 JVM_GetMethodParameters(JNIEnv *env, jobject method);
 582 
 583 /*
 584  * java.security.*
 585  */
 586 
 587 JNIEXPORT jobject JNICALL
 588 JVM_DoPrivileged(JNIEnv *env, jclass cls,
 589                  jobject action, jobject context, jboolean wrapException);
 590 
 591 JNIEXPORT jobject JNICALL
 592 JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
 593 
 594 JNIEXPORT jobject JNICALL
 595 JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
 596 
 597 /*
 598  * Signal support, used to implement the shutdown sequence.  Every VM must
 599  * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
 600  * (^C) and the latter for external termination (kill, system shutdown, etc.).
 601  * Other platform-dependent signal values may also be supported.
 602  */
 603 
 604 JNIEXPORT void * JNICALL
 605 JVM_RegisterSignal(jint sig, void *handler);
 606 
 607 JNIEXPORT jboolean JNICALL
 608 JVM_RaiseSignal(jint sig);
 609 
 610 JNIEXPORT jint JNICALL
 611 JVM_FindSignal(const char *name);
 612 
 613 /*
 614  * Retrieve the assertion directives for the specified class.
 615  */
 616 JNIEXPORT jboolean JNICALL
 617 JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
 618 
 619 /*
 620  * Retrieve the assertion directives from the VM.
 621  */
 622 JNIEXPORT jobject JNICALL
 623 JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
 624 
 625 /*
 626  * java.util.concurrent.atomic.AtomicLong
 627  */
 628 JNIEXPORT jboolean JNICALL
 629 JVM_SupportsCX8(void);
 630 
 631 /*
 632  * com.sun.dtrace.jsdt support
 633  */
 634 
 635 #define JVM_TRACING_DTRACE_VERSION 1
 636 
 637 /*
 638  * Structure to pass one probe description to JVM
 639  */
 640 typedef struct {
 641     jmethodID method;
 642     jstring   function;
 643     jstring   name;
 644     void*            reserved[4];     // for future use
 645 } JVM_DTraceProbe;
 646 
 647 /**
 648  * Encapsulates the stability ratings for a DTrace provider field
 649  */
 650 typedef struct {
 651     jint nameStability;
 652     jint dataStability;
 653     jint dependencyClass;
 654 } JVM_DTraceInterfaceAttributes;
 655 
 656 /*
 657  * Structure to pass one provider description to JVM
 658  */
 659 typedef struct {
 660     jstring                       name;
 661     JVM_DTraceProbe*              probes;
 662     jint                          probe_count;
 663     JVM_DTraceInterfaceAttributes providerAttributes;
 664     JVM_DTraceInterfaceAttributes moduleAttributes;
 665     JVM_DTraceInterfaceAttributes functionAttributes;
 666     JVM_DTraceInterfaceAttributes nameAttributes;
 667     JVM_DTraceInterfaceAttributes argsAttributes;
 668     void*                         reserved[4]; // for future use
 669 } JVM_DTraceProvider;
 670 
 671 /*
 672  * Get the version number the JVM was built with
 673  */
 674 JNIEXPORT jint JNICALL
 675 JVM_DTraceGetVersion(JNIEnv* env);
 676 
 677 /*
 678  * Register new probe with given signature, return global handle
 679  *
 680  * The version passed in is the version that the library code was
 681  * built with.
 682  */
 683 JNIEXPORT jlong JNICALL
 684 JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
 685   jint providers_count, JVM_DTraceProvider* providers);
 686 
 687 /*
 688  * Check JSDT probe
 689  */
 690 JNIEXPORT jboolean JNICALL
 691 JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);
 692 
 693 /*
 694  * Destroy custom DOF
 695  */
 696 JNIEXPORT void JNICALL
 697 JVM_DTraceDispose(JNIEnv* env, jlong activation_handle);
 698 
 699 /*
 700  * Check to see if DTrace is supported by OS
 701  */
 702 JNIEXPORT jboolean JNICALL
 703 JVM_DTraceIsSupported(JNIEnv* env);
 704 
 705 /*************************************************************************
 706  PART 2: Support for the Verifier and Class File Format Checker
 707  ************************************************************************/
 708 /*
 709  * Return the class name in UTF format. The result is valid
 710  * until JVM_ReleaseUTf is called.
 711  *
 712  * The caller must treat the string as a constant and not modify it
 713  * in any way.
 714  */
 715 JNIEXPORT const char * JNICALL
 716 JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
 717 
 718 /*
 719  * Returns the constant pool types in the buffer provided by "types."
 720  */
 721 JNIEXPORT void JNICALL
 722 JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
 723 
 724 /*
 725  * Returns the number of Constant Pool entries.
 726  */
 727 JNIEXPORT jint JNICALL
 728 JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
 729 
 730 /*
 731  * Returns the number of *declared* fields or methods.
 732  */
 733 JNIEXPORT jint JNICALL
 734 JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
 735 
 736 JNIEXPORT jint JNICALL
 737 JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
 738 
 739 /*
 740  * Returns the CP indexes of exceptions raised by a given method.
 741  * Places the result in the given buffer.
 742  *
 743  * The method is identified by method_index.
 744  */
 745 JNIEXPORT void JNICALL
 746 JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
 747                                 unsigned short *exceptions);
 748 /*
 749  * Returns the number of exceptions raised by a given method.
 750  * The method is identified by method_index.
 751  */
 752 JNIEXPORT jint JNICALL
 753 JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
 754 
 755 /*
 756  * Returns the byte code sequence of a given method.
 757  * Places the result in the given buffer.
 758  *
 759  * The method is identified by method_index.
 760  */
 761 JNIEXPORT void JNICALL
 762 JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
 763                         unsigned char *code);
 764 
 765 /*
 766  * Returns the length of the byte code sequence of a given method.
 767  * The method is identified by method_index.
 768  */
 769 JNIEXPORT jint JNICALL
 770 JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
 771 
 772 /*
 773  * A structure used to a capture exception table entry in a Java method.
 774  */
 775 typedef struct {
 776     jint start_pc;
 777     jint end_pc;
 778     jint handler_pc;
 779     jint catchType;
 780 } JVM_ExceptionTableEntryType;
 781 
 782 /*
 783  * Returns the exception table entry at entry_index of a given method.
 784  * Places the result in the given buffer.
 785  *
 786  * The method is identified by method_index.
 787  */
 788 JNIEXPORT void JNICALL
 789 JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
 790                                    jint entry_index,
 791                                    JVM_ExceptionTableEntryType *entry);
 792 
 793 /*
 794  * Returns the length of the exception table of a given method.
 795  * The method is identified by method_index.
 796  */
 797 JNIEXPORT jint JNICALL
 798 JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
 799 
 800 /*
 801  * Returns the modifiers of a given field.
 802  * The field is identified by field_index.
 803  */
 804 JNIEXPORT jint JNICALL
 805 JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
 806 
 807 /*
 808  * Returns the modifiers of a given method.
 809  * The method is identified by method_index.
 810  */
 811 JNIEXPORT jint JNICALL
 812 JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
 813 
 814 /*
 815  * Returns the number of local variables of a given method.
 816  * The method is identified by method_index.
 817  */
 818 JNIEXPORT jint JNICALL
 819 JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
 820 
 821 /*
 822  * Returns the number of arguments (including this pointer) of a given method.
 823  * The method is identified by method_index.
 824  */
 825 JNIEXPORT jint JNICALL
 826 JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
 827 
 828 /*
 829  * Returns the maximum amount of stack (in words) used by a given method.
 830  * The method is identified by method_index.
 831  */
 832 JNIEXPORT jint JNICALL
 833 JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
 834 
 835 /*
 836  * Is a given method a constructor.
 837  * The method is identified by method_index.
 838  */
 839 JNIEXPORT jboolean JNICALL
 840 JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
 841 
 842 /*
 843  * Is the given method generated by the VM.
 844  * The method is identified by method_index.
 845  */
 846 JNIEXPORT jboolean JNICALL
 847 JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
 848 
 849 /*
 850  * Returns the name of a given method in UTF format.
 851  * The result remains valid until JVM_ReleaseUTF is called.
 852  *
 853  * The caller must treat the string as a constant and not modify it
 854  * in any way.
 855  */
 856 JNIEXPORT const char * JNICALL
 857 JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
 858 
 859 /*
 860  * Returns the signature of a given method in UTF format.
 861  * The result remains valid until JVM_ReleaseUTF is called.
 862  *
 863  * The caller must treat the string as a constant and not modify it
 864  * in any way.
 865  */
 866 JNIEXPORT const char * JNICALL
 867 JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
 868 
 869 /*
 870  * Returns the name of the field referred to at a given constant pool
 871  * index.
 872  *
 873  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 874  * is called.
 875  *
 876  * The caller must treat the string as a constant and not modify it
 877  * in any way.
 878  */
 879 JNIEXPORT const char * JNICALL
 880 JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
 881 
 882 /*
 883  * Returns the name of the method referred to at a given constant pool
 884  * index.
 885  *
 886  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 887  * is called.
 888  *
 889  * The caller must treat the string as a constant and not modify it
 890  * in any way.
 891  */
 892 JNIEXPORT const char * JNICALL
 893 JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
 894 
 895 /*
 896  * Returns the signature of the method referred to at a given constant pool
 897  * index.
 898  *
 899  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 900  * is called.
 901  *
 902  * The caller must treat the string as a constant and not modify it
 903  * in any way.
 904  */
 905 JNIEXPORT const char * JNICALL
 906 JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
 907 
 908 /*
 909  * Returns the signature of the field referred to at a given constant pool
 910  * index.
 911  *
 912  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 913  * is called.
 914  *
 915  * The caller must treat the string as a constant and not modify it
 916  * in any way.
 917  */
 918 JNIEXPORT const char * JNICALL
 919 JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
 920 
 921 /*
 922  * Returns the class name referred to at a given constant pool index.
 923  *
 924  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 925  * is called.
 926  *
 927  * The caller must treat the string as a constant and not modify it
 928  * in any way.
 929  */
 930 JNIEXPORT const char * JNICALL
 931 JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
 932 
 933 /*
 934  * Returns the class name referred to at a given constant pool index.
 935  *
 936  * The constant pool entry must refer to a CONSTANT_Fieldref.
 937  *
 938  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 939  * is called.
 940  *
 941  * The caller must treat the string as a constant and not modify it
 942  * in any way.
 943  */
 944 JNIEXPORT const char * JNICALL
 945 JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
 946 
 947 /*
 948  * Returns the class name referred to at a given constant pool index.
 949  *
 950  * The constant pool entry must refer to CONSTANT_Methodref or
 951  * CONSTANT_InterfaceMethodref.
 952  *
 953  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 954  * is called.
 955  *
 956  * The caller must treat the string as a constant and not modify it
 957  * in any way.
 958  */
 959 JNIEXPORT const char * JNICALL
 960 JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
 961 
 962 /*
 963  * Returns the modifiers of a field in calledClass. The field is
 964  * referred to in class cb at constant pool entry index.
 965  *
 966  * The caller must treat the string as a constant and not modify it
 967  * in any way.
 968  *
 969  * Returns -1 if the field does not exist in calledClass.
 970  */
 971 JNIEXPORT jint JNICALL
 972 JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
 973 
 974 /*
 975  * Returns the modifiers of a method in calledClass. The method is
 976  * referred to in class cb at constant pool entry index.
 977  *
 978  * Returns -1 if the method does not exist in calledClass.
 979  */
 980 JNIEXPORT jint JNICALL
 981 JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
 982 
 983 /*
 984  * Releases the UTF string obtained from the VM.
 985  */
 986 JNIEXPORT void JNICALL
 987 JVM_ReleaseUTF(const char *utf);
 988 
 989 /*
 990  * Compare if two classes are in the same package.
 991  */
 992 JNIEXPORT jboolean JNICALL
 993 JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
 994 
 995 /* Get classfile constants */
 996 #include "classfile_constants.h"
 997 
 998 /*
 999  * A function defined by the byte-code verifier and called by the VM.
1000  * This is not a function implemented in the VM.
1001  *
1002  * Returns JNI_FALSE if verification fails. A detailed error message
1003  * will be places in msg_buf, whose length is specified by buf_len.
1004  */
1005 typedef jboolean (*verifier_fn_t)(JNIEnv *env,
1006                                   jclass cb,
1007                                   char * msg_buf,
1008                                   jint buf_len);
1009 
1010 
1011 /*
1012  * Support for a VM-independent class format checker.
1013  */
1014 typedef struct {
1015     unsigned long code;    /* byte code */
1016     unsigned long excs;    /* exceptions */
1017     unsigned long etab;    /* catch table */
1018     unsigned long lnum;    /* line number */
1019     unsigned long lvar;    /* local vars */
1020 } method_size_info;
1021 
1022 typedef struct {
1023     unsigned int constants;    /* constant pool */
1024     unsigned int fields;
1025     unsigned int methods;
1026     unsigned int interfaces;
1027     unsigned int fields2;      /* number of static 2-word fields */
1028     unsigned int innerclasses; /* # of records in InnerClasses attr */
1029 
1030     method_size_info clinit;   /* memory used in clinit */
1031     method_size_info main;     /* used everywhere else */
1032 } class_size_info;
1033 
1034 /*
1035  * Functions defined in libjava.so to perform string conversions.
1036  *
1037  */
1038 
1039 typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
1040 
1041 typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
1042 
1043 /* This is the function defined in libjava.so that performs class
1044  * format checks. This functions fills in size information about
1045  * the class file and returns:
1046  *
1047  *   0: good
1048  *  -1: out of memory
1049  *  -2: bad format
1050  *  -3: unsupported version
1051  *  -4: bad class name
1052  */
1053 
1054 typedef jint (*check_format_fn_t)(char *class_name,
1055                                   unsigned char *data,
1056                                   unsigned int data_size,
1057                                   class_size_info *class_size,
1058                                   char *message_buffer,
1059                                   jint buffer_length,
1060                                   jboolean measure_only,
1061                                   jboolean check_relaxed);
1062 
1063 #define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
1064                                         JVM_ACC_FINAL | \
1065                                         JVM_ACC_SUPER | \
1066                                         JVM_ACC_INTERFACE | \
1067                                         JVM_ACC_ABSTRACT | \
1068                                         JVM_ACC_ANNOTATION | \
1069                                         JVM_ACC_ENUM | \
1070                                         JVM_ACC_SYNTHETIC)
1071 
1072 #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
1073                                         JVM_ACC_PRIVATE | \
1074                                         JVM_ACC_PROTECTED | \
1075                                         JVM_ACC_STATIC | \
1076                                         JVM_ACC_FINAL | \
1077                                         JVM_ACC_VOLATILE | \
1078                                         JVM_ACC_TRANSIENT | \
1079                                         JVM_ACC_ENUM | \
1080                                         JVM_ACC_SYNTHETIC)
1081 
1082 #define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
1083                                          JVM_ACC_PRIVATE | \
1084                                          JVM_ACC_PROTECTED | \
1085                                          JVM_ACC_STATIC | \
1086                                          JVM_ACC_FINAL | \
1087                                          JVM_ACC_SYNCHRONIZED | \
1088                                          JVM_ACC_BRIDGE | \
1089                                          JVM_ACC_VARARGS | \
1090                                          JVM_ACC_NATIVE | \
1091                                          JVM_ACC_ABSTRACT | \
1092                                          JVM_ACC_STRICT | \
1093                                          JVM_ACC_SYNTHETIC)
1094 
1095 /*
1096  * This is the function defined in libjava.so to perform path
1097  * canonicalization. VM call this function before opening jar files
1098  * to load system classes.
1099  *
1100  */
1101 
1102 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
1103 
1104 /*************************************************************************
1105  PART 3: I/O and Network Support
1106  ************************************************************************/
1107 
1108 /*
1109  * Convert a pathname into native format.  This function does syntactic
1110  * cleanup, such as removing redundant separator characters.  It modifies
1111  * the given pathname string in place.
1112  */
1113 JNIEXPORT char * JNICALL
1114 JVM_NativePath(char *);
1115 
1116 /*
1117  * The standard printing functions supported by the Java VM. (Should they
1118  * be renamed to JVM_* in the future?
1119  */
1120 
1121 /*
1122  * BE CAREFUL! The following functions do not implement the
1123  * full feature set of standard C printf formats.
1124  */
1125 int
1126 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
1127 
1128 int
1129 jio_snprintf(char *str, size_t count, const char *fmt, ...);
1130 
1131 int
1132 jio_fprintf(FILE *, const char *fmt, ...);
1133 
1134 int
1135 jio_vfprintf(FILE *, const char *fmt, va_list args);
1136 
1137 
1138 JNIEXPORT void * JNICALL
1139 JVM_RawMonitorCreate(void);
1140 
1141 JNIEXPORT void JNICALL
1142 JVM_RawMonitorDestroy(void *mon);
1143 
1144 JNIEXPORT jint JNICALL
1145 JVM_RawMonitorEnter(void *mon);
1146 
1147 JNIEXPORT void JNICALL
1148 JVM_RawMonitorExit(void *mon);
1149 
1150 /*
1151  * java.lang.management support
1152  */
1153 JNIEXPORT void* JNICALL
1154 JVM_GetManagement(jint version);
1155 
1156 /*
1157  * com.sun.tools.attach.VirtualMachine support
1158  *
1159  * Initialize the agent properties with the properties maintained in the VM.
1160  */
1161 JNIEXPORT jobject JNICALL
1162 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
1163 
1164 JNIEXPORT jstring JNICALL
1165 JVM_GetTemporaryDirectory(JNIEnv *env);
1166 
1167 /* Generics reflection support.
1168  *
1169  * Returns information about the given class's EnclosingMethod
1170  * attribute, if present, or null if the class had no enclosing
1171  * method.
1172  *
1173  * If non-null, the returned array contains three elements. Element 0
1174  * is the java.lang.Class of which the enclosing method is a member,
1175  * and elements 1 and 2 are the java.lang.Strings for the enclosing
1176  * method's name and descriptor, respectively.
1177  */
1178 JNIEXPORT jobjectArray JNICALL
1179 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
1180 
1181 /* =========================================================================
1182  * The following defines a private JVM interface that the JDK can query
1183  * for the JVM version and capabilities.  sun.misc.Version defines
1184  * the methods for getting the VM version and its capabilities.
1185  *
1186  * When a new bit is added, the following should be updated to provide
1187  * access to the new capability:
1188  *    HS:   JVM_GetVersionInfo and Abstract_VM_Version class
1189  *    SDK:  Version class
1190  *
1191  * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
1192  * JVM to query for the JDK version and capabilities.
1193  *
1194  * When a new bit is added, the following should be updated to provide
1195  * access to the new capability:
1196  *    HS:   JDK_Version class
1197  *    SDK:  JDK_GetVersionInfo0
1198  *
1199  * ==========================================================================
1200  */
1201 typedef struct {
1202     unsigned int jvm_version;  /* Encoded $VNUM as specified by JEP-223 */
1203     unsigned int patch_version : 8; /* JEP-223 patch version */
1204     unsigned int reserved3 : 8;
1205     unsigned int reserved1 : 16;
1206     unsigned int reserved2;
1207 
1208     /* The following bits represents JVM supports that JDK has dependency on.
1209      * JDK can use these bits to determine which JVM version
1210      * and support it has to maintain runtime compatibility.
1211      *
1212      * When a new bit is added in a minor or update release, make sure
1213      * the new bit is also added in the main/baseline.
1214      */
1215     unsigned int is_attach_supported : 1;
1216     unsigned int : 31;
1217     unsigned int : 32;
1218     unsigned int : 32;
1219 } jvm_version_info;
1220 
1221 #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1222 #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1223 #define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
1224 #define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
1225 
1226 JNIEXPORT void JNICALL
1227 JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
1228 
1229 typedef struct {
1230     unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */
1231     unsigned int patch_version : 8; /* JEP-223 patch version */
1232     unsigned int reserved3 : 8;
1233     unsigned int reserved1 : 16;
1234     unsigned int reserved2;
1235 
1236     /* The following bits represents new JDK supports that VM has dependency on.
1237      * VM implementation can use these bits to determine which JDK version
1238      * and support it has to maintain runtime compatibility.
1239      *
1240      * When a new bit is added in a minor or update release, make sure
1241      * the new bit is also added in the main/baseline.
1242      */
1243     unsigned int thread_park_blocker : 1;
1244     unsigned int post_vm_init_hook_enabled : 1;
1245     unsigned int pending_list_uses_discovered_field : 1;
1246     unsigned int : 29;
1247     unsigned int : 32;
1248     unsigned int : 32;
1249 } jdk_version_info;
1250 
1251 #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1252 #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1253 #define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
1254 #define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
1255 
1256 /*
1257  * This is the function JDK_GetVersionInfo0 defined in libjava.so
1258  * that is dynamically looked up by JVM.
1259  */
1260 typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
1261 
1262 /*
1263  * This structure is used by the launcher to get the default thread
1264  * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
1265  * version of 1.1.  As it is not supported otherwise, it has been removed
1266  * from jni.h
1267  */
1268 typedef struct JDK1_1InitArgs {
1269     jint version;
1270 
1271     char **properties;
1272     jint checkSource;
1273     jint nativeStackSize;
1274     jint javaStackSize;
1275     jint minHeapSize;
1276     jint maxHeapSize;
1277     jint verifyMode;
1278     char *classpath;
1279 
1280     jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
1281     void (JNICALL *exit)(jint code);
1282     void (JNICALL *abort)(void);
1283 
1284     jint enableClassGC;
1285     jint enableVerboseGC;
1286     jint disableAsyncGC;
1287     jint verbose;
1288     jboolean debugging;
1289     jint debugPort;
1290 } JDK1_1InitArgs;
1291 
1292 
1293 #ifdef __cplusplus
1294 } /* extern "C" */
1295 
1296 #endif /* __cplusplus */
1297 
1298 #endif /* !_JAVASOFT_JVM_H_ */