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