jvm.h revision 5976:2b8e28fdf503
1234848Smav/* 2234848Smav * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3234848Smav * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4234848Smav * 5234848Smav * This code is free software; you can redistribute it and/or modify it 6234848Smav * under the terms of the GNU General Public License version 2 only, as 7234848Smav * published by the Free Software Foundation. 8234848Smav * 9234848Smav * This code is distributed in the hope that it will be useful, but WITHOUT 10234848Smav * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11234848Smav * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12234848Smav * version 2 for more details (a copy is included in the LICENSE file that 13234848Smav * accompanied this code). 14234848Smav * 15234848Smav * You should have received a copy of the GNU General Public License version 16234848Smav * 2 along with this work; if not, write to the Free Software Foundation, 17234848Smav * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18234848Smav * 19234848Smav * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20234848Smav * or visit www.oracle.com if you need additional information or have any 21234848Smav * questions. 22234848Smav * 23234848Smav */ 24234848Smav 25234848Smav#ifndef SHARE_VM_PRIMS_JVM_H 26234848Smav#define SHARE_VM_PRIMS_JVM_H 27234848Smav 28234848Smav#include "prims/jni.h" 29234848Smav#ifdef TARGET_OS_FAMILY_linux 30234848Smav# include "jvm_linux.h" 31234848Smav#endif 32234848Smav#ifdef TARGET_OS_FAMILY_solaris 33234848Smav# include "jvm_solaris.h" 34234848Smav#endif 35234848Smav#ifdef TARGET_OS_FAMILY_windows 36234848Smav# include "jvm_windows.h" 37234848Smav#endif 38234848Smav#ifdef TARGET_OS_FAMILY_aix 39234848Smav# include "jvm_aix.h" 40234848Smav#endif 41234848Smav#ifdef TARGET_OS_FAMILY_bsd 42234848Smav# include "jvm_bsd.h" 43234848Smav#endif 44234848Smav 45234848Smav#ifndef _JAVASOFT_JVM_H_ 46234848Smav#define _JAVASOFT_JVM_H_ 47234848Smav 48234848Smav// HotSpot integration note: 49234848Smav// 50234848Smav// This file and jvm.h used with the JDK are identical, 51234848Smav// except for the three includes removed below 52234848Smav 53234848Smav// #include <sys/stat.h> 54234848Smav// #include "jni.h" 55234848Smav// #include "jvm_md.h" 56234848Smav 57234848Smav 58234848Smav#ifdef __cplusplus 59234848Smavextern "C" { 60234848Smav#endif 61234848Smav 62234848Smav/* 63234848Smav * This file contains additional functions exported from the VM. 64234848Smav * These functions are complementary to the standard JNI support. 65234848Smav * There are three parts to this file: 66234848Smav * 67234848Smav * First, this file contains the VM-related functions needed by native 68234848Smav * libraries in the standard Java API. For example, the java.lang.Object 69234848Smav * class needs VM-level functions that wait for and notify monitors. 70234848Smav * 71234848Smav * Second, this file contains the functions and constant definitions 72234848Smav * needed by the byte code verifier and class file format checker. 73234848Smav * These functions allow the verifier and format checker to be written 74234848Smav * in a VM-independent way. 75234848Smav * 76234848Smav * Third, this file contains various I/O and nerwork operations needed 77234848Smav * by the standard Java I/O and network APIs. 78234848Smav */ 79234848Smav 80234848Smav/* 81234848Smav * Bump the version number when either of the following happens: 82234848Smav * 83234848Smav * 1. There is a change in JVM_* functions. 84234848Smav * 85234848Smav * 2. There is a change in the contract between VM and Java classes. 86234848Smav * For example, if the VM relies on a new private field in Thread 87234848Smav * class. 88234848Smav */ 89234848Smav 90234848Smav#define JVM_INTERFACE_VERSION 4 91234940Smav 92234848SmavJNIEXPORT jobjectArray JNICALL 93234868SmavJVM_GetMethodParameters(JNIEnv *env, jobject method); 94234848Smav 95234848SmavJNIEXPORT jint JNICALL 96234848SmavJVM_GetInterfaceVersion(void); 97234848Smav 98234848Smav/************************************************************************* 99234940Smav PART 1: Functions for Native Libraries 100234848Smav ************************************************************************/ 101234848Smav/* 102234848Smav * java.lang.Object 103234848Smav */ 104234848SmavJNIEXPORT jint JNICALL 105234848SmavJVM_IHashCode(JNIEnv *env, jobject obj); 106234848Smav 107234848SmavJNIEXPORT void JNICALL 108234848SmavJVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms); 109234848Smav 110234848SmavJNIEXPORT void JNICALL 111234940SmavJVM_MonitorNotify(JNIEnv *env, jobject obj); 112234848Smav 113234848SmavJNIEXPORT void JNICALL 114234848SmavJVM_MonitorNotifyAll(JNIEnv *env, jobject obj); 115234848Smav 116234848SmavJNIEXPORT jobject JNICALL 117234848SmavJVM_Clone(JNIEnv *env, jobject obj); 118234848Smav 119234848Smav/* 120234848Smav * java.lang.String 121234848Smav */ 122234848SmavJNIEXPORT jstring JNICALL 123234848SmavJVM_InternString(JNIEnv *env, jstring str); 124234848Smav 125234848Smav/* 126234848Smav * java.lang.System 127234848Smav */ 128234848SmavJNIEXPORT jlong JNICALL 129234848SmavJVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); 130234848Smav 131234848SmavJNIEXPORT jlong JNICALL 132234848SmavJVM_NanoTime(JNIEnv *env, jclass ignored); 133234848Smav 134234848SmavJNIEXPORT void JNICALL 135234848SmavJVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, 136234848Smav jobject dst, jint dst_pos, jint length); 137234848Smav 138234848SmavJNIEXPORT jobject JNICALL 139234848SmavJVM_InitProperties(JNIEnv *env, jobject p); 140234848Smav 141234848Smav/* 142234848Smav * java.io.File 143234848Smav */ 144234848SmavJNIEXPORT void JNICALL 145234848SmavJVM_OnExit(void (*func)(void)); 146234848Smav 147234848Smav/* 148234848Smav * java.lang.Runtime 149234848Smav */ 150234848SmavJNIEXPORT void JNICALL 151234848SmavJVM_Exit(jint code); 152234848Smav 153234848SmavJNIEXPORT void JNICALL 154234848SmavJVM_Halt(jint code); 155234848Smav 156234848SmavJNIEXPORT void JNICALL 157234848SmavJVM_GC(void); 158234848Smav 159234848Smav/* Returns the number of real-time milliseconds that have elapsed since the 160234848Smav * least-recently-inspected heap object was last inspected by the garbage 161234848Smav * collector. 162234848Smav * 163234848Smav * For simple stop-the-world collectors this value is just the time 164234848Smav * since the most recent collection. For generational collectors it is the 165234848Smav * time since the oldest generation was most recently collected. Other 166234848Smav * collectors are free to return a pessimistic estimate of the elapsed time, or 167234848Smav * simply the time since the last full collection was performed. 168234848Smav * 169234848Smav * Note that in the presence of reference objects, a given object that is no 170234848Smav * longer strongly reachable may have to be inspected multiple times before it 171234848Smav * can be reclaimed. 172234848Smav */ 173234848SmavJNIEXPORT jlong JNICALL 174234848SmavJVM_MaxObjectInspectionAge(void); 175234848Smav 176234869SmavJNIEXPORT void JNICALL 177234869SmavJVM_TraceInstructions(jboolean on); 178234869Smav 179234869SmavJNIEXPORT void JNICALL 180234869SmavJVM_TraceMethodCalls(jboolean on); 181234869Smav 182234869SmavJNIEXPORT jlong JNICALL 183234899SmavJVM_TotalMemory(void); 184234899Smav 185234899SmavJNIEXPORT jlong JNICALL 186234899SmavJVM_FreeMemory(void); 187234848Smav 188234848SmavJNIEXPORT jlong JNICALL 189234848SmavJVM_MaxMemory(void); 190234848Smav 191234848SmavJNIEXPORT jint JNICALL 192234848SmavJVM_ActiveProcessorCount(void); 193234848Smav 194234848SmavJNIEXPORT void * JNICALL 195234848SmavJVM_LoadLibrary(const char *name); 196234848Smav 197234848SmavJNIEXPORT void JNICALL 198234848SmavJVM_UnloadLibrary(void * handle); 199234848Smav 200234848SmavJNIEXPORT void * JNICALL 201234848SmavJVM_FindLibraryEntry(void *handle, const char *name); 202234848Smav 203234848SmavJNIEXPORT jboolean JNICALL 204234848SmavJVM_IsSupportedJNIVersion(jint version); 205234848Smav 206234848Smav/* 207234848Smav * java.lang.Float and java.lang.Double 208234848Smav */ 209234848SmavJNIEXPORT jboolean JNICALL 210234848SmavJVM_IsNaN(jdouble d); 211234848Smav 212234848Smav/* 213234848Smav * java.lang.Throwable 214234848Smav */ 215234848SmavJNIEXPORT void JNICALL 216234848SmavJVM_FillInStackTrace(JNIEnv *env, jobject throwable); 217234848Smav 218234848SmavJNIEXPORT jint JNICALL 219234848SmavJVM_GetStackTraceDepth(JNIEnv *env, jobject throwable); 220234848Smav 221234848SmavJNIEXPORT jobject JNICALL 222234848SmavJVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index); 223234848Smav 224234848Smav/* 225234848Smav * java.lang.Compiler 226234848Smav */ 227234848SmavJNIEXPORT void JNICALL 228234848SmavJVM_InitializeCompiler (JNIEnv *env, jclass compCls); 229234848Smav 230234848SmavJNIEXPORT jboolean JNICALL 231234848SmavJVM_IsSilentCompiler(JNIEnv *env, jclass compCls); 232234848Smav 233234848SmavJNIEXPORT jboolean JNICALL 234234848SmavJVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls); 235234848Smav 236234848SmavJNIEXPORT jboolean JNICALL 237234848SmavJVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname); 238234848Smav 239234848SmavJNIEXPORT jobject JNICALL 240234848SmavJVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg); 241234848Smav 242234848SmavJNIEXPORT void JNICALL 243234848SmavJVM_EnableCompiler(JNIEnv *env, jclass compCls); 244234848Smav 245234848SmavJNIEXPORT void JNICALL 246234848SmavJVM_DisableCompiler(JNIEnv *env, jclass compCls); 247234848Smav 248234848Smav/* 249234848Smav * java.lang.Thread 250234848Smav */ 251234848SmavJNIEXPORT void JNICALL 252234848SmavJVM_StartThread(JNIEnv *env, jobject thread); 253234848Smav 254234848SmavJNIEXPORT void JNICALL 255234848SmavJVM_StopThread(JNIEnv *env, jobject thread, jobject exception); 256234848Smav 257234848SmavJNIEXPORT jboolean JNICALL 258234848SmavJVM_IsThreadAlive(JNIEnv *env, jobject thread); 259234848Smav 260234848SmavJNIEXPORT void JNICALL 261234848SmavJVM_SuspendThread(JNIEnv *env, jobject thread); 262234848Smav 263234848SmavJNIEXPORT void JNICALL 264234848SmavJVM_ResumeThread(JNIEnv *env, jobject thread); 265234848Smav 266234848SmavJNIEXPORT void JNICALL 267234848SmavJVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); 268234848Smav 269234869SmavJNIEXPORT void JNICALL 270234848SmavJVM_Yield(JNIEnv *env, jclass threadClass); 271234848Smav 272234848SmavJNIEXPORT void JNICALL 273234848SmavJVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis); 274234848Smav 275234848SmavJNIEXPORT jobject JNICALL 276234848SmavJVM_CurrentThread(JNIEnv *env, jclass threadClass); 277234848Smav 278234848SmavJNIEXPORT jint JNICALL 279234848SmavJVM_CountStackFrames(JNIEnv *env, jobject thread); 280234848Smav 281234848SmavJNIEXPORT void JNICALL 282234848SmavJVM_Interrupt(JNIEnv *env, jobject thread); 283234848Smav 284234848SmavJNIEXPORT jboolean JNICALL 285234848SmavJVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted); 286234848Smav 287234848SmavJNIEXPORT jboolean JNICALL 288234848SmavJVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj); 289234848Smav 290234848SmavJNIEXPORT void JNICALL 291234869SmavJVM_DumpAllStacks(JNIEnv *env, jclass unused); 292234848Smav 293234848SmavJNIEXPORT jobjectArray JNICALL 294234848SmavJVM_GetAllThreads(JNIEnv *env, jclass dummy); 295234848Smav 296234848SmavJNIEXPORT void JNICALL 297234848SmavJVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name); 298234848Smav 299234848Smav/* getStackTrace() and getAllStackTraces() method */ 300234848SmavJNIEXPORT jobjectArray JNICALL 301234848SmavJVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads); 302234899Smav 303234899Smav/* 304234848Smav * java.lang.SecurityManager 305234848Smav */ 306234848SmavJNIEXPORT jclass JNICALL 307234848SmavJVM_CurrentLoadedClass(JNIEnv *env); 308234848Smav 309234848SmavJNIEXPORT jobject JNICALL 310234848SmavJVM_CurrentClassLoader(JNIEnv *env); 311234848Smav 312234848SmavJNIEXPORT jobjectArray JNICALL 313234848SmavJVM_GetClassContext(JNIEnv *env); 314234869Smav 315234848SmavJNIEXPORT jint JNICALL 316234869SmavJVM_ClassDepth(JNIEnv *env, jstring name); 317234848Smav 318234848SmavJNIEXPORT jint JNICALL 319234848SmavJVM_ClassLoaderDepth(JNIEnv *env); 320234848Smav 321234848Smav/* 322234848Smav * java.lang.Package 323234848Smav */ 324234848SmavJNIEXPORT jstring JNICALL 325234848SmavJVM_GetSystemPackage(JNIEnv *env, jstring name); 326234848Smav 327234848SmavJNIEXPORT jobjectArray JNICALL 328234848SmavJVM_GetSystemPackages(JNIEnv *env); 329234848Smav 330234848Smav/* 331234848Smav * java.io.ObjectInputStream 332234848Smav */ 333234848SmavJNIEXPORT jobject JNICALL 334234848SmavJVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass, 335234848Smav jclass initClass); 336234848Smav 337234848SmavJNIEXPORT jobject JNICALL 338234848SmavJVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, 339234848Smav jint length); 340234848Smav 341234848SmavJNIEXPORT jobject JNICALL 342234848SmavJVM_LatestUserDefinedLoader(JNIEnv *env); 343234848Smav 344234848Smav/* 345234848Smav * This function has been deprecated and should not be considered 346234848Smav * part of the specified JVM interface. 347234848Smav */ 348234848SmavJNIEXPORT jclass JNICALL 349234848SmavJVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass, 350234848Smav jstring currClassName); 351234848Smav 352234848Smav/* 353234848Smav * java.lang.reflect.Array 354234848Smav */ 355234848SmavJNIEXPORT jint JNICALL 356234848SmavJVM_GetArrayLength(JNIEnv *env, jobject arr); 357234848Smav 358234848SmavJNIEXPORT jobject JNICALL 359234848SmavJVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); 360234848Smav 361234848SmavJNIEXPORT jvalue JNICALL 362234848SmavJVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); 363234848Smav 364234848SmavJNIEXPORT void JNICALL 365234848SmavJVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); 366234848Smav 367234848SmavJNIEXPORT void JNICALL 368234848SmavJVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, 369234848Smav unsigned char vCode); 370234848Smav 371234848SmavJNIEXPORT jobject JNICALL 372234848SmavJVM_NewArray(JNIEnv *env, jclass eltClass, jint length); 373234848Smav 374234848SmavJNIEXPORT jobject JNICALL 375234848SmavJVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim); 376234848Smav 377234848Smav/* 378234848Smav * java.lang.Class and java.lang.ClassLoader 379234848Smav */ 380234848Smav 381234848Smav#define JVM_CALLER_DEPTH -1 382234848Smav 383234848Smav/* 384234848Smav * Returns the class in which the code invoking the native method 385234848Smav * belongs. 386234848Smav * 387234848Smav * Note that in JDK 1.1, native methods did not create a frame. 388234848Smav * In 1.2, they do. Therefore native methods like Class.forName 389234848Smav * can no longer look at the current frame for the caller class. 390234848Smav */ 391234848SmavJNIEXPORT jclass JNICALL 392234848SmavJVM_GetCallerClass(JNIEnv *env, int n); 393234848Smav 394234848Smav/* 395234848Smav * Find primitive classes 396234848Smav * utf: class name 397234848Smav */ 398234848SmavJNIEXPORT jclass JNICALL 399234848SmavJVM_FindPrimitiveClass(JNIEnv *env, const char *utf); 400234848Smav 401234848Smav/* 402234848Smav * Link the class 403234848Smav */ 404234899SmavJNIEXPORT void JNICALL 405234848SmavJVM_ResolveClass(JNIEnv *env, jclass cls); 406234848Smav 407234848Smav/* 408234848Smav * Find a class from a given class loader. Throw ClassNotFoundException 409234848Smav * or NoClassDefFoundError depending on the value of the last 410234848Smav * argument. 411234848Smav */ 412234848SmavJNIEXPORT jclass JNICALL 413234848SmavJVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init, 414234848Smav jobject loader, jboolean throwError); 415234848Smav 416234848Smav/* 417234848Smav * Find a class from a boot class loader. Returns NULL if class not found. 418234848Smav */ 419234848SmavJNIEXPORT jclass JNICALL 420234848SmavJVM_FindClassFromBootLoader(JNIEnv *env, const char *name); 421234848Smav 422234848Smav/* 423234848Smav * Find a class from a given class. 424234848Smav */ 425234848SmavJNIEXPORT jclass JNICALL 426234848SmavJVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, 427234848Smav jclass from); 428234848Smav 429234848Smav/* Find a loaded class cached by the VM */ 430234848SmavJNIEXPORT jclass JNICALL 431234848SmavJVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name); 432234848Smav 433234848Smav/* Define a class */ 434234848SmavJNIEXPORT jclass JNICALL 435234848SmavJVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, 436234848Smav jsize len, jobject pd); 437234848Smav 438234848Smav/* Define a class with a source (added in JDK1.5) */ 439234848SmavJNIEXPORT jclass JNICALL 440234848SmavJVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, 441234848Smav const jbyte *buf, jsize len, jobject pd, 442234848Smav const char *source); 443234848Smav 444234848Smav/* Define a class with a source with conditional verification (added HSX 14) 445234848Smav * -Xverify:all will verify anyway, -Xverify:none will not verify, 446234848Smav * -Xverify:remote (default) will obey this conditional 447234848Smav * i.e. true = should_verify_class 448234848Smav */ 449234848SmavJNIEXPORT jclass JNICALL 450234848SmavJVM_DefineClassWithSourceCond(JNIEnv *env, const char *name, 451234848Smav jobject loader, const jbyte *buf, 452234848Smav jsize len, jobject pd, const char *source, 453234848Smav jboolean verify); 454234848Smav 455234848Smav/* 456234848Smav * Reflection support functions 457234848Smav */ 458234848Smav 459234848SmavJNIEXPORT jstring JNICALL 460234848SmavJVM_GetClassName(JNIEnv *env, jclass cls); 461234848Smav 462234848SmavJNIEXPORT jobjectArray JNICALL 463234848SmavJVM_GetClassInterfaces(JNIEnv *env, jclass cls); 464234848Smav 465234848SmavJNIEXPORT jobject JNICALL 466234848SmavJVM_GetClassLoader(JNIEnv *env, jclass cls); 467234848Smav 468234848SmavJNIEXPORT jboolean JNICALL 469234848SmavJVM_IsInterface(JNIEnv *env, jclass cls); 470234848Smav 471234848SmavJNIEXPORT jobjectArray JNICALL 472234848SmavJVM_GetClassSigners(JNIEnv *env, jclass cls); 473234848Smav 474234848SmavJNIEXPORT void JNICALL 475234848SmavJVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers); 476234848Smav 477234869SmavJNIEXPORT jobject JNICALL 478234848SmavJVM_GetProtectionDomain(JNIEnv *env, jclass cls); 479234869Smav 480234848SmavJNIEXPORT jboolean JNICALL 481234848SmavJVM_IsArrayClass(JNIEnv *env, jclass cls); 482234848Smav 483234848SmavJNIEXPORT jboolean JNICALL 484234848SmavJVM_IsPrimitiveClass(JNIEnv *env, jclass cls); 485234899Smav 486234899SmavJNIEXPORT jclass JNICALL 487234848SmavJVM_GetComponentType(JNIEnv *env, jclass cls); 488234848Smav 489234848SmavJNIEXPORT jint JNICALL 490234848SmavJVM_GetClassModifiers(JNIEnv *env, jclass cls); 491234848Smav 492234848SmavJNIEXPORT jobjectArray JNICALL 493234848SmavJVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass); 494234848Smav 495234848SmavJNIEXPORT jclass JNICALL 496234848SmavJVM_GetDeclaringClass(JNIEnv *env, jclass ofClass); 497234848Smav 498234848Smav/* Generics support (JDK 1.5) */ 499234869SmavJNIEXPORT jstring JNICALL 500234848SmavJVM_GetClassSignature(JNIEnv *env, jclass cls); 501234869Smav 502234848Smav/* Annotations support (JDK 1.5) */ 503234848SmavJNIEXPORT jbyteArray JNICALL 504234848SmavJVM_GetClassAnnotations(JNIEnv *env, jclass cls); 505234848Smav 506234848Smav/* Annotations support (JDK 1.6) */ 507234848Smav 508234848Smav// field is a handle to a java.lang.reflect.Field object 509234848SmavJNIEXPORT jbyteArray JNICALL 510234848SmavJVM_GetFieldAnnotations(JNIEnv *env, jobject field); 511234848Smav 512234848Smav// method is a handle to a java.lang.reflect.Method object 513234848SmavJNIEXPORT jbyteArray JNICALL 514234848SmavJVM_GetMethodAnnotations(JNIEnv *env, jobject method); 515234848Smav 516234848Smav// method is a handle to a java.lang.reflect.Method object 517234848SmavJNIEXPORT jbyteArray JNICALL 518234848SmavJVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method); 519234848Smav 520234848Smav// method is a handle to a java.lang.reflect.Method object 521234848SmavJNIEXPORT jbyteArray JNICALL 522234848SmavJVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method); 523234848Smav 524234848Smav/* Type use annotations support (JDK 1.8) */ 525234848Smav 526234848SmavJNIEXPORT jbyteArray JNICALL 527234848SmavJVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls); 528234848Smav 529234848Smav// field is a handle to a java.lang.reflect.Field object 530234848SmavJNIEXPORT jbyteArray JNICALL 531234848SmavJVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field); 532234848Smav 533234848Smav// method is a handle to a java.lang.reflect.Method object 534234848SmavJNIEXPORT jbyteArray JNICALL 535234848SmavJVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method); 536234848Smav 537234899Smav/* 538234899Smav * New (JDK 1.4) reflection implementation 539234899Smav */ 540234899Smav 541234899SmavJNIEXPORT jobjectArray JNICALL 542234899SmavJVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly); 543234899Smav 544234899SmavJNIEXPORT jobjectArray JNICALL 545234899SmavJVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly); 546234899Smav 547234899SmavJNIEXPORT jobjectArray JNICALL 548234899SmavJVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly); 549234899Smav 550234899Smav/* Differs from JVM_GetClassModifiers in treatment of inner classes. 551234899Smav This returns the access flags for the class as specified in the 552234899Smav class file rather than searching the InnerClasses attribute (if 553234899Smav present) to find the source-level access flags. Only the values of 554234899Smav the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be 555234899Smav valid. */ 556234899SmavJNIEXPORT jint JNICALL 557234899SmavJVM_GetClassAccessFlags(JNIEnv *env, jclass cls); 558234899Smav 559234899Smav/* 560234848Smav * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5) 561234848Smav */ 562234848Smav 563234848SmavJNIEXPORT jobject JNICALL 564234848SmavJVM_GetClassConstantPool(JNIEnv *env, jclass cls); 565234848Smav 566234940SmavJNIEXPORT jint JNICALL JVM_ConstantPoolGetSize 567234848Smav(JNIEnv *env, jobject obj, jobject unused); 568234848Smav 569234848SmavJNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt 570234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 571234848Smav 572234848SmavJNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded 573234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 574234848Smav 575234848SmavJNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt 576234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 577234940Smav 578234848SmavJNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded 579234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 580234848Smav 581234848SmavJNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt 582234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 583234848Smav 584234940SmavJNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded 585234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 586234848Smav 587234848SmavJNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt 588234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 589234848Smav 590234848SmavJNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt 591234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 592234848Smav 593234848SmavJNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt 594234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 595234848Smav 596234848SmavJNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt 597234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 598234848Smav 599234848SmavJNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt 600234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 601234848Smav 602234848SmavJNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt 603234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 604234848Smav 605234848SmavJNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At 606234848Smav(JNIEnv *env, jobject obj, jobject unused, jint index); 607234848Smav 608234848Smav/* 609234848Smav * java.security.* 610234848Smav */ 611234848Smav 612234848SmavJNIEXPORT jobject JNICALL 613234848SmavJVM_DoPrivileged(JNIEnv *env, jclass cls, 614234848Smav jobject action, jobject context, jboolean wrapException); 615234848Smav 616234848SmavJNIEXPORT jobject JNICALL 617234848SmavJVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls); 618234848Smav 619234848SmavJNIEXPORT jobject JNICALL 620234848SmavJVM_GetStackAccessControlContext(JNIEnv *env, jclass cls); 621234848Smav 622234848Smav/* 623234848Smav * Signal support, used to implement the shutdown sequence. Every VM must 624234848Smav * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts 625234848Smav * (^C) and the latter for external termination (kill, system shutdown, etc.). 626234848Smav * Other platform-dependent signal values may also be supported. 627234848Smav */ 628234848Smav 629234848SmavJNIEXPORT void * JNICALL 630234848SmavJVM_RegisterSignal(jint sig, void *handler); 631234848Smav 632234848SmavJNIEXPORT jboolean JNICALL 633234848SmavJVM_RaiseSignal(jint sig); 634234848Smav 635234848SmavJNIEXPORT jint JNICALL 636234848SmavJVM_FindSignal(const char *name); 637234848Smav 638234848Smav/* 639234848Smav * Retrieve the assertion directives for the specified class. 640234848Smav */ 641234848SmavJNIEXPORT jboolean JNICALL 642234848SmavJVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls); 643234848Smav 644234848Smav/* 645234848Smav * Retrieve the assertion directives from the VM. 646234848Smav */ 647234848SmavJNIEXPORT jobject JNICALL 648234848SmavJVM_AssertionStatusDirectives(JNIEnv *env, jclass unused); 649234848Smav 650234848Smav/* 651234848Smav * java.util.concurrent.atomic.AtomicLong 652234848Smav */ 653234848SmavJNIEXPORT jboolean JNICALL 654234848SmavJVM_SupportsCX8(void); 655234848Smav 656234848SmavJNIEXPORT jboolean JNICALL 657234848SmavJVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal); 658234848Smav 659234848Smav/* 660234848Smav * com.sun.dtrace.jsdt support 661234848Smav */ 662234848Smav 663234848Smav#define JVM_TRACING_DTRACE_VERSION 1 664234848Smav 665234848Smav/* 666234848Smav * Structure to pass one probe description to JVM. 667234848Smav * 668234848Smav * The VM will overwrite the definition of the referenced method with 669234848Smav * code that will fire the probe. 670234848Smav */ 671234848Smavtypedef struct { 672234848Smav jmethodID method; 673234848Smav jstring function; 674234848Smav jstring name; 675234848Smav void* reserved[4]; // for future use 676234848Smav} JVM_DTraceProbe; 677234848Smav 678234899Smav/** 679234848Smav * Encapsulates the stability ratings for a DTrace provider field 680234899Smav */ 681234848Smavtypedef struct { 682234848Smav jint nameStability; 683234848Smav jint dataStability; 684234848Smav jint dependencyClass; 685234848Smav} JVM_DTraceInterfaceAttributes; 686234848Smav 687234848Smav/* 688234848Smav * Structure to pass one provider description to JVM 689234848Smav */ 690234848Smavtypedef struct { 691234848Smav jstring name; 692234848Smav JVM_DTraceProbe* probes; 693234848Smav jint probe_count; 694234848Smav JVM_DTraceInterfaceAttributes providerAttributes; 695234848Smav JVM_DTraceInterfaceAttributes moduleAttributes; 696234848Smav JVM_DTraceInterfaceAttributes functionAttributes; 697234848Smav JVM_DTraceInterfaceAttributes nameAttributes; 698234848Smav JVM_DTraceInterfaceAttributes argsAttributes; 699234848Smav void* reserved[4]; // for future use 700234848Smav} JVM_DTraceProvider; 701234848Smav 702234848Smav/* 703234848Smav * Get the version number the JVM was built with 704234848Smav */ 705234848SmavJNIEXPORT jint JNICALL 706234848SmavJVM_DTraceGetVersion(JNIEnv* env); 707234848Smav 708234848Smav/* 709234848Smav * Register new probe with given signature, return global handle 710234848Smav * 711234848Smav * The version passed in is the version that the library code was 712234848Smav * built with. 713234848Smav */ 714234848SmavJNIEXPORT jlong JNICALL 715234848SmavJVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name, 716234848Smav jint providers_count, JVM_DTraceProvider* providers); 717234848Smav 718234848Smav/* 719234848Smav * Check JSDT probe 720234848Smav */ 721234848SmavJNIEXPORT jboolean JNICALL 722234848SmavJVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method); 723234848Smav 724234848Smav/* 725234848Smav * Destroy custom DOF 726234848Smav */ 727234848SmavJNIEXPORT void JNICALL 728234848SmavJVM_DTraceDispose(JNIEnv* env, jlong handle); 729234848Smav 730234848Smav/* 731234848Smav * Check to see if DTrace is supported by OS 732234848Smav */ 733234848SmavJNIEXPORT jboolean JNICALL 734234848SmavJVM_DTraceIsSupported(JNIEnv* env); 735234848Smav 736234848Smav/************************************************************************* 737234848Smav PART 2: Support for the Verifier and Class File Format Checker 738234848Smav ************************************************************************/ 739234848Smav/* 740234848Smav * Return the class name in UTF format. The result is valid 741234848Smav * until JVM_ReleaseUTf is called. 742234848Smav * 743234848Smav * The caller must treat the string as a constant and not modify it 744234848Smav * in any way. 745234848Smav */ 746234848SmavJNIEXPORT const char * JNICALL 747234848SmavJVM_GetClassNameUTF(JNIEnv *env, jclass cb); 748234848Smav 749234848Smav/* 750234848Smav * Returns the constant pool types in the buffer provided by "types." 751234848Smav */ 752234848SmavJNIEXPORT void JNICALL 753234848SmavJVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types); 754234848Smav 755234848Smav/* 756234848Smav * Returns the number of Constant Pool entries. 757234848Smav */ 758234848SmavJNIEXPORT jint JNICALL 759234848SmavJVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb); 760234848Smav 761234848Smav/* 762234848Smav * Returns the number of *declared* fields or methods. 763234848Smav */ 764234848SmavJNIEXPORT jint JNICALL 765234848SmavJVM_GetClassFieldsCount(JNIEnv *env, jclass cb); 766234848Smav 767234848SmavJNIEXPORT jint JNICALL 768234848SmavJVM_GetClassMethodsCount(JNIEnv *env, jclass cb); 769234848Smav 770234848Smav/* 771234848Smav * Returns the CP indexes of exceptions raised by a given method. 772234848Smav * Places the result in the given buffer. 773234848Smav * 774234848Smav * The method is identified by method_index. 775234848Smav */ 776234848SmavJNIEXPORT void JNICALL 777234848SmavJVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index, 778234848Smav unsigned short *exceptions); 779234848Smav/* 780234848Smav * Returns the number of exceptions raised by a given method. 781234848Smav * The method is identified by method_index. 782234848Smav */ 783234848SmavJNIEXPORT jint JNICALL 784234848SmavJVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index); 785234848Smav 786234848Smav/* 787234848Smav * Returns the byte code sequence of a given method. 788234848Smav * Places the result in the given buffer. 789234848Smav * 790234848Smav * The method is identified by method_index. 791234848Smav */ 792234994SmavJNIEXPORT void JNICALL 793234848SmavJVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index, 794234848Smav unsigned char *code); 795234848Smav 796234848Smav/* 797234848Smav * Returns the length of the byte code sequence of a given method. 798234848Smav * The method is identified by method_index. 799234848Smav */ 800234848SmavJNIEXPORT jint JNICALL 801234848SmavJVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index); 802234848Smav 803234848Smav/* 804234848Smav * A structure used to a capture exception table entry in a Java method. 805234848Smav */ 806234848Smavtypedef struct { 807234848Smav jint start_pc; 808234848Smav jint end_pc; 809234848Smav jint handler_pc; 810234848Smav jint catchType; 811234848Smav} JVM_ExceptionTableEntryType; 812234848Smav 813234848Smav/* 814234848Smav * Returns the exception table entry at entry_index of a given method. 815234848Smav * Places the result in the given buffer. 816234848Smav * 817234848Smav * The method is identified by method_index. 818234848Smav */ 819234848SmavJNIEXPORT void JNICALL 820234848SmavJVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index, 821234848Smav jint entry_index, 822234848Smav JVM_ExceptionTableEntryType *entry); 823234848Smav 824234848Smav/* 825234848Smav * Returns the length of the exception table of a given method. 826234848Smav * The method is identified by method_index. 827234848Smav */ 828234848SmavJNIEXPORT jint JNICALL 829234848SmavJVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index); 830234848Smav 831234848Smav/* 832234848Smav * Returns the modifiers of a given field. 833234848Smav * The field is identified by field_index. 834234848Smav */ 835234848SmavJNIEXPORT jint JNICALL 836234848SmavJVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index); 837234848Smav 838234848Smav/* 839234848Smav * Returns the modifiers of a given method. 840234848Smav * The method is identified by method_index. 841234848Smav */ 842234848SmavJNIEXPORT jint JNICALL 843234848SmavJVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index); 844234848Smav 845234848Smav/* 846234848Smav * Returns the number of local variables of a given method. 847234848Smav * The method is identified by method_index. 848234848Smav */ 849234848SmavJNIEXPORT jint JNICALL 850234848SmavJVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index); 851234848Smav 852234848Smav/* 853234848Smav * Returns the number of arguments (including this pointer) of a given method. 854234848Smav * The method is identified by method_index. 855234848Smav */ 856234848SmavJNIEXPORT jint JNICALL 857234848SmavJVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index); 858234848Smav 859234848Smav/* 860234848Smav * Returns the maximum amount of stack (in words) used by a given method. 861234848Smav * The method is identified by method_index. 862234848Smav */ 863234848SmavJNIEXPORT jint JNICALL 864234848SmavJVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index); 865234848Smav 866234848Smav/* 867234848Smav * Is a given method a constructor. 868234848Smav * The method is identified by method_index. 869234848Smav */ 870234848SmavJNIEXPORT jboolean JNICALL 871234868SmavJVM_IsConstructorIx(JNIEnv *env, jclass cb, int index); 872234868Smav 873234848Smav/* 874234848Smav * Is the given method generated by the VM. 875234848Smav * The method is identified by method_index. 876234848Smav */ 877234848SmavJNIEXPORT jboolean JNICALL 878234848SmavJVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index); 879234848Smav 880234848Smav/* 881234848Smav * Returns the name of a given method in UTF format. 882234848Smav * The result remains valid until JVM_ReleaseUTF is called. 883234848Smav * 884234848Smav * The caller must treat the string as a constant and not modify it 885234848Smav * in any way. 886234848Smav */ 887234868SmavJNIEXPORT const char * JNICALL 888234868SmavJVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index); 889234848Smav 890234848Smav/* 891234848Smav * Returns the signature of a given method in UTF format. 892234848Smav * The result remains valid until JVM_ReleaseUTF is called. 893234848Smav * 894234868Smav * The caller must treat the string as a constant and not modify it 895234868Smav * in any way. 896234848Smav */ 897234848SmavJNIEXPORT const char * JNICALL 898234848SmavJVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index); 899234848Smav 900234848Smav/* 901234848Smav * Returns the name of the field refered to at a given constant pool 902234848Smav * index. 903234848Smav * 904234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 905234848Smav * is called. 906234848Smav * 907234848Smav * The caller must treat the string as a constant and not modify it 908234848Smav * in any way. 909234848Smav */ 910234848SmavJNIEXPORT const char * JNICALL 911234848SmavJVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index); 912234848Smav 913234848Smav/* 914234848Smav * Returns the name of the method refered to at a given constant pool 915234848Smav * index. 916234848Smav * 917234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 918234848Smav * is called. 919234848Smav * 920234848Smav * The caller must treat the string as a constant and not modify it 921234848Smav * in any way. 922234848Smav */ 923234848SmavJNIEXPORT const char * JNICALL 924234848SmavJVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index); 925234848Smav 926234848Smav/* 927234848Smav * Returns the signature of the method refered to at a given constant pool 928234848Smav * index. 929234848Smav * 930234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 931234848Smav * is called. 932234848Smav * 933234848Smav * The caller must treat the string as a constant and not modify it 934234848Smav * in any way. 935234848Smav */ 936234848SmavJNIEXPORT const char * JNICALL 937234848SmavJVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index); 938234848Smav 939234848Smav/* 940234848Smav * Returns the signature of the field refered to at a given constant pool 941234848Smav * index. 942234848Smav * 943234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 944234848Smav * is called. 945234848Smav * 946234848Smav * The caller must treat the string as a constant and not modify it 947234848Smav * in any way. 948234848Smav */ 949234848SmavJNIEXPORT const char * JNICALL 950234848SmavJVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index); 951234848Smav 952234848Smav/* 953234848Smav * Returns the class name refered to at a given constant pool index. 954234848Smav * 955234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 956234848Smav * is called. 957234848Smav * 958234848Smav * The caller must treat the string as a constant and not modify it 959234848Smav * in any way. 960234848Smav */ 961234848SmavJNIEXPORT const char * JNICALL 962234848SmavJVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index); 963234848Smav 964234848Smav/* 965234848Smav * Returns the class name refered to at a given constant pool index. 966234848Smav * 967234848Smav * The constant pool entry must refer to a CONSTANT_Fieldref. 968234848Smav * 969234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 970234848Smav * is called. 971234848Smav * 972234848Smav * The caller must treat the string as a constant and not modify it 973234869Smav * in any way. 974234848Smav */ 975234869SmavJNIEXPORT const char * JNICALL 976234848SmavJVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index); 977234848Smav 978234848Smav/* 979234848Smav * Returns the class name refered to at a given constant pool index. 980234848Smav * 981234848Smav * The constant pool entry must refer to CONSTANT_Methodref or 982234848Smav * CONSTANT_InterfaceMethodref. 983234848Smav * 984234848Smav * The result is in UTF format and remains valid until JVM_ReleaseUTF 985234848Smav * is called. 986234848Smav * 987234848Smav * The caller must treat the string as a constant and not modify it 988234848Smav * in any way. 989234848Smav */ 990234848SmavJNIEXPORT const char * JNICALL 991234848SmavJVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index); 992234848Smav 993234848Smav/* 994234848Smav * Returns the modifiers of a field in calledClass. The field is 995234848Smav * referred to in class cb at constant pool entry index. 996234848Smav * 997234848Smav * The caller must treat the string as a constant and not modify it 998234848Smav * in any way. 999234848Smav * 1000234848Smav * Returns -1 if the field does not exist in calledClass. 1001234848Smav */ 1002234848SmavJNIEXPORT jint JNICALL 1003234848SmavJVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); 1004234848Smav 1005234848Smav/* 1006234848Smav * Returns the modifiers of a method in calledClass. The method is 1007234848Smav * referred to in class cb at constant pool entry index. 1008234848Smav * 1009234848Smav * Returns -1 if the method does not exist in calledClass. 1010234848Smav */ 1011234848SmavJNIEXPORT jint JNICALL 1012234848SmavJVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass); 1013234848Smav 1014234848Smav/* 1015234848Smav * Releases the UTF string obtained from the VM. 1016234848Smav */ 1017234848SmavJNIEXPORT void JNICALL 1018234848SmavJVM_ReleaseUTF(const char *utf); 1019234848Smav 1020234848Smav/* 1021234848Smav * Compare if two classes are in the same package. 1022234848Smav */ 1023234848SmavJNIEXPORT jboolean JNICALL 1024234848SmavJVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2); 1025234848Smav 1026234848Smav/* Constants in class files */ 1027234848Smav 1028234848Smav#define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */ 1029234848Smav#define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */ 1030234848Smav#define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */ 1031234848Smav#define JVM_ACC_STATIC 0x0008 /* instance variable is static */ 1032234848Smav#define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */ 1033234848Smav#define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */ 1034234848Smav#define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */ 1035234848Smav#define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */ 1036234848Smav#define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */ 1037234848Smav#define JVM_ACC_TRANSIENT 0x0080 /* not persistent */ 1038234848Smav#define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */ 1039234848Smav#define JVM_ACC_NATIVE 0x0100 /* implemented in C */ 1040234848Smav#define JVM_ACC_INTERFACE 0x0200 /* class is an interface */ 1041234848Smav#define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */ 1042234848Smav#define JVM_ACC_STRICT 0x0800 /* strict floating point */ 1043234848Smav#define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */ 1044234848Smav#define JVM_ACC_ANNOTATION 0x2000 /* annotation type */ 1045234848Smav#define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */ 1046234848Smav 1047234848Smav#define JVM_ACC_PUBLIC_BIT 0 1048234848Smav#define JVM_ACC_PRIVATE_BIT 1 1049234848Smav#define JVM_ACC_PROTECTED_BIT 2 1050234848Smav#define JVM_ACC_STATIC_BIT 3 1051234848Smav#define JVM_ACC_FINAL_BIT 4 1052234848Smav#define JVM_ACC_SYNCHRONIZED_BIT 5 1053234848Smav#define JVM_ACC_SUPER_BIT 5 1054234848Smav#define JVM_ACC_VOLATILE_BIT 6 1055234848Smav#define JVM_ACC_BRIDGE_BIT 6 1056234848Smav#define JVM_ACC_TRANSIENT_BIT 7 1057234848Smav#define JVM_ACC_VARARGS_BIT 7 1058234848Smav#define JVM_ACC_NATIVE_BIT 8 1059234848Smav#define JVM_ACC_INTERFACE_BIT 9 1060234848Smav#define JVM_ACC_ABSTRACT_BIT 10 1061234848Smav#define JVM_ACC_STRICT_BIT 11 1062234848Smav#define JVM_ACC_SYNTHETIC_BIT 12 1063234848Smav#define JVM_ACC_ANNOTATION_BIT 13 1064234848Smav#define JVM_ACC_ENUM_BIT 14 1065234848Smav 1066234848Smav// NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java 1067234848Smavenum { 1068234848Smav JVM_CONSTANT_Utf8 = 1, 1069234848Smav JVM_CONSTANT_Unicode, /* unused */ 1070234848Smav JVM_CONSTANT_Integer, 1071234848Smav JVM_CONSTANT_Float, 1072234848Smav JVM_CONSTANT_Long, 1073234848Smav JVM_CONSTANT_Double, 1074234848Smav JVM_CONSTANT_Class, 1075234848Smav JVM_CONSTANT_String, 1076234848Smav JVM_CONSTANT_Fieldref, 1077234848Smav JVM_CONSTANT_Methodref, 1078234848Smav JVM_CONSTANT_InterfaceMethodref, 1079234848Smav JVM_CONSTANT_NameAndType, 1080234848Smav JVM_CONSTANT_MethodHandle = 15, // JSR 292 1081234848Smav JVM_CONSTANT_MethodType = 16, // JSR 292 1082234848Smav //JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only 1083234848Smav JVM_CONSTANT_InvokeDynamic = 18, // JSR 292 1084234848Smav JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles 1085234848Smav}; 1086234848Smav 1087234848Smav/* JVM_CONSTANT_MethodHandle subtypes */ 1088234848Smavenum { 1089234848Smav JVM_REF_getField = 1, 1090234848Smav JVM_REF_getStatic = 2, 1091234848Smav JVM_REF_putField = 3, 1092234848Smav JVM_REF_putStatic = 4, 1093234848Smav JVM_REF_invokeVirtual = 5, 1094234848Smav JVM_REF_invokeStatic = 6, 1095234848Smav JVM_REF_invokeSpecial = 7, 1096234848Smav JVM_REF_newInvokeSpecial = 8, 1097234848Smav JVM_REF_invokeInterface = 9 1098234848Smav}; 1099234848Smav 1100234848Smav/* Used in the newarray instruction. */ 1101234848Smav 1102234848Smav#define JVM_T_BOOLEAN 4 1103234848Smav#define JVM_T_CHAR 5 1104234848Smav#define JVM_T_FLOAT 6 1105234848Smav#define JVM_T_DOUBLE 7 1106234848Smav#define JVM_T_BYTE 8 1107234848Smav#define JVM_T_SHORT 9 1108234848Smav#define JVM_T_INT 10 1109234848Smav#define JVM_T_LONG 11 1110234848Smav 1111234848Smav/* JVM method signatures */ 1112234848Smav 1113234848Smav#define JVM_SIGNATURE_ARRAY '[' 1114234848Smav#define JVM_SIGNATURE_BYTE 'B' 1115234848Smav#define JVM_SIGNATURE_CHAR 'C' 1116234848Smav#define JVM_SIGNATURE_CLASS 'L' 1117234848Smav#define JVM_SIGNATURE_ENDCLASS ';' 1118234848Smav#define JVM_SIGNATURE_ENUM 'E' 1119234848Smav#define JVM_SIGNATURE_FLOAT 'F' 1120234848Smav#define JVM_SIGNATURE_DOUBLE 'D' 1121234848Smav#define JVM_SIGNATURE_FUNC '(' 1122234848Smav#define JVM_SIGNATURE_ENDFUNC ')' 1123234848Smav#define JVM_SIGNATURE_INT 'I' 1124234848Smav#define JVM_SIGNATURE_LONG 'J' 1125234848Smav#define JVM_SIGNATURE_SHORT 'S' 1126234848Smav#define JVM_SIGNATURE_VOID 'V' 1127234848Smav#define JVM_SIGNATURE_BOOLEAN 'Z' 1128234848Smav 1129234848Smav/* 1130234848Smav * A function defined by the byte-code verifier and called by the VM. 1131234848Smav * This is not a function implemented in the VM. 1132234848Smav * 1133234848Smav * Returns JNI_FALSE if verification fails. A detailed error message 1134234848Smav * will be places in msg_buf, whose length is specified by buf_len. 1135234848Smav */ 1136234848Smavtypedef jboolean (*verifier_fn_t)(JNIEnv *env, 1137234848Smav jclass cb, 1138234848Smav char * msg_buf, 1139234848Smav jint buf_len); 1140234848Smav 1141234848Smav 1142234848Smav/* 1143234848Smav * Support for a VM-independent class format checker. 1144234848Smav */ 1145234848Smavtypedef struct { 1146234848Smav unsigned long code; /* byte code */ 1147234848Smav unsigned long excs; /* exceptions */ 1148234848Smav unsigned long etab; /* catch table */ 1149234848Smav unsigned long lnum; /* line number */ 1150234848Smav unsigned long lvar; /* local vars */ 1151234848Smav} method_size_info; 1152234848Smav 1153234848Smavtypedef struct { 1154234848Smav unsigned int constants; /* constant pool */ 1155234848Smav unsigned int fields; 1156234848Smav unsigned int methods; 1157234848Smav unsigned int interfaces; 1158234848Smav unsigned int fields2; /* number of static 2-word fields */ 1159234848Smav unsigned int innerclasses; /* # of records in InnerClasses attr */ 1160234848Smav 1161234848Smav method_size_info clinit; /* memory used in clinit */ 1162234848Smav method_size_info main; /* used everywhere else */ 1163234848Smav} class_size_info; 1164234848Smav 1165234848Smav/* 1166234848Smav * Functions defined in libjava.so to perform string conversions. 1167234848Smav * 1168234848Smav */ 1169234848Smav 1170234848Smavtypedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str); 1171234848Smav 1172234848Smavtypedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b); 1173234848Smav 1174234848Smav/* This is the function defined in libjava.so that performs class 1175234848Smav * format checks. This functions fills in size information about 1176234848Smav * the class file and returns: 1177234848Smav * 1178234848Smav * 0: good 1179234848Smav * -1: out of memory 1180234848Smav * -2: bad format 1181234848Smav * -3: unsupported version 1182234848Smav * -4: bad class name 1183234848Smav */ 1184234848Smav 1185234848Smavtypedef jint (*check_format_fn_t)(char *class_name, 1186234848Smav unsigned char *data, 1187234848Smav unsigned int data_size, 1188234848Smav class_size_info *class_size, 1189234848Smav char *message_buffer, 1190234848Smav jint buffer_length, 1191234848Smav jboolean measure_only, 1192234848Smav jboolean check_relaxed); 1193234848Smav 1194234848Smav#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \ 1195234848Smav JVM_ACC_FINAL | \ 1196234848Smav JVM_ACC_SUPER | \ 1197234848Smav JVM_ACC_INTERFACE | \ 1198234848Smav JVM_ACC_ABSTRACT | \ 1199234848Smav JVM_ACC_ANNOTATION | \ 1200234848Smav JVM_ACC_ENUM | \ 1201234848Smav JVM_ACC_SYNTHETIC) 1202234848Smav 1203234848Smav#define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \ 1204234848Smav JVM_ACC_PRIVATE | \ 1205234848Smav JVM_ACC_PROTECTED | \ 1206234848Smav JVM_ACC_STATIC | \ 1207234848Smav JVM_ACC_FINAL | \ 1208234848Smav JVM_ACC_VOLATILE | \ 1209234848Smav JVM_ACC_TRANSIENT | \ 1210234848Smav JVM_ACC_ENUM | \ 1211234848Smav JVM_ACC_SYNTHETIC) 1212234848Smav 1213234848Smav#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \ 1214234848Smav JVM_ACC_PRIVATE | \ 1215234848Smav JVM_ACC_PROTECTED | \ 1216234848Smav JVM_ACC_STATIC | \ 1217234848Smav JVM_ACC_FINAL | \ 1218234848Smav JVM_ACC_SYNCHRONIZED | \ 1219234848Smav JVM_ACC_BRIDGE | \ 1220234848Smav JVM_ACC_VARARGS | \ 1221234848Smav JVM_ACC_NATIVE | \ 1222234848Smav JVM_ACC_ABSTRACT | \ 1223234848Smav JVM_ACC_STRICT | \ 1224234848Smav JVM_ACC_SYNTHETIC) 1225234848Smav 1226234848Smav/* 1227234848Smav * This is the function defined in libjava.so to perform path 1228234848Smav * canonicalization. VM call this function before opening jar files 1229234848Smav * to load system classes. 1230234848Smav * 1231235080Smav */ 1232234848Smav 1233234848Smavtypedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); 1234234848Smav 1235234848Smav/************************************************************************* 1236234848Smav PART 3: I/O and Network Support 1237234848Smav ************************************************************************/ 1238234848Smav 1239234848Smav/* Note that the JVM IO functions are expected to return JVM_IO_ERR 1240234848Smav * when there is any kind of error. The caller can then use the 1241234848Smav * platform specific support (e.g., errno) to get the detailed 1242234848Smav * error info. The JVM_GetLastErrorString procedure may also be used 1243234848Smav * to obtain a descriptive error string. 1244234848Smav */ 1245234848Smav#define JVM_IO_ERR (-1) 1246234848Smav 1247234848Smav/* For interruptible IO. Returning JVM_IO_INTR indicates that an IO 1248234848Smav * operation has been disrupted by Thread.interrupt. There are a 1249234848Smav * number of technical difficulties related to interruptible IO that 1250234848Smav * need to be solved. For example, most existing programs do not handle 1251234848Smav * InterruptedIOExceptions specially, they simply treat those as any 1252234848Smav * IOExceptions, which typically indicate fatal errors. 1253234848Smav * 1254234848Smav * There are also two modes of operation for interruptible IO. In the 1255234848Smav * resumption mode, an interrupted IO operation is guaranteed not to 1256234848Smav * have any side-effects, and can be restarted. In the termination mode, 1257234848Smav * an interrupted IO operation corrupts the underlying IO stream, so 1258234848Smav * that the only reasonable operation on an interrupted stream is to 1259234848Smav * close that stream. The resumption mode seems to be impossible to 1260234848Smav * implement on Win32 and Solaris. Implementing the termination mode is 1261234848Smav * easier, but it's not clear that's the right semantics. 1262234848Smav * 1263234848Smav * Interruptible IO is not supported on Win32.It can be enabled/disabled 1264234848Smav * using a compile-time flag on Solaris. Third-party JVM ports do not 1265234848Smav * need to implement interruptible IO. 1266234848Smav */ 1267234848Smav#define JVM_IO_INTR (-2) 1268234848Smav 1269234848Smav/* Write a string into the given buffer, in the platform's local encoding, 1270234848Smav * that describes the most recent system-level error to occur in this thread. 1271234848Smav * Return the length of the string or zero if no error occurred. 1272234848Smav */ 1273234848SmavJNIEXPORT jint JNICALL 1274234848SmavJVM_GetLastErrorString(char *buf, int len); 1275234848Smav 1276234848Smav/* 1277234848Smav * Convert a pathname into native format. This function does syntactic 1278234848Smav * cleanup, such as removing redundant separator characters. It modifies 1279234848Smav * the given pathname string in place. 1280234848Smav */ 1281234848SmavJNIEXPORT char * JNICALL 1282234848SmavJVM_NativePath(char *); 1283234848Smav 1284234848Smav/* 1285234848Smav * JVM I/O error codes 1286234848Smav */ 1287234848Smav#define JVM_EEXIST -100 1288234848Smav 1289234848Smav/* 1290234848Smav * Open a file descriptor. This function returns a negative error code 1291234848Smav * on error, and a non-negative integer that is the file descriptor on 1292234848Smav * success. 1293234848Smav */ 1294234869SmavJNIEXPORT jint JNICALL 1295234869SmavJVM_Open(const char *fname, jint flags, jint mode); 1296234848Smav 1297234869Smav/* 1298234848Smav * Close a file descriptor. This function returns -1 on error, and 0 1299234848Smav * on success. 1300234848Smav * 1301234848Smav * fd the file descriptor to close. 1302234848Smav */ 1303234848SmavJNIEXPORT jint JNICALL 1304234848SmavJVM_Close(jint fd); 1305234848Smav 1306234848Smav/* 1307234848Smav * Read data from a file decriptor into a char array. 1308234848Smav * 1309234848Smav * fd the file descriptor to read from. 1310234848Smav * buf the buffer where to put the read data. 1311234848Smav * nbytes the number of bytes to read. 1312234848Smav * 1313234848Smav * This function returns -1 on error, and 0 on success. 1314234848Smav */ 1315234848SmavJNIEXPORT jint JNICALL 1316234848SmavJVM_Read(jint fd, char *buf, jint nbytes); 1317234848Smav 1318234848Smav/* 1319234848Smav * Write data from a char array to a file decriptor. 1320234848Smav * 1321234848Smav * fd the file descriptor to read from. 1322234848Smav * buf the buffer from which to fetch the data. 1323234848Smav * nbytes the number of bytes to write. 1324234848Smav * 1325234848Smav * This function returns -1 on error, and 0 on success. 1326234848Smav */ 1327234848SmavJNIEXPORT jint JNICALL 1328234848SmavJVM_Write(jint fd, char *buf, jint nbytes); 1329234848Smav 1330234848Smav/* 1331234848Smav * Returns the number of bytes available for reading from a given file 1332234848Smav * descriptor 1333234848Smav */ 1334234848SmavJNIEXPORT jint JNICALL 1335234848SmavJVM_Available(jint fd, jlong *pbytes); 1336234848Smav 1337234848Smav/* 1338234848Smav * Move the file descriptor pointer from whence by offset. 1339234848Smav * 1340234848Smav * fd the file descriptor to move. 1341234848Smav * offset the number of bytes to move it by. 1342234848Smav * whence the start from where to move it. 1343234848Smav * 1344234848Smav * This function returns the resulting pointer location. 1345234848Smav */ 1346234848SmavJNIEXPORT jlong JNICALL 1347234848SmavJVM_Lseek(jint fd, jlong offset, jint whence); 1348234848Smav 1349234848Smav/* 1350234848Smav * Set the length of the file associated with the given descriptor to the given 1351234848Smav * length. If the new length is longer than the current length then the file 1352234848Smav * is extended; the contents of the extended portion are not defined. The 1353234848Smav * value of the file pointer is undefined after this procedure returns. 1354234848Smav */ 1355234848SmavJNIEXPORT jint JNICALL 1356234848SmavJVM_SetLength(jint fd, jlong length); 1357234848Smav 1358234848Smav/* 1359234848Smav * Synchronize the file descriptor's in memory state with that of the 1360234848Smav * physical device. Return of -1 is an error, 0 is OK. 1361234848Smav */ 1362234848SmavJNIEXPORT jint JNICALL 1363234848SmavJVM_Sync(jint fd); 1364234848Smav 1365234848Smav/* 1366234848Smav * Networking library support 1367234848Smav */ 1368234848Smav 1369234848SmavJNIEXPORT jint JNICALL 1370234848SmavJVM_InitializeSocketLibrary(void); 1371234848Smav 1372234848Smavstruct sockaddr; 1373234848Smav 1374234848SmavJNIEXPORT jint JNICALL 1375234848SmavJVM_Socket(jint domain, jint type, jint protocol); 1376234848Smav 1377234848SmavJNIEXPORT jint JNICALL 1378234848SmavJVM_SocketClose(jint fd); 1379234848Smav 1380234848SmavJNIEXPORT jint JNICALL 1381234848SmavJVM_SocketShutdown(jint fd, jint howto); 1382234848Smav 1383234848SmavJNIEXPORT jint JNICALL 1384234848SmavJVM_Recv(jint fd, char *buf, jint nBytes, jint flags); 1385234848Smav 1386234848SmavJNIEXPORT jint JNICALL 1387234848SmavJVM_Send(jint fd, char *buf, jint nBytes, jint flags); 1388234848Smav 1389234848SmavJNIEXPORT jint JNICALL 1390234848SmavJVM_Timeout(int fd, long timeout); 1391234848Smav 1392234848SmavJNIEXPORT jint JNICALL 1393234848SmavJVM_Listen(jint fd, jint count); 1394234848Smav 1395234848SmavJNIEXPORT jint JNICALL 1396234848SmavJVM_Connect(jint fd, struct sockaddr *him, jint len); 1397234848Smav 1398234848SmavJNIEXPORT jint JNICALL 1399234848SmavJVM_Bind(jint fd, struct sockaddr *him, jint len); 1400234848Smav 1401234848SmavJNIEXPORT jint JNICALL 1402234848SmavJVM_Accept(jint fd, struct sockaddr *him, jint *len); 1403234848Smav 1404234848SmavJNIEXPORT jint JNICALL 1405234848SmavJVM_RecvFrom(jint fd, char *buf, int nBytes, 1406234848Smav int flags, struct sockaddr *from, int *fromlen); 1407234848Smav 1408234848SmavJNIEXPORT jint JNICALL 1409234848SmavJVM_SendTo(jint fd, char *buf, int len, 1410234848Smav int flags, struct sockaddr *to, int tolen); 1411234848Smav 1412234848SmavJNIEXPORT jint JNICALL 1413234848SmavJVM_SocketAvailable(jint fd, jint *result); 1414234848Smav 1415234848Smav 1416234848SmavJNIEXPORT jint JNICALL 1417234848SmavJVM_GetSockName(jint fd, struct sockaddr *him, int *len); 1418234848Smav 1419234848SmavJNIEXPORT jint JNICALL 1420234848SmavJVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen); 1421234848Smav 1422234848SmavJNIEXPORT jint JNICALL 1423234848SmavJVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen); 1424234848Smav 1425234848SmavJNIEXPORT int JNICALL 1426234848SmavJVM_GetHostName(char* name, int namelen); 1427234848Smav 1428234848Smav/* 1429234848Smav * The standard printing functions supported by the Java VM. (Should they 1430234848Smav * be renamed to JVM_* in the future? 1431234848Smav */ 1432234848Smav 1433234848Smav/* 1434234848Smav * BE CAREFUL! The following functions do not implement the 1435234848Smav * full feature set of standard C printf formats. 1436234848Smav */ 1437234848SmavJNIEXPORT int 1438234848Smavjio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); 1439234848Smav 1440234848SmavJNIEXPORT int 1441234848Smavjio_snprintf(char *str, size_t count, const char *fmt, ...); 1442234848Smav 1443234848SmavJNIEXPORT int 1444234848Smavjio_fprintf(FILE *, const char *fmt, ...); 1445234848Smav 1446234848SmavJNIEXPORT int 1447234848Smavjio_vfprintf(FILE *, const char *fmt, va_list args); 1448234848Smav 1449234848Smav 1450234848SmavJNIEXPORT void * JNICALL 1451234848SmavJVM_RawMonitorCreate(void); 1452234848Smav 1453234848SmavJNIEXPORT void JNICALL 1454234848SmavJVM_RawMonitorDestroy(void *mon); 1455234848Smav 1456234848SmavJNIEXPORT jint JNICALL 1457234848SmavJVM_RawMonitorEnter(void *mon); 1458234848Smav 1459234848SmavJNIEXPORT void JNICALL 1460234848SmavJVM_RawMonitorExit(void *mon); 1461234848Smav 1462234848Smav/* 1463234848Smav * java.lang.reflect.Method 1464234848Smav */ 1465234848SmavJNIEXPORT jobject JNICALL 1466234848SmavJVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0); 1467234848Smav 1468234848Smav/* 1469234848Smav * java.lang.reflect.Constructor 1470234848Smav */ 1471234848SmavJNIEXPORT jobject JNICALL 1472234848SmavJVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0); 1473234848Smav 1474234848Smav/* 1475234848Smav * java.lang.management support 1476234848Smav */ 1477234848SmavJNIEXPORT void* JNICALL 1478234848SmavJVM_GetManagement(jint version); 1479234848Smav 1480234848Smav/* 1481234848Smav * com.sun.tools.attach.VirtualMachine support 1482234848Smav * 1483234848Smav * Initialize the agent properties with the properties maintained in the VM. 1484234848Smav */ 1485234848SmavJNIEXPORT jobject JNICALL 1486234848SmavJVM_InitAgentProperties(JNIEnv *env, jobject agent_props); 1487234848Smav 1488234848Smav/* Generics reflection support. 1489234848Smav * 1490234848Smav * Returns information about the given class's EnclosingMethod 1491234848Smav * attribute, if present, or null if the class had no enclosing 1492234848Smav * method. 1493234848Smav * 1494234848Smav * If non-null, the returned array contains three elements. Element 0 1495234848Smav * is the java.lang.Class of which the enclosing method is a member, 1496234848Smav * and elements 1 and 2 are the java.lang.Strings for the enclosing 1497234848Smav * method's name and descriptor, respectively. 1498234848Smav */ 1499234848SmavJNIEXPORT jobjectArray JNICALL 1500234848SmavJVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); 1501234848Smav 1502234848Smav/* 1503234848Smav * Java thread state support 1504234848Smav */ 1505234848Smavenum { 1506234848Smav JAVA_THREAD_STATE_NEW = 0, 1507234848Smav JAVA_THREAD_STATE_RUNNABLE = 1, 1508234848Smav JAVA_THREAD_STATE_BLOCKED = 2, 1509234848Smav JAVA_THREAD_STATE_WAITING = 3, 1510234848Smav JAVA_THREAD_STATE_TIMED_WAITING = 4, 1511234848Smav JAVA_THREAD_STATE_TERMINATED = 5, 1512234848Smav JAVA_THREAD_STATE_COUNT = 6 1513234848Smav}; 1514234848Smav 1515234848Smav/* 1516234848Smav * Returns an array of the threadStatus values representing the 1517234848Smav * given Java thread state. Returns NULL if the VM version is 1518234848Smav * incompatible with the JDK or doesn't support the given 1519234848Smav * Java thread state. 1520235076Smav */ 1521234848SmavJNIEXPORT jintArray JNICALL 1522234848SmavJVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState); 1523234848Smav 1524234848Smav/* 1525234848Smav * Returns an array of the substate names representing the 1526234848Smav * given Java thread state. Returns NULL if the VM version is 1527234869Smav * incompatible with the JDK or the VM doesn't support 1528234848Smav * the given Java thread state. 1529234848Smav * values must be the jintArray returned from JVM_GetThreadStateValues 1530234848Smav * and javaThreadState. 1531234848Smav */ 1532234848SmavJNIEXPORT jobjectArray JNICALL 1533234848SmavJVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values); 1534234848Smav 1535234848Smav/* ========================================================================= 1536234848Smav * The following defines a private JVM interface that the JDK can query 1537234848Smav * for the JVM version and capabilities. sun.misc.Version defines 1538234848Smav * the methods for getting the VM version and its capabilities. 1539234848Smav * 1540234848Smav * When a new bit is added, the following should be updated to provide 1541234848Smav * access to the new capability: 1542234848Smav * HS: JVM_GetVersionInfo and Abstract_VM_Version class 1543234848Smav * SDK: Version class 1544234848Smav * 1545234848Smav * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for 1546234848Smav * JVM to query for the JDK version and capabilities. 1547234848Smav * 1548234848Smav * When a new bit is added, the following should be updated to provide 1549234848Smav * access to the new capability: 1550234848Smav * HS: JDK_Version class 1551234848Smav * SDK: JDK_GetVersionInfo0 1552234848Smav * 1553234848Smav * ========================================================================== 1554234848Smav */ 1555234848Smavtypedef struct { 1556234848Smav /* HotSpot Express VM version string: 1557234848Smav * <major>.<minor>-bxx[-<identifier>][-<debug_flavor>] 1558234848Smav */ 1559234848Smav unsigned int jvm_version; /* Consists of major.minor.0.build */ 1560234848Smav unsigned int update_version : 8; /* 0 in HotSpot Express VM */ 1561234848Smav unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */ 1562234848Smav unsigned int reserved1 : 16; 1563234848Smav unsigned int reserved2; 1564234848Smav 1565234848Smav /* The following bits represents JVM supports that JDK has dependency on. 1566234848Smav * JDK can use these bits to determine which JVM version 1567234848Smav * and support it has to maintain runtime compatibility. 1568234848Smav * 1569234848Smav * When a new bit is added in a minor or update release, make sure 1570234848Smav * the new bit is also added in the main/baseline. 1571234848Smav */ 1572234848Smav unsigned int is_attachable : 1; 1573234848Smav unsigned int : 31; 1574234848Smav unsigned int : 32; 1575234848Smav unsigned int : 32; 1576234848Smav} jvm_version_info; 1577234848Smav 1578234848Smav#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) 1579234848Smav#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) 1580234848Smav// Micro version is 0 in HotSpot Express VM (set in jvm.cpp). 1581234848Smav#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) 1582234848Smav/* Build number is available in all HotSpot Express VM builds. 1583234848Smav * It is defined in make/hotspot_version file. 1584234848Smav */ 1585234848Smav#define JVM_VERSION_BUILD(version) ((version & 0x000000FF)) 1586234899Smav 1587234848SmavJNIEXPORT void JNICALL 1588234848SmavJVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size); 1589234848Smav 1590234848Smavtypedef struct { 1591234848Smav // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx 1592234848Smav unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */ 1593234848Smav /* and build number (xx) */ 1594234848Smav unsigned int update_version : 8; /* Update release version (uu) */ 1595234848Smav unsigned int special_update_version : 8; /* Special update release version (c)*/ 1596234848Smav unsigned int reserved1 : 16; 1597234848Smav unsigned int reserved2; 1598234848Smav 1599234848Smav /* The following bits represents new JDK supports that VM has dependency on. 1600234848Smav * VM implementation can use these bits to determine which JDK version 1601234848Smav * and support it has to maintain runtime compatibility. 1602234848Smav * 1603234848Smav * When a new bit is added in a minor or update release, make sure 1604234848Smav * the new bit is also added in the main/baseline. 1605234848Smav */ 1606234848Smav unsigned int thread_park_blocker : 1; 1607234848Smav unsigned int post_vm_init_hook_enabled : 1; 1608234848Smav unsigned int pending_list_uses_discovered_field : 1; 1609234899Smav unsigned int : 29; 1610234899Smav unsigned int : 32; 1611234848Smav unsigned int : 32; 1612234848Smav} jdk_version_info; 1613234848Smav 1614234848Smav#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24) 1615234848Smav#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16) 1616234848Smav#define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8) 1617234848Smav 1618234848Smav/* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN) 1619234848Smav * It will be zero for internal builds. 1620234899Smav */ 1621234848Smav#define JDK_VERSION_BUILD(version) ((version & 0x000000FF)) 1622234848Smav 1623234848Smav/* 1624234848Smav * This is the function JDK_GetVersionInfo0 defined in libjava.so 1625234848Smav * that is dynamically looked up by JVM. 1626234848Smav */ 1627234848Smavtypedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size); 1628234848Smav 1629234848Smav/* 1630234848Smav * This structure is used by the launcher to get the default thread 1631234848Smav * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a 1632234848Smav * version of 1.1. As it is not supported otherwise, it has been removed 1633234848Smav * from jni.h 1634234848Smav */ 1635234848Smavtypedef struct JDK1_1InitArgs { 1636234848Smav jint version; 1637234848Smav 1638234848Smav char **properties; 1639234848Smav jint checkSource; 1640234848Smav jint nativeStackSize; 1641234848Smav jint javaStackSize; 1642234848Smav jint minHeapSize; 1643234848Smav jint maxHeapSize; 1644234848Smav jint verifyMode; 1645234848Smav char *classpath; 1646234848Smav 1647234848Smav jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); 1648234848Smav void (JNICALL *exit)(jint code); 1649234848Smav void (JNICALL *abort)(void); 1650234848Smav 1651234848Smav jint enableClassGC; 1652234848Smav jint enableVerboseGC; 1653234848Smav jint disableAsyncGC; 1654234848Smav jint verbose; 1655234848Smav jboolean debugging; 1656234848Smav jint debugPort; 1657234848Smav} JDK1_1InitArgs; 1658234848Smav 1659234848Smav#ifdef __cplusplus 1660234848Smav} /* extern "C" */ 1661234848Smav#endif /* __cplusplus */ 1662234848Smav 1663234848Smav#endif /* !_JAVASOFT_JVM_H_ */ 1664234848Smav 1665234848Smav#endif // SHARE_VM_PRIMS_JVM_H 1666234848Smav