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