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