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