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 /* Define a class with a source with conditional verification (added HSX 14)
 382  * -Xverify:all will verify anyway, -Xverify:none will not verify,
 383  * -Xverify:remote (default) will obey this conditional
 384  * i.e. true = should_verify_class
 385  */
 386 JNIEXPORT jclass JNICALL
 387 JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
 388                               jobject loader, const jbyte *buf,
 389                               jsize len, jobject pd, const char *source,
 390                               jboolean verify);
 391 
 392 /*
 393  * Reflection support functions
 394  */
 395 
 396 JNIEXPORT jstring JNICALL
 397 JVM_GetClassName(JNIEnv *env, jclass cls);
 398 
 399 JNIEXPORT jobjectArray JNICALL
 400 JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
 401 
 402 JNIEXPORT jboolean JNICALL
 403 JVM_IsInterface(JNIEnv *env, jclass cls);
 404 
 405 JNIEXPORT jobjectArray JNICALL
 406 JVM_GetClassSigners(JNIEnv *env, jclass cls);
 407 
 408 JNIEXPORT void JNICALL
 409 JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
 410 
 411 JNIEXPORT jobject JNICALL
 412 JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
 413 
 414 JNIEXPORT jboolean JNICALL
 415 JVM_IsArrayClass(JNIEnv *env, jclass cls);
 416 
 417 JNIEXPORT jboolean JNICALL
 418 JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
 419 
 420 JNIEXPORT jint JNICALL
 421 JVM_GetClassModifiers(JNIEnv *env, jclass cls);
 422 
 423 JNIEXPORT jobjectArray JNICALL
 424 JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
 425 
 426 JNIEXPORT jclass JNICALL
 427 JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
 428 
 429 JNIEXPORT jstring JNICALL
 430 JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass);
 431 
 432 /* Generics support (JDK 1.5) */
 433 JNIEXPORT jstring JNICALL
 434 JVM_GetClassSignature(JNIEnv *env, jclass cls);
 435 
 436 /* Annotations support (JDK 1.5) */
 437 JNIEXPORT jbyteArray JNICALL
 438 JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
 439 
 440 /* Annotations support (JDK 1.6) */
 441 
 442 /* Type use annotations support (JDK 1.8) */
 443 
 444 JNIEXPORT jbyteArray JNICALL
 445 JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
 446 
 447 // field is a handle to a java.lang.reflect.Field object
 448 JNIEXPORT jbyteArray JNICALL
 449 JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
 450 
 451 // method is a handle to a java.lang.reflect.Method object
 452 JNIEXPORT jbyteArray JNICALL
 453 JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
 454 
 455 /*
 456  * New (JDK 1.4) reflection implementation
 457  */
 458 
 459 JNIEXPORT jobjectArray JNICALL
 460 JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 461 
 462 JNIEXPORT jobjectArray JNICALL
 463 JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 464 
 465 JNIEXPORT jobjectArray JNICALL
 466 JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 467 
 468 /* Differs from JVM_GetClassModifiers in treatment of inner classes.
 469    This returns the access flags for the class as specified in the
 470    class file rather than searching the InnerClasses attribute (if
 471    present) to find the source-level access flags. Only the values of
 472    the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
 473    valid. */
 474 JNIEXPORT jint JNICALL
 475 JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
 476 
 477 /*
 478  * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
 479  */
 480 
 481 JNIEXPORT jobject JNICALL
 482 JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
 483 
 484 JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
 485 (JNIEnv *env, jobject obj, jobject unused);
 486 
 487 JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
 488 (JNIEnv *env, jobject obj, jobject unused, jint index);
 489 
 490 JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
 491 (JNIEnv *env, jobject obj, jobject unused, jint index);
 492 
 493 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
 494 (JNIEnv *env, jobject obj, jobject unused, jint index);
 495 
 496 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
 497 (JNIEnv *env, jobject obj, jobject unused, jint index);
 498 
 499 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
 500 (JNIEnv *env, jobject obj, jobject unused, jint index);
 501 
 502 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
 503 (JNIEnv *env, jobject obj, jobject unused, jint index);
 504 
 505 JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
 506 (JNIEnv *env, jobject obj, jobject unused, jint index);
 507 
 508 JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
 509 (JNIEnv *env, jobject obj, jobject unused, jint index);
 510 
 511 JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
 512 (JNIEnv *env, jobject obj, jobject unused, jint index);
 513 
 514 JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
 515 (JNIEnv *env, jobject obj, jobject unused, jint index);
 516 
 517 JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
 518 (JNIEnv *env, jobject obj, jobject unused, jint index);
 519 
 520 JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
 521 (JNIEnv *env, jobject obj, jobject unused, jint index);
 522 
 523 JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
 524 (JNIEnv *env, jobject obj, jobject unused, jint index);
 525 
 526 /*
 527  * java.security.*
 528  */
 529 
 530 JNIEXPORT jobject JNICALL
 531 JVM_DoPrivileged(JNIEnv *env, jclass cls,
 532                  jobject action, jobject context, jboolean wrapException);
 533 
 534 JNIEXPORT jobject JNICALL
 535 JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
 536 
 537 JNIEXPORT jobject JNICALL
 538 JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
 539 
 540 /*
 541  * Signal support, used to implement the shutdown sequence.  Every VM must
 542  * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
 543  * (^C) and the latter for external termination (kill, system shutdown, etc.).
 544  * Other platform-dependent signal values may also be supported.
 545  */
 546 
 547 JNIEXPORT void * JNICALL
 548 JVM_RegisterSignal(jint sig, void *handler);
 549 
 550 JNIEXPORT jboolean JNICALL
 551 JVM_RaiseSignal(jint sig);
 552 
 553 JNIEXPORT jint JNICALL
 554 JVM_FindSignal(const char *name);
 555 
 556 /*
 557  * Retrieve the assertion directives for the specified class.
 558  */
 559 JNIEXPORT jboolean JNICALL
 560 JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
 561 
 562 /*
 563  * Retrieve the assertion directives from the VM.
 564  */
 565 JNIEXPORT jobject JNICALL
 566 JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
 567 
 568 /*
 569  * java.util.concurrent.atomic.AtomicLong
 570  */
 571 JNIEXPORT jboolean JNICALL
 572 JVM_SupportsCX8(void);
 573 
 574 /*************************************************************************
 575  PART 2: Support for the Verifier and Class File Format Checker
 576  ************************************************************************/
 577 /*
 578  * Return the class name in UTF format. The result is valid
 579  * until JVM_ReleaseUTf is called.
 580  *
 581  * The caller must treat the string as a constant and not modify it
 582  * in any way.
 583  */
 584 JNIEXPORT const char * JNICALL
 585 JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
 586 
 587 /*
 588  * Returns the constant pool types in the buffer provided by "types."
 589  */
 590 JNIEXPORT void JNICALL
 591 JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
 592 
 593 /*
 594  * Returns the number of Constant Pool entries.
 595  */
 596 JNIEXPORT jint JNICALL
 597 JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
 598 
 599 /*
 600  * Returns the number of *declared* fields or methods.
 601  */
 602 JNIEXPORT jint JNICALL
 603 JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
 604 
 605 JNIEXPORT jint JNICALL
 606 JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
 607 
 608 /*
 609  * Returns the CP indexes of exceptions raised by a given method.
 610  * Places the result in the given buffer.
 611  *
 612  * The method is identified by method_index.
 613  */
 614 JNIEXPORT void JNICALL
 615 JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
 616                                 unsigned short *exceptions);
 617 /*
 618  * Returns the number of exceptions raised by a given method.
 619  * The method is identified by method_index.
 620  */
 621 JNIEXPORT jint JNICALL
 622 JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
 623 
 624 /*
 625  * Returns the byte code sequence of a given method.
 626  * Places the result in the given buffer.
 627  *
 628  * The method is identified by method_index.
 629  */
 630 JNIEXPORT void JNICALL
 631 JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
 632                         unsigned char *code);
 633 
 634 /*
 635  * Returns the length of the byte code sequence of a given method.
 636  * The method is identified by method_index.
 637  */
 638 JNIEXPORT jint JNICALL
 639 JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
 640 
 641 /*
 642  * A structure used to a capture exception table entry in a Java method.
 643  */
 644 typedef struct {
 645     jint start_pc;
 646     jint end_pc;
 647     jint handler_pc;
 648     jint catchType;
 649 } JVM_ExceptionTableEntryType;
 650 
 651 /*
 652  * Returns the exception table entry at entry_index of a given method.
 653  * Places the result in the given buffer.
 654  *
 655  * The method is identified by method_index.
 656  */
 657 JNIEXPORT void JNICALL
 658 JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
 659                                    jint entry_index,
 660                                    JVM_ExceptionTableEntryType *entry);
 661 
 662 /*
 663  * Returns the length of the exception table of a given method.
 664  * The method is identified by method_index.
 665  */
 666 JNIEXPORT jint JNICALL
 667 JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
 668 
 669 /*
 670  * Returns the modifiers of a given field.
 671  * The field is identified by field_index.
 672  */
 673 JNIEXPORT jint JNICALL
 674 JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
 675 
 676 /*
 677  * Returns the modifiers of a given method.
 678  * The method is identified by method_index.
 679  */
 680 JNIEXPORT jint JNICALL
 681 JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
 682 
 683 /*
 684  * Returns the number of local variables of a given method.
 685  * The method is identified by method_index.
 686  */
 687 JNIEXPORT jint JNICALL
 688 JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
 689 
 690 /*
 691  * Returns the number of arguments (including this pointer) of a given method.
 692  * The method is identified by method_index.
 693  */
 694 JNIEXPORT jint JNICALL
 695 JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
 696 
 697 /*
 698  * Returns the maximum amount of stack (in words) used by a given method.
 699  * The method is identified by method_index.
 700  */
 701 JNIEXPORT jint JNICALL
 702 JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
 703 
 704 /*
 705  * Is a given method a constructor.
 706  * The method is identified by method_index.
 707  */
 708 JNIEXPORT jboolean JNICALL
 709 JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
 710 
 711 /*
 712  * Is the given method generated by the VM.
 713  * The method is identified by method_index.
 714  */
 715 JNIEXPORT jboolean JNICALL
 716 JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
 717 
 718 /*
 719  * Returns the name of a given method in UTF format.
 720  * The result remains valid until JVM_ReleaseUTF is called.
 721  *
 722  * The caller must treat the string as a constant and not modify it
 723  * in any way.
 724  */
 725 JNIEXPORT const char * JNICALL
 726 JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
 727 
 728 /*
 729  * Returns the signature of a given method in UTF format.
 730  * The result remains valid until JVM_ReleaseUTF is called.
 731  *
 732  * The caller must treat the string as a constant and not modify it
 733  * in any way.
 734  */
 735 JNIEXPORT const char * JNICALL
 736 JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
 737 
 738 /*
 739  * Returns the name of the field refered to at a given constant pool
 740  * index.
 741  *
 742  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 743  * is called.
 744  *
 745  * The caller must treat the string as a constant and not modify it
 746  * in any way.
 747  */
 748 JNIEXPORT const char * JNICALL
 749 JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
 750 
 751 /*
 752  * Returns the name of the method refered to at a given constant pool
 753  * index.
 754  *
 755  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 756  * is called.
 757  *
 758  * The caller must treat the string as a constant and not modify it
 759  * in any way.
 760  */
 761 JNIEXPORT const char * JNICALL
 762 JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
 763 
 764 /*
 765  * Returns the signature of the method refered to at a given constant pool
 766  * index.
 767  *
 768  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 769  * is called.
 770  *
 771  * The caller must treat the string as a constant and not modify it
 772  * in any way.
 773  */
 774 JNIEXPORT const char * JNICALL
 775 JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
 776 
 777 /*
 778  * Returns the signature of the field refered to at a given constant pool
 779  * index.
 780  *
 781  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 782  * is called.
 783  *
 784  * The caller must treat the string as a constant and not modify it
 785  * in any way.
 786  */
 787 JNIEXPORT const char * JNICALL
 788 JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
 789 
 790 /*
 791  * Returns the class name refered to at a given constant pool index.
 792  *
 793  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 794  * is called.
 795  *
 796  * The caller must treat the string as a constant and not modify it
 797  * in any way.
 798  */
 799 JNIEXPORT const char * JNICALL
 800 JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
 801 
 802 /*
 803  * Returns the class name refered to at a given constant pool index.
 804  *
 805  * The constant pool entry must refer to a CONSTANT_Fieldref.
 806  *
 807  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 808  * is called.
 809  *
 810  * The caller must treat the string as a constant and not modify it
 811  * in any way.
 812  */
 813 JNIEXPORT const char * JNICALL
 814 JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
 815 
 816 /*
 817  * Returns the class name refered to at a given constant pool index.
 818  *
 819  * The constant pool entry must refer to CONSTANT_Methodref or
 820  * CONSTANT_InterfaceMethodref.
 821  *
 822  * The result is in UTF format and remains valid until JVM_ReleaseUTF
 823  * is called.
 824  *
 825  * The caller must treat the string as a constant and not modify it
 826  * in any way.
 827  */
 828 JNIEXPORT const char * JNICALL
 829 JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
 830 
 831 /*
 832  * Returns the modifiers of a field in calledClass. The field is
 833  * referred to in class cb at constant pool entry index.
 834  *
 835  * The caller must treat the string as a constant and not modify it
 836  * in any way.
 837  *
 838  * Returns -1 if the field does not exist in calledClass.
 839  */
 840 JNIEXPORT jint JNICALL
 841 JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
 842 
 843 /*
 844  * Returns the modifiers of a method in calledClass. The method is
 845  * referred to in class cb at constant pool entry index.
 846  *
 847  * Returns -1 if the method does not exist in calledClass.
 848  */
 849 JNIEXPORT jint JNICALL
 850 JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
 851 
 852 /*
 853  * Releases the UTF string obtained from the VM.
 854  */
 855 JNIEXPORT void JNICALL
 856 JVM_ReleaseUTF(const char *utf);
 857 
 858 /*
 859  * Compare if two classes are in the same package.
 860  */
 861 JNIEXPORT jboolean JNICALL
 862 JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
 863 
 864 /* Constants in class files */
 865 
 866 #define JVM_ACC_PUBLIC        0x0001  /* visible to everyone */
 867 #define JVM_ACC_PRIVATE       0x0002  /* visible only to the defining class */
 868 #define JVM_ACC_PROTECTED     0x0004  /* visible to subclasses */
 869 #define JVM_ACC_STATIC        0x0008  /* instance variable is static */
 870 #define JVM_ACC_FINAL         0x0010  /* no further subclassing, overriding */
 871 #define JVM_ACC_SYNCHRONIZED  0x0020  /* wrap method call in monitor lock */
 872 #define JVM_ACC_SUPER         0x0020  /* funky handling of invokespecial */
 873 #define JVM_ACC_VOLATILE      0x0040  /* can not cache in registers */
 874 #define JVM_ACC_BRIDGE        0x0040  /* bridge method generated by compiler */
 875 #define JVM_ACC_TRANSIENT     0x0080  /* not persistent */
 876 #define JVM_ACC_VARARGS       0x0080  /* method declared with variable number of args */
 877 #define JVM_ACC_NATIVE        0x0100  /* implemented in C */
 878 #define JVM_ACC_INTERFACE     0x0200  /* class is an interface */
 879 #define JVM_ACC_ABSTRACT      0x0400  /* no definition provided */
 880 #define JVM_ACC_STRICT        0x0800  /* strict floating point */
 881 #define JVM_ACC_SYNTHETIC     0x1000  /* compiler-generated class, method or field */
 882 #define JVM_ACC_ANNOTATION    0x2000  /* annotation type */
 883 #define JVM_ACC_ENUM          0x4000  /* field is declared as element of enum */
 884 
 885 #define JVM_ACC_PUBLIC_BIT        0
 886 #define JVM_ACC_PRIVATE_BIT       1
 887 #define JVM_ACC_PROTECTED_BIT     2
 888 #define JVM_ACC_STATIC_BIT        3
 889 #define JVM_ACC_FINAL_BIT         4
 890 #define JVM_ACC_SYNCHRONIZED_BIT  5
 891 #define JVM_ACC_SUPER_BIT         5
 892 #define JVM_ACC_VOLATILE_BIT      6
 893 #define JVM_ACC_BRIDGE_BIT        6
 894 #define JVM_ACC_TRANSIENT_BIT     7
 895 #define JVM_ACC_VARARGS_BIT       7
 896 #define JVM_ACC_NATIVE_BIT        8
 897 #define JVM_ACC_INTERFACE_BIT     9
 898 #define JVM_ACC_ABSTRACT_BIT      10
 899 #define JVM_ACC_STRICT_BIT        11
 900 #define JVM_ACC_SYNTHETIC_BIT     12
 901 #define JVM_ACC_ANNOTATION_BIT    13
 902 #define JVM_ACC_ENUM_BIT          14
 903 
 904 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java
 905 enum {
 906     JVM_CONSTANT_Utf8 = 1,
 907     JVM_CONSTANT_Unicode,               /* unused */
 908     JVM_CONSTANT_Integer,
 909     JVM_CONSTANT_Float,
 910     JVM_CONSTANT_Long,
 911     JVM_CONSTANT_Double,
 912     JVM_CONSTANT_Class,
 913     JVM_CONSTANT_String,
 914     JVM_CONSTANT_Fieldref,
 915     JVM_CONSTANT_Methodref,
 916     JVM_CONSTANT_InterfaceMethodref,
 917     JVM_CONSTANT_NameAndType,
 918     JVM_CONSTANT_MethodHandle           = 15,  // JSR 292
 919     JVM_CONSTANT_MethodType             = 16,  // JSR 292
 920     //JVM_CONSTANT_(unused)             = 17,  // JSR 292 early drafts only
 921     JVM_CONSTANT_InvokeDynamic          = 18,  // JSR 292
 922     JVM_CONSTANT_ExternalMax            = 18   // Last tag found in classfiles
 923 };
 924 
 925 /* JVM_CONSTANT_MethodHandle subtypes */
 926 enum {
 927     JVM_REF_getField                = 1,
 928     JVM_REF_getStatic               = 2,
 929     JVM_REF_putField                = 3,
 930     JVM_REF_putStatic               = 4,
 931     JVM_REF_invokeVirtual           = 5,
 932     JVM_REF_invokeStatic            = 6,
 933     JVM_REF_invokeSpecial           = 7,
 934     JVM_REF_newInvokeSpecial        = 8,
 935     JVM_REF_invokeInterface         = 9
 936 };
 937 
 938 /* Used in the newarray instruction. */
 939 
 940 #define JVM_T_BOOLEAN 4
 941 #define JVM_T_CHAR    5
 942 #define JVM_T_FLOAT   6
 943 #define JVM_T_DOUBLE  7
 944 #define JVM_T_BYTE    8
 945 #define JVM_T_SHORT   9
 946 #define JVM_T_INT    10
 947 #define JVM_T_LONG   11
 948 
 949 /* JVM method signatures */
 950 
 951 #define JVM_SIGNATURE_ARRAY             '['
 952 #define JVM_SIGNATURE_BYTE              'B'
 953 #define JVM_SIGNATURE_CHAR              'C'
 954 #define JVM_SIGNATURE_CLASS             'L'
 955 #define JVM_SIGNATURE_ENDCLASS          ';'
 956 #define JVM_SIGNATURE_ENUM              'E'
 957 #define JVM_SIGNATURE_FLOAT             'F'
 958 #define JVM_SIGNATURE_DOUBLE            'D'
 959 #define JVM_SIGNATURE_FUNC              '('
 960 #define JVM_SIGNATURE_ENDFUNC           ')'
 961 #define JVM_SIGNATURE_INT               'I'
 962 #define JVM_SIGNATURE_LONG              'J'
 963 #define JVM_SIGNATURE_SHORT             'S'
 964 #define JVM_SIGNATURE_VOID              'V'
 965 #define JVM_SIGNATURE_BOOLEAN           'Z'
 966 
 967 /*
 968  * A function defined by the byte-code verifier and called by the VM.
 969  * This is not a function implemented in the VM.
 970  *
 971  * Returns JNI_FALSE if verification fails. A detailed error message
 972  * will be places in msg_buf, whose length is specified by buf_len.
 973  */
 974 typedef jboolean (*verifier_fn_t)(JNIEnv *env,
 975                                   jclass cb,
 976                                   char * msg_buf,
 977                                   jint buf_len);
 978 
 979 
 980 /*
 981  * Support for a VM-independent class format checker.
 982  */
 983 typedef struct {
 984     unsigned long code;    /* byte code */
 985     unsigned long excs;    /* exceptions */
 986     unsigned long etab;    /* catch table */
 987     unsigned long lnum;    /* line number */
 988     unsigned long lvar;    /* local vars */
 989 } method_size_info;
 990 
 991 typedef struct {
 992     unsigned int constants;    /* constant pool */
 993     unsigned int fields;
 994     unsigned int methods;
 995     unsigned int interfaces;
 996     unsigned int fields2;      /* number of static 2-word fields */
 997     unsigned int innerclasses; /* # of records in InnerClasses attr */
 998 
 999     method_size_info clinit;   /* memory used in clinit */
1000     method_size_info main;     /* used everywhere else */
1001 } class_size_info;
1002 
1003 /*
1004  * Functions defined in libjava.so to perform string conversions.
1005  *
1006  */
1007 
1008 typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
1009 
1010 typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
1011 
1012 /* This is the function defined in libjava.so that performs class
1013  * format checks. This functions fills in size information about
1014  * the class file and returns:
1015  *
1016  *   0: good
1017  *  -1: out of memory
1018  *  -2: bad format
1019  *  -3: unsupported version
1020  *  -4: bad class name
1021  */
1022 
1023 typedef jint (*check_format_fn_t)(char *class_name,
1024                                   unsigned char *data,
1025                                   unsigned int data_size,
1026                                   class_size_info *class_size,
1027                                   char *message_buffer,
1028                                   jint buffer_length,
1029                                   jboolean measure_only,
1030                                   jboolean check_relaxed);
1031 
1032 #define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
1033                                         JVM_ACC_FINAL | \
1034                                         JVM_ACC_SUPER | \
1035                                         JVM_ACC_INTERFACE | \
1036                                         JVM_ACC_ABSTRACT | \
1037                                         JVM_ACC_ANNOTATION | \
1038                                         JVM_ACC_ENUM | \
1039                                         JVM_ACC_SYNTHETIC)
1040 
1041 #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
1042                                         JVM_ACC_PRIVATE | \
1043                                         JVM_ACC_PROTECTED | \
1044                                         JVM_ACC_STATIC | \
1045                                         JVM_ACC_FINAL | \
1046                                         JVM_ACC_VOLATILE | \
1047                                         JVM_ACC_TRANSIENT | \
1048                                         JVM_ACC_ENUM | \
1049                                         JVM_ACC_SYNTHETIC)
1050 
1051 #define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
1052                                          JVM_ACC_PRIVATE | \
1053                                          JVM_ACC_PROTECTED | \
1054                                          JVM_ACC_STATIC | \
1055                                          JVM_ACC_FINAL | \
1056                                          JVM_ACC_SYNCHRONIZED | \
1057                                          JVM_ACC_BRIDGE | \
1058                                          JVM_ACC_VARARGS | \
1059                                          JVM_ACC_NATIVE | \
1060                                          JVM_ACC_ABSTRACT | \
1061                                          JVM_ACC_STRICT | \
1062                                          JVM_ACC_SYNTHETIC)
1063 
1064 /*
1065  * This is the function defined in libjava.so to perform path
1066  * canonicalization. VM call this function before opening jar files
1067  * to load system classes.
1068  *
1069  */
1070 
1071 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
1072 
1073 /*************************************************************************
1074  PART 3: I/O and Network Support
1075  ************************************************************************/
1076 
1077 /*
1078  * Convert a pathname into native format.  This function does syntactic
1079  * cleanup, such as removing redundant separator characters.  It modifies
1080  * the given pathname string in place.
1081  */
1082 JNIEXPORT char * JNICALL
1083 JVM_NativePath(char *);
1084 
1085 /*
1086  * The standard printing functions supported by the Java VM. (Should they
1087  * be renamed to JVM_* in the future?
1088  */
1089 
1090 /* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3),
1091  *  respectively, with the following differences:
1092  * - The string written to str is always zero-terminated, also in case of
1093  *   truncation (count is too small to hold the result string), unless count
1094  *   is 0. In case of truncation count-1 characters are written and '\0'
1095  *   appendend.
1096  * - If count is too small to hold the whole string, -1 is returned across
1097  *   all platforms. */
1098 JNIEXPORT int
1099 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
1100 
1101 JNIEXPORT int
1102 jio_snprintf(char *str, size_t count, const char *fmt, ...);
1103 
1104 JNIEXPORT int
1105 jio_fprintf(FILE *, const char *fmt, ...);
1106 
1107 JNIEXPORT int
1108 jio_vfprintf(FILE *, const char *fmt, va_list args);
1109 
1110 
1111 JNIEXPORT void * JNICALL
1112 JVM_RawMonitorCreate(void);
1113 
1114 JNIEXPORT void JNICALL
1115 JVM_RawMonitorDestroy(void *mon);
1116 
1117 JNIEXPORT jint JNICALL
1118 JVM_RawMonitorEnter(void *mon);
1119 
1120 JNIEXPORT void JNICALL
1121 JVM_RawMonitorExit(void *mon);
1122 
1123 /*
1124  * java.lang.reflect.Method
1125  */
1126 JNIEXPORT jobject JNICALL
1127 JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
1128 
1129 /*
1130  * java.lang.reflect.Constructor
1131  */
1132 JNIEXPORT jobject JNICALL
1133 JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
1134 
1135 /*
1136  * java.lang.management support
1137  */
1138 JNIEXPORT void* JNICALL
1139 JVM_GetManagement(jint version);
1140 
1141 /*
1142  * com.sun.tools.attach.VirtualMachine support
1143  *
1144  * Initialize the agent properties with the properties maintained in the VM.
1145  */
1146 JNIEXPORT jobject JNICALL
1147 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
1148 
1149 JNIEXPORT jstring JNICALL
1150 JVM_GetTemporaryDirectory(JNIEnv *env);
1151 
1152 /* Generics reflection support.
1153  *
1154  * Returns information about the given class's EnclosingMethod
1155  * attribute, if present, or null if the class had no enclosing
1156  * method.
1157  *
1158  * If non-null, the returned array contains three elements. Element 0
1159  * is the java.lang.Class of which the enclosing method is a member,
1160  * and elements 1 and 2 are the java.lang.Strings for the enclosing
1161  * method's name and descriptor, respectively.
1162  */
1163 JNIEXPORT jobjectArray JNICALL
1164 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
1165 
1166 /* =========================================================================
1167  * The following defines a private JVM interface that the JDK can query
1168  * for the JVM version and capabilities.  sun.misc.Version defines
1169  * the methods for getting the VM version and its capabilities.
1170  *
1171  * When a new bit is added, the following should be updated to provide
1172  * access to the new capability:
1173  *    HS:   JVM_GetVersionInfo and Abstract_VM_Version class
1174  *    SDK:  Version class
1175  *
1176  * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
1177  * JVM to query for the JDK version and capabilities.
1178  *
1179  * When a new bit is added, the following should be updated to provide
1180  * access to the new capability:
1181  *    HS:   JDK_Version class
1182  *    SDK:  JDK_GetVersionInfo0
1183  *
1184  * ==========================================================================
1185  */
1186 typedef struct {
1187     /* VM version string: follows the JDK release version naming convention    */
1188     unsigned int jvm_version;
1189     unsigned int update_version : 8;
1190     unsigned int special_update_version : 8;
1191     unsigned int reserved1 : 16;
1192     unsigned int reserved2;
1193 
1194     /* The following bits represents JVM supports that JDK has dependency on.
1195      * JDK can use these bits to determine which JVM version
1196      * and support it has to maintain runtime compatibility.
1197      *
1198      * When a new bit is added in a minor or update release, make sure
1199      * the new bit is also added in the main/baseline.
1200      */
1201     unsigned int is_attachable : 1;
1202     unsigned int : 31;
1203     unsigned int : 32;
1204     unsigned int : 32;
1205 } jvm_version_info;
1206 
1207 #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1208 #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1209 #define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
1210 #define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
1211 
1212 JNIEXPORT void JNICALL
1213 JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
1214 
1215 typedef struct {
1216     // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
1217     unsigned int jdk_version;   /* Consists of major, minor, security (n.n.n) */
1218                                 /* and build number (xx) */
1219     unsigned int update_version : 8;         /* Update release version (uu) */
1220     unsigned int special_update_version : 8; /* Special update release version (c)*/
1221     unsigned int reserved1 : 16;
1222     unsigned int reserved2;
1223 
1224     /* The following bits represents new JDK supports that VM has dependency on.
1225      * VM implementation can use these bits to determine which JDK version
1226      * and support it has to maintain runtime compatibility.
1227      *
1228      * When a new bit is added in a minor or update release, make sure
1229      * the new bit is also added in the main/baseline.
1230      */
1231     unsigned int thread_park_blocker : 1;
1232     unsigned int post_vm_init_hook_enabled : 1;
1233     unsigned int pending_list_uses_discovered_field : 1;
1234     unsigned int : 29;
1235     unsigned int : 32;
1236     unsigned int : 32;
1237 } jdk_version_info;
1238 
1239 #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1240 #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1241 #define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
1242 
1243 /* Build number is available only for RE build.
1244  * It will be zero for internal builds.
1245  */
1246 #define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
1247 
1248 /*
1249  * This is the function JDK_GetVersionInfo0 defined in libjava.so
1250  * that is dynamically looked up by JVM.
1251  */
1252 typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
1253 
1254 /*
1255  * This structure is used by the launcher to get the default thread
1256  * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
1257  * version of 1.1.  As it is not supported otherwise, it has been removed
1258  * from jni.h
1259  */
1260 typedef struct JDK1_1InitArgs {
1261     jint version;
1262 
1263     char **properties;
1264     jint checkSource;
1265     jint nativeStackSize;
1266     jint javaStackSize;
1267     jint minHeapSize;
1268     jint maxHeapSize;
1269     jint verifyMode;
1270     char *classpath;
1271 
1272     jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
1273     void (JNICALL *exit)(jint code);
1274     void (JNICALL *abort)(void);
1275 
1276     jint enableClassGC;
1277     jint enableVerboseGC;
1278     jint disableAsyncGC;
1279     jint verbose;
1280     jboolean debugging;
1281     jint debugPort;
1282 } JDK1_1InitArgs;
1283 
1284 #ifdef __cplusplus
1285 } /* extern "C" */
1286 #endif /* __cplusplus */
1287 
1288 #endif /* !_JAVASOFT_JVM_H_ */
1289 
1290 #endif // SHARE_VM_PRIMS_JVM_H
--- EOF ---