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