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