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