1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifndef _JAVASOFT_JVM_H_
  27 #define _JAVASOFT_JVM_H_
  28 
  29 #include <sys/stat.h>
  30 
  31 #include "jni.h"
  32 #include "jvm_md.h"
  33 
  34 #ifdef __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 /*
  39  * This file contains additional functions exported from the VM.
  40  * These functions are complementary to the standard JNI support.
  41  * There are three parts to this file:
  42  *
  43  * First, this file contains the VM-related functions needed by native
  44  * libraries in the standard Java API. For example, the java.lang.Object
  45  * class needs VM-level functions that wait for and notify monitors.
  46  *
  47  * Second, this file contains the functions and constant definitions
  48  * needed by the byte code verifier and class file format checker.
  49  * These functions allow the verifier and format checker to be written
  50  * in a VM-independent way.
  51  *
  52  * Third, this file contains various I/O and network operations needed
  53  * by the standard Java I/O and network APIs.
  54  */
  55 
  56 /*
  57  * Bump the version number when either of the following happens:
  58  *
  59  * 1. There is a change in JVM_* functions.
  60  *
  61  * 2. There is a change in the contract between VM and Java classes.
  62  *    For example, if the VM relies on a new private field in Thread
  63  *    class.
  64  */
  65 
  66 #define JVM_INTERFACE_VERSION 5
  67 
  68 JNIEXPORT jint JNICALL
  69 JVM_GetInterfaceVersion(void);
  70 
  71 /*************************************************************************
  72  PART 1: Functions for Native Libraries
  73  ************************************************************************/
  74 /*
  75  * java.lang.Object
  76  */
  77 JNIEXPORT jint JNICALL
  78 JVM_IHashCode(JNIEnv *env, jobject obj);
  79 
  80 JNIEXPORT void JNICALL
  81 JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);
  82 
  83 JNIEXPORT void JNICALL
  84 JVM_MonitorNotify(JNIEnv *env, jobject obj);
  85 
  86 JNIEXPORT void JNICALL
  87 JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);
  88 
  89 JNIEXPORT jobject JNICALL
  90 JVM_Clone(JNIEnv *env, jobject obj);
  91 
  92 /*
  93  * java.lang.String
  94  */
  95 JNIEXPORT jstring JNICALL
  96 JVM_InternString(JNIEnv *env, jstring str);
  97 
  98 /*
  99  * java.lang.System
 100  */
 101 JNIEXPORT jlong JNICALL
 102 JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
 103 
 104 JNIEXPORT jlong JNICALL
 105 JVM_NanoTime(JNIEnv *env, jclass ignored);
 106 
 107 JNIEXPORT jlong JNICALL
 108 JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);
 109 
 110 JNIEXPORT void JNICALL
 111 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
 112               jobject dst, jint dst_pos, jint length);
 113 
 114 JNIEXPORT jobject JNICALL
 115 JVM_InitProperties(JNIEnv *env, jobject p);
 116 
 117 
 118 /*
 119  * java.lang.Runtime
 120  */
 121 JNIEXPORT void JNICALL
 122 JVM_Halt(jint code);
 123 
 124 JNIEXPORT void JNICALL
 125 JVM_GC(void);
 126 
 127 /* Returns the number of real-time milliseconds that have elapsed since the
 128  * least-recently-inspected heap object was last inspected by the garbage
 129  * collector.
 130  *
 131  * For simple stop-the-world collectors this value is just the time
 132  * since the most recent collection.  For generational collectors it is the
 133  * time since the oldest generation was most recently collected.  Other
 134  * collectors are free to return a pessimistic estimate of the elapsed time, or
 135  * simply the time since the last full collection was performed.
 136  *
 137  * Note that in the presence of reference objects, a given object that is no
 138  * longer strongly reachable may have to be inspected multiple times before it
 139  * can be reclaimed.
 140  */
 141 JNIEXPORT jlong JNICALL
 142 JVM_MaxObjectInspectionAge(void);
 143 
 144 JNIEXPORT jlong JNICALL
 145 JVM_TotalMemory(void);
 146 
 147 JNIEXPORT jlong JNICALL
 148 JVM_FreeMemory(void);
 149 
 150 JNIEXPORT jlong JNICALL
 151 JVM_MaxMemory(void);
 152 
 153 JNIEXPORT jint JNICALL
 154 JVM_ActiveProcessorCount(void);
 155 
 156 JNIEXPORT void * JNICALL
 157 JVM_LoadLibrary(const char *name);
 158 
 159 JNIEXPORT void JNICALL
 160 JVM_UnloadLibrary(void * handle);
 161 
 162 JNIEXPORT void * JNICALL
 163 JVM_FindLibraryEntry(void *handle, const char *name);
 164 
 165 JNIEXPORT jboolean JNICALL
 166 JVM_IsSupportedJNIVersion(jint version);
 167 
 168 /*
 169  * java.lang.Throwable
 170  */
 171 JNIEXPORT void JNICALL
 172 JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
 173 
 174 JNIEXPORT void JNICALL
 175 JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray elements);
 176 
 177 /*
 178  * java.lang.StackWalker
 179  */
 180 enum {
 181   JVM_STACKWALK_FILL_CLASS_REFS_ONLY       = 0x2,

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