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