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