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