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