src/share/vm/prims/jvm.h

Sat, 07 Nov 2020 10:30:02 +0800

author
aoqi
date
Sat, 07 Nov 2020 10:30:02 +0800
changeset 10026
8c95980d0b66
parent 10015
eb7ce841ccec
permissions
-rw-r--r--

Added tag mips-jdk8u275-b01 for changeset d3b4d62f391f

duke@435 1 /*
dbuck@9562 2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_PRIMS_JVM_H
stefank@2314 26 #define SHARE_VM_PRIMS_JVM_H
stefank@2314 27
stefank@2314 28 #include "prims/jni.h"
stefank@2314 29 #ifdef TARGET_OS_FAMILY_linux
stefank@2314 30 # include "jvm_linux.h"
stefank@2314 31 #endif
stefank@2314 32 #ifdef TARGET_OS_FAMILY_solaris
stefank@2314 33 # include "jvm_solaris.h"
stefank@2314 34 #endif
stefank@2314 35 #ifdef TARGET_OS_FAMILY_windows
stefank@2314 36 # include "jvm_windows.h"
stefank@2314 37 #endif
goetz@6461 38 #ifdef TARGET_OS_FAMILY_aix
goetz@6461 39 # include "jvm_aix.h"
goetz@6461 40 #endif
never@3156 41 #ifdef TARGET_OS_FAMILY_bsd
never@3156 42 # include "jvm_bsd.h"
never@3156 43 #endif
stefank@2314 44
duke@435 45 #ifndef _JAVASOFT_JVM_H_
duke@435 46 #define _JAVASOFT_JVM_H_
duke@435 47
duke@435 48 // HotSpot integration note:
duke@435 49 //
duke@435 50 // This file and jvm.h used with the JDK are identical,
never@3095 51 // except for the three includes removed below
duke@435 52
duke@435 53 // #include <sys/stat.h>
duke@435 54 // #include "jni.h"
duke@435 55 // #include "jvm_md.h"
duke@435 56
duke@435 57
duke@435 58 #ifdef __cplusplus
duke@435 59 extern "C" {
duke@435 60 #endif
duke@435 61
duke@435 62 /*
duke@435 63 * This file contains additional functions exported from the VM.
duke@435 64 * These functions are complementary to the standard JNI support.
duke@435 65 * There are three parts to this file:
duke@435 66 *
duke@435 67 * First, this file contains the VM-related functions needed by native
duke@435 68 * libraries in the standard Java API. For example, the java.lang.Object
duke@435 69 * class needs VM-level functions that wait for and notify monitors.
duke@435 70 *
duke@435 71 * Second, this file contains the functions and constant definitions
duke@435 72 * needed by the byte code verifier and class file format checker.
duke@435 73 * These functions allow the verifier and format checker to be written
duke@435 74 * in a VM-independent way.
duke@435 75 *
duke@435 76 * Third, this file contains various I/O and nerwork operations needed
duke@435 77 * by the standard Java I/O and network APIs.
duke@435 78 */
duke@435 79
duke@435 80 /*
duke@435 81 * Bump the version number when either of the following happens:
duke@435 82 *
duke@435 83 * 1. There is a change in JVM_* functions.
duke@435 84 *
duke@435 85 * 2. There is a change in the contract between VM and Java classes.
duke@435 86 * For example, if the VM relies on a new private field in Thread
duke@435 87 * class.
duke@435 88 */
duke@435 89
duke@435 90 #define JVM_INTERFACE_VERSION 4
duke@435 91
coleenp@4398 92 JNIEXPORT jobjectArray JNICALL
coleenp@4398 93 JVM_GetMethodParameters(JNIEnv *env, jobject method);
duke@435 94
duke@435 95 JNIEXPORT jint JNICALL
duke@435 96 JVM_GetInterfaceVersion(void);
duke@435 97
duke@435 98 /*************************************************************************
duke@435 99 PART 1: Functions for Native Libraries
duke@435 100 ************************************************************************/
duke@435 101 /*
duke@435 102 * java.lang.Object
duke@435 103 */
duke@435 104 JNIEXPORT jint JNICALL
duke@435 105 JVM_IHashCode(JNIEnv *env, jobject obj);
duke@435 106
duke@435 107 JNIEXPORT void JNICALL
duke@435 108 JVM_MonitorWait(JNIEnv *env, jobject obj, jlong ms);
duke@435 109
duke@435 110 JNIEXPORT void JNICALL
duke@435 111 JVM_MonitorNotify(JNIEnv *env, jobject obj);
duke@435 112
duke@435 113 JNIEXPORT void JNICALL
duke@435 114 JVM_MonitorNotifyAll(JNIEnv *env, jobject obj);
duke@435 115
duke@435 116 JNIEXPORT jobject JNICALL
duke@435 117 JVM_Clone(JNIEnv *env, jobject obj);
duke@435 118
duke@435 119 /*
duke@435 120 * java.lang.String
duke@435 121 */
duke@435 122 JNIEXPORT jstring JNICALL
duke@435 123 JVM_InternString(JNIEnv *env, jstring str);
duke@435 124
duke@435 125 /*
duke@435 126 * java.lang.System
duke@435 127 */
duke@435 128 JNIEXPORT jlong JNICALL
duke@435 129 JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
duke@435 130
duke@435 131 JNIEXPORT jlong JNICALL
duke@435 132 JVM_NanoTime(JNIEnv *env, jclass ignored);
duke@435 133
duke@435 134 JNIEXPORT void JNICALL
duke@435 135 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
duke@435 136 jobject dst, jint dst_pos, jint length);
duke@435 137
duke@435 138 JNIEXPORT jobject JNICALL
duke@435 139 JVM_InitProperties(JNIEnv *env, jobject p);
duke@435 140
duke@435 141 /*
duke@435 142 * java.io.File
duke@435 143 */
duke@435 144 JNIEXPORT void JNICALL
duke@435 145 JVM_OnExit(void (*func)(void));
duke@435 146
duke@435 147 /*
dbuck@9562 148 * java.nio.Bits
dbuck@9562 149 */
dbuck@9562 150 JNIEXPORT void JNICALL
dbuck@9562 151 JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset,
dbuck@9562 152 jobject dstObj, jlong dstOffset, jlong size,
dbuck@9562 153 jlong elemSize);
dbuck@9562 154
dbuck@9562 155 /*
duke@435 156 * java.lang.Runtime
duke@435 157 */
duke@435 158 JNIEXPORT void JNICALL
duke@435 159 JVM_Exit(jint code);
duke@435 160
duke@435 161 JNIEXPORT void JNICALL
rwestberg@9864 162 JVM_BeforeHalt();
rwestberg@9864 163
rwestberg@9864 164 JNIEXPORT void JNICALL
duke@435 165 JVM_Halt(jint code);
duke@435 166
duke@435 167 JNIEXPORT void JNICALL
duke@435 168 JVM_GC(void);
duke@435 169
duke@435 170 /* Returns the number of real-time milliseconds that have elapsed since the
duke@435 171 * least-recently-inspected heap object was last inspected by the garbage
duke@435 172 * collector.
duke@435 173 *
duke@435 174 * For simple stop-the-world collectors this value is just the time
duke@435 175 * since the most recent collection. For generational collectors it is the
duke@435 176 * time since the oldest generation was most recently collected. Other
duke@435 177 * collectors are free to return a pessimistic estimate of the elapsed time, or
duke@435 178 * simply the time since the last full collection was performed.
duke@435 179 *
duke@435 180 * Note that in the presence of reference objects, a given object that is no
duke@435 181 * longer strongly reachable may have to be inspected multiple times before it
duke@435 182 * can be reclaimed.
duke@435 183 */
duke@435 184 JNIEXPORT jlong JNICALL
duke@435 185 JVM_MaxObjectInspectionAge(void);
duke@435 186
duke@435 187 JNIEXPORT void JNICALL
duke@435 188 JVM_TraceInstructions(jboolean on);
duke@435 189
duke@435 190 JNIEXPORT void JNICALL
duke@435 191 JVM_TraceMethodCalls(jboolean on);
duke@435 192
duke@435 193 JNIEXPORT jlong JNICALL
duke@435 194 JVM_TotalMemory(void);
duke@435 195
duke@435 196 JNIEXPORT jlong JNICALL
duke@435 197 JVM_FreeMemory(void);
duke@435 198
duke@435 199 JNIEXPORT jlong JNICALL
duke@435 200 JVM_MaxMemory(void);
duke@435 201
duke@435 202 JNIEXPORT jint JNICALL
duke@435 203 JVM_ActiveProcessorCount(void);
duke@435 204
sgehwolf@9987 205 JNIEXPORT jboolean JNICALL
sgehwolf@9987 206 JVM_IsUseContainerSupport(void);
sgehwolf@9987 207
duke@435 208 JNIEXPORT void * JNICALL
duke@435 209 JVM_LoadLibrary(const char *name);
duke@435 210
duke@435 211 JNIEXPORT void JNICALL
duke@435 212 JVM_UnloadLibrary(void * handle);
duke@435 213
duke@435 214 JNIEXPORT void * JNICALL
duke@435 215 JVM_FindLibraryEntry(void *handle, const char *name);
duke@435 216
duke@435 217 JNIEXPORT jboolean JNICALL
duke@435 218 JVM_IsSupportedJNIVersion(jint version);
duke@435 219
duke@435 220 /*
duke@435 221 * java.lang.Float and java.lang.Double
duke@435 222 */
duke@435 223 JNIEXPORT jboolean JNICALL
duke@435 224 JVM_IsNaN(jdouble d);
duke@435 225
duke@435 226 /*
duke@435 227 * java.lang.Throwable
duke@435 228 */
duke@435 229 JNIEXPORT void JNICALL
duke@435 230 JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
duke@435 231
duke@435 232 JNIEXPORT jint JNICALL
duke@435 233 JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
duke@435 234
duke@435 235 JNIEXPORT jobject JNICALL
duke@435 236 JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
duke@435 237
duke@435 238 /*
duke@435 239 * java.lang.Compiler
duke@435 240 */
duke@435 241 JNIEXPORT void JNICALL
duke@435 242 JVM_InitializeCompiler (JNIEnv *env, jclass compCls);
duke@435 243
duke@435 244 JNIEXPORT jboolean JNICALL
duke@435 245 JVM_IsSilentCompiler(JNIEnv *env, jclass compCls);
duke@435 246
duke@435 247 JNIEXPORT jboolean JNICALL
duke@435 248 JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls);
duke@435 249
duke@435 250 JNIEXPORT jboolean JNICALL
duke@435 251 JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname);
duke@435 252
duke@435 253 JNIEXPORT jobject JNICALL
duke@435 254 JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg);
duke@435 255
duke@435 256 JNIEXPORT void JNICALL
duke@435 257 JVM_EnableCompiler(JNIEnv *env, jclass compCls);
duke@435 258
duke@435 259 JNIEXPORT void JNICALL
duke@435 260 JVM_DisableCompiler(JNIEnv *env, jclass compCls);
duke@435 261
duke@435 262 /*
duke@435 263 * java.lang.Thread
duke@435 264 */
duke@435 265 JNIEXPORT void JNICALL
duke@435 266 JVM_StartThread(JNIEnv *env, jobject thread);
duke@435 267
duke@435 268 JNIEXPORT void JNICALL
duke@435 269 JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
duke@435 270
duke@435 271 JNIEXPORT jboolean JNICALL
duke@435 272 JVM_IsThreadAlive(JNIEnv *env, jobject thread);
duke@435 273
duke@435 274 JNIEXPORT void JNICALL
duke@435 275 JVM_SuspendThread(JNIEnv *env, jobject thread);
duke@435 276
duke@435 277 JNIEXPORT void JNICALL
duke@435 278 JVM_ResumeThread(JNIEnv *env, jobject thread);
duke@435 279
duke@435 280 JNIEXPORT void JNICALL
duke@435 281 JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
duke@435 282
duke@435 283 JNIEXPORT void JNICALL
duke@435 284 JVM_Yield(JNIEnv *env, jclass threadClass);
duke@435 285
duke@435 286 JNIEXPORT void JNICALL
duke@435 287 JVM_Sleep(JNIEnv *env, jclass threadClass, jlong millis);
duke@435 288
duke@435 289 JNIEXPORT jobject JNICALL
duke@435 290 JVM_CurrentThread(JNIEnv *env, jclass threadClass);
duke@435 291
duke@435 292 JNIEXPORT jint JNICALL
duke@435 293 JVM_CountStackFrames(JNIEnv *env, jobject thread);
duke@435 294
duke@435 295 JNIEXPORT void JNICALL
duke@435 296 JVM_Interrupt(JNIEnv *env, jobject thread);
duke@435 297
duke@435 298 JNIEXPORT jboolean JNICALL
duke@435 299 JVM_IsInterrupted(JNIEnv *env, jobject thread, jboolean clearInterrupted);
duke@435 300
duke@435 301 JNIEXPORT jboolean JNICALL
duke@435 302 JVM_HoldsLock(JNIEnv *env, jclass threadClass, jobject obj);
duke@435 303
duke@435 304 JNIEXPORT void JNICALL
duke@435 305 JVM_DumpAllStacks(JNIEnv *env, jclass unused);
duke@435 306
duke@435 307 JNIEXPORT jobjectArray JNICALL
duke@435 308 JVM_GetAllThreads(JNIEnv *env, jclass dummy);
duke@435 309
dcubed@3202 310 JNIEXPORT void JNICALL
dcubed@3202 311 JVM_SetNativeThreadName(JNIEnv *env, jobject jthread, jstring name);
dcubed@3202 312
duke@435 313 /* getStackTrace() and getAllStackTraces() method */
duke@435 314 JNIEXPORT jobjectArray JNICALL
duke@435 315 JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads);
duke@435 316
duke@435 317 /*
duke@435 318 * java.lang.SecurityManager
duke@435 319 */
duke@435 320 JNIEXPORT jclass JNICALL
duke@435 321 JVM_CurrentLoadedClass(JNIEnv *env);
duke@435 322
duke@435 323 JNIEXPORT jobject JNICALL
duke@435 324 JVM_CurrentClassLoader(JNIEnv *env);
duke@435 325
duke@435 326 JNIEXPORT jobjectArray JNICALL
duke@435 327 JVM_GetClassContext(JNIEnv *env);
duke@435 328
duke@435 329 JNIEXPORT jint JNICALL
duke@435 330 JVM_ClassDepth(JNIEnv *env, jstring name);
duke@435 331
duke@435 332 JNIEXPORT jint JNICALL
duke@435 333 JVM_ClassLoaderDepth(JNIEnv *env);
duke@435 334
duke@435 335 /*
duke@435 336 * java.lang.Package
duke@435 337 */
duke@435 338 JNIEXPORT jstring JNICALL
duke@435 339 JVM_GetSystemPackage(JNIEnv *env, jstring name);
duke@435 340
duke@435 341 JNIEXPORT jobjectArray JNICALL
duke@435 342 JVM_GetSystemPackages(JNIEnv *env);
duke@435 343
duke@435 344 /*
duke@435 345 * java.io.ObjectInputStream
duke@435 346 */
duke@435 347 JNIEXPORT jobject JNICALL
duke@435 348 JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass,
duke@435 349 jclass initClass);
duke@435 350
duke@435 351 JNIEXPORT jobject JNICALL
duke@435 352 JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass,
duke@435 353 jint length);
duke@435 354
duke@435 355 JNIEXPORT jobject JNICALL
duke@435 356 JVM_LatestUserDefinedLoader(JNIEnv *env);
duke@435 357
duke@435 358 /*
duke@435 359 * This function has been deprecated and should not be considered
duke@435 360 * part of the specified JVM interface.
duke@435 361 */
duke@435 362 JNIEXPORT jclass JNICALL
duke@435 363 JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass,
duke@435 364 jstring currClassName);
duke@435 365
duke@435 366 /*
duke@435 367 * java.lang.reflect.Array
duke@435 368 */
duke@435 369 JNIEXPORT jint JNICALL
duke@435 370 JVM_GetArrayLength(JNIEnv *env, jobject arr);
duke@435 371
duke@435 372 JNIEXPORT jobject JNICALL
duke@435 373 JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
duke@435 374
duke@435 375 JNIEXPORT jvalue JNICALL
duke@435 376 JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
duke@435 377
duke@435 378 JNIEXPORT void JNICALL
duke@435 379 JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
duke@435 380
duke@435 381 JNIEXPORT void JNICALL
duke@435 382 JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
duke@435 383 unsigned char vCode);
duke@435 384
duke@435 385 JNIEXPORT jobject JNICALL
duke@435 386 JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);
duke@435 387
duke@435 388 JNIEXPORT jobject JNICALL
duke@435 389 JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
duke@435 390
duke@435 391 /*
duke@435 392 * java.lang.Class and java.lang.ClassLoader
duke@435 393 */
dholmes@5849 394
dholmes@5849 395 #define JVM_CALLER_DEPTH -1
dholmes@5849 396
duke@435 397 /*
duke@435 398 * Returns the class in which the code invoking the native method
duke@435 399 * belongs.
duke@435 400 *
duke@435 401 * Note that in JDK 1.1, native methods did not create a frame.
duke@435 402 * In 1.2, they do. Therefore native methods like Class.forName
duke@435 403 * can no longer look at the current frame for the caller class.
duke@435 404 */
duke@435 405 JNIEXPORT jclass JNICALL
duke@435 406 JVM_GetCallerClass(JNIEnv *env, int n);
duke@435 407
duke@435 408 /*
duke@435 409 * Find primitive classes
duke@435 410 * utf: class name
duke@435 411 */
duke@435 412 JNIEXPORT jclass JNICALL
duke@435 413 JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
duke@435 414
duke@435 415 /*
duke@435 416 * Link the class
duke@435 417 */
duke@435 418 JNIEXPORT void JNICALL
duke@435 419 JVM_ResolveClass(JNIEnv *env, jclass cls);
duke@435 420
duke@435 421 /*
duke@435 422 * Find a class from a given class loader. Throw ClassNotFoundException
duke@435 423 * or NoClassDefFoundError depending on the value of the last
duke@435 424 * argument.
duke@435 425 */
duke@435 426 JNIEXPORT jclass JNICALL
duke@435 427 JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
duke@435 428 jobject loader, jboolean throwError);
duke@435 429
duke@435 430 /*
mchung@1313 431 * Find a class from a boot class loader. Returns NULL if class not found.
ksrini@661 432 */
ksrini@661 433 JNIEXPORT jclass JNICALL
mchung@1313 434 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
ksrini@661 435
ksrini@661 436 /*
coleenp@6823 437 * Find a class from a given class loader. Throws ClassNotFoundException.
coleenp@6823 438 * name: name of class
coleenp@6823 439 * init: whether initialization is done
coleenp@6823 440 * loader: class loader to look up the class. This may not be the same as the caller's
coleenp@6823 441 * class loader.
coleenp@6823 442 * caller: initiating class. The initiating class may be null when a security
coleenp@6823 443 * manager is not installed.
coleenp@6823 444 */
coleenp@6823 445 JNIEXPORT jclass JNICALL
coleenp@6823 446 JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,
coleenp@6823 447 jobject loader, jclass caller);
coleenp@6823 448
coleenp@6823 449 /*
duke@435 450 * Find a class from a given class.
duke@435 451 */
duke@435 452 JNIEXPORT jclass JNICALL
duke@435 453 JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
duke@435 454 jclass from);
duke@435 455
duke@435 456 /* Find a loaded class cached by the VM */
duke@435 457 JNIEXPORT jclass JNICALL
duke@435 458 JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name);
duke@435 459
duke@435 460 /* Define a class */
duke@435 461 JNIEXPORT jclass JNICALL
duke@435 462 JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
duke@435 463 jsize len, jobject pd);
duke@435 464
duke@435 465 /* Define a class with a source (added in JDK1.5) */
duke@435 466 JNIEXPORT jclass JNICALL
duke@435 467 JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
duke@435 468 const jbyte *buf, jsize len, jobject pd,
duke@435 469 const char *source);
duke@435 470
acorn@1408 471 /* Define a class with a source with conditional verification (added HSX 14)
acorn@1408 472 * -Xverify:all will verify anyway, -Xverify:none will not verify,
acorn@1408 473 * -Xverify:remote (default) will obey this conditional
acorn@1408 474 * i.e. true = should_verify_class
acorn@1408 475 */
acorn@1408 476 JNIEXPORT jclass JNICALL
acorn@1408 477 JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
acorn@1408 478 jobject loader, const jbyte *buf,
acorn@1408 479 jsize len, jobject pd, const char *source,
acorn@1408 480 jboolean verify);
acorn@1408 481
duke@435 482 /*
duke@435 483 * Reflection support functions
duke@435 484 */
duke@435 485
duke@435 486 JNIEXPORT jstring JNICALL
duke@435 487 JVM_GetClassName(JNIEnv *env, jclass cls);
duke@435 488
duke@435 489 JNIEXPORT jobjectArray JNICALL
duke@435 490 JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
duke@435 491
duke@435 492 JNIEXPORT jobject JNICALL
duke@435 493 JVM_GetClassLoader(JNIEnv *env, jclass cls);
duke@435 494
duke@435 495 JNIEXPORT jboolean JNICALL
duke@435 496 JVM_IsInterface(JNIEnv *env, jclass cls);
duke@435 497
duke@435 498 JNIEXPORT jobjectArray JNICALL
duke@435 499 JVM_GetClassSigners(JNIEnv *env, jclass cls);
duke@435 500
duke@435 501 JNIEXPORT void JNICALL
duke@435 502 JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers);
duke@435 503
duke@435 504 JNIEXPORT jobject JNICALL
duke@435 505 JVM_GetProtectionDomain(JNIEnv *env, jclass cls);
duke@435 506
duke@435 507 JNIEXPORT jboolean JNICALL
duke@435 508 JVM_IsArrayClass(JNIEnv *env, jclass cls);
duke@435 509
duke@435 510 JNIEXPORT jboolean JNICALL
duke@435 511 JVM_IsPrimitiveClass(JNIEnv *env, jclass cls);
duke@435 512
duke@435 513 JNIEXPORT jclass JNICALL
duke@435 514 JVM_GetComponentType(JNIEnv *env, jclass cls);
duke@435 515
duke@435 516 JNIEXPORT jint JNICALL
duke@435 517 JVM_GetClassModifiers(JNIEnv *env, jclass cls);
duke@435 518
duke@435 519 JNIEXPORT jobjectArray JNICALL
duke@435 520 JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
duke@435 521
duke@435 522 JNIEXPORT jclass JNICALL
duke@435 523 JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
duke@435 524
duke@435 525 /* Generics support (JDK 1.5) */
duke@435 526 JNIEXPORT jstring JNICALL
duke@435 527 JVM_GetClassSignature(JNIEnv *env, jclass cls);
duke@435 528
duke@435 529 /* Annotations support (JDK 1.5) */
duke@435 530 JNIEXPORT jbyteArray JNICALL
duke@435 531 JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
duke@435 532
duke@435 533 /* Annotations support (JDK 1.6) */
duke@435 534
duke@435 535 // field is a handle to a java.lang.reflect.Field object
duke@435 536 JNIEXPORT jbyteArray JNICALL
duke@435 537 JVM_GetFieldAnnotations(JNIEnv *env, jobject field);
duke@435 538
duke@435 539 // method is a handle to a java.lang.reflect.Method object
duke@435 540 JNIEXPORT jbyteArray JNICALL
duke@435 541 JVM_GetMethodAnnotations(JNIEnv *env, jobject method);
duke@435 542
duke@435 543 // method is a handle to a java.lang.reflect.Method object
duke@435 544 JNIEXPORT jbyteArray JNICALL
duke@435 545 JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method);
duke@435 546
duke@435 547 // method is a handle to a java.lang.reflect.Method object
duke@435 548 JNIEXPORT jbyteArray JNICALL
duke@435 549 JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method);
duke@435 550
stefank@4393 551 /* Type use annotations support (JDK 1.8) */
stefank@4393 552
stefank@4393 553 JNIEXPORT jbyteArray JNICALL
stefank@4393 554 JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
duke@435 555
rbackman@4818 556 // field is a handle to a java.lang.reflect.Field object
rbackman@4818 557 JNIEXPORT jbyteArray JNICALL
rbackman@4818 558 JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
rbackman@4818 559
rbackman@4818 560 // method is a handle to a java.lang.reflect.Method object
rbackman@4818 561 JNIEXPORT jbyteArray JNICALL
rbackman@4818 562 JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
rbackman@4818 563
duke@435 564 /*
duke@435 565 * New (JDK 1.4) reflection implementation
duke@435 566 */
duke@435 567
duke@435 568 JNIEXPORT jobjectArray JNICALL
duke@435 569 JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
duke@435 570
duke@435 571 JNIEXPORT jobjectArray JNICALL
duke@435 572 JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly);
duke@435 573
duke@435 574 JNIEXPORT jobjectArray JNICALL
duke@435 575 JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly);
duke@435 576
duke@435 577 /* Differs from JVM_GetClassModifiers in treatment of inner classes.
duke@435 578 This returns the access flags for the class as specified in the
duke@435 579 class file rather than searching the InnerClasses attribute (if
duke@435 580 present) to find the source-level access flags. Only the values of
duke@435 581 the low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
duke@435 582 valid. */
duke@435 583 JNIEXPORT jint JNICALL
duke@435 584 JVM_GetClassAccessFlags(JNIEnv *env, jclass cls);
duke@435 585
duke@435 586 /*
duke@435 587 * Constant pool access; currently used to implement reflective access to annotations (JDK 1.5)
duke@435 588 */
duke@435 589
duke@435 590 JNIEXPORT jobject JNICALL
duke@435 591 JVM_GetClassConstantPool(JNIEnv *env, jclass cls);
duke@435 592
duke@435 593 JNIEXPORT jint JNICALL JVM_ConstantPoolGetSize
coleenp@4037 594 (JNIEnv *env, jobject obj, jobject unused);
duke@435 595
duke@435 596 JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAt
coleenp@4037 597 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 598
duke@435 599 JNIEXPORT jclass JNICALL JVM_ConstantPoolGetClassAtIfLoaded
coleenp@4037 600 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 601
duke@435 602 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAt
coleenp@4037 603 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 604
duke@435 605 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetMethodAtIfLoaded
coleenp@4037 606 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 607
duke@435 608 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAt
coleenp@4037 609 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 610
duke@435 611 JNIEXPORT jobject JNICALL JVM_ConstantPoolGetFieldAtIfLoaded
coleenp@4037 612 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 613
duke@435 614 JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt
coleenp@4037 615 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 616
duke@435 617 JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt
coleenp@4037 618 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 619
duke@435 620 JNIEXPORT jlong JNICALL JVM_ConstantPoolGetLongAt
coleenp@4037 621 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 622
duke@435 623 JNIEXPORT jfloat JNICALL JVM_ConstantPoolGetFloatAt
coleenp@4037 624 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 625
duke@435 626 JNIEXPORT jdouble JNICALL JVM_ConstantPoolGetDoubleAt
coleenp@4037 627 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 628
duke@435 629 JNIEXPORT jstring JNICALL JVM_ConstantPoolGetStringAt
coleenp@4037 630 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 631
duke@435 632 JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
coleenp@4037 633 (JNIEnv *env, jobject obj, jobject unused, jint index);
duke@435 634
duke@435 635 /*
duke@435 636 * java.security.*
duke@435 637 */
duke@435 638
duke@435 639 JNIEXPORT jobject JNICALL
duke@435 640 JVM_DoPrivileged(JNIEnv *env, jclass cls,
duke@435 641 jobject action, jobject context, jboolean wrapException);
duke@435 642
duke@435 643 JNIEXPORT jobject JNICALL
duke@435 644 JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
duke@435 645
duke@435 646 JNIEXPORT jobject JNICALL
duke@435 647 JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
duke@435 648
duke@435 649 /*
duke@435 650 * Signal support, used to implement the shutdown sequence. Every VM must
duke@435 651 * support JVM_SIGINT and JVM_SIGTERM, raising the former for user interrupts
duke@435 652 * (^C) and the latter for external termination (kill, system shutdown, etc.).
duke@435 653 * Other platform-dependent signal values may also be supported.
duke@435 654 */
duke@435 655
duke@435 656 JNIEXPORT void * JNICALL
duke@435 657 JVM_RegisterSignal(jint sig, void *handler);
duke@435 658
duke@435 659 JNIEXPORT jboolean JNICALL
duke@435 660 JVM_RaiseSignal(jint sig);
duke@435 661
duke@435 662 JNIEXPORT jint JNICALL
duke@435 663 JVM_FindSignal(const char *name);
duke@435 664
duke@435 665 /*
duke@435 666 * Retrieve the assertion directives for the specified class.
duke@435 667 */
duke@435 668 JNIEXPORT jboolean JNICALL
duke@435 669 JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
duke@435 670
duke@435 671 /*
duke@435 672 * Retrieve the assertion directives from the VM.
duke@435 673 */
duke@435 674 JNIEXPORT jobject JNICALL
duke@435 675 JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
duke@435 676
duke@435 677 /*
twisti@3846 678 * java.util.concurrent.atomic.AtomicLong
duke@435 679 */
duke@435 680 JNIEXPORT jboolean JNICALL
duke@435 681 JVM_SupportsCX8(void);
duke@435 682
duke@435 683 JNIEXPORT jboolean JNICALL
duke@435 684 JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal);
duke@435 685
kamg@551 686 /*
kamg@551 687 * com.sun.dtrace.jsdt support
kamg@551 688 */
kamg@551 689
kamg@551 690 #define JVM_TRACING_DTRACE_VERSION 1
kamg@551 691
kamg@551 692 /*
kamg@551 693 * Structure to pass one probe description to JVM.
kamg@551 694 *
kamg@551 695 * The VM will overwrite the definition of the referenced method with
kamg@551 696 * code that will fire the probe.
kamg@551 697 */
kamg@551 698 typedef struct {
kamg@551 699 jmethodID method;
kamg@551 700 jstring function;
kamg@551 701 jstring name;
kamg@551 702 void* reserved[4]; // for future use
kamg@551 703 } JVM_DTraceProbe;
kamg@551 704
kamg@551 705 /**
kamg@551 706 * Encapsulates the stability ratings for a DTrace provider field
kamg@551 707 */
kamg@551 708 typedef struct {
kamg@551 709 jint nameStability;
kamg@551 710 jint dataStability;
kamg@551 711 jint dependencyClass;
kamg@551 712 } JVM_DTraceInterfaceAttributes;
kamg@551 713
kamg@551 714 /*
kamg@551 715 * Structure to pass one provider description to JVM
kamg@551 716 */
kamg@551 717 typedef struct {
kamg@551 718 jstring name;
kamg@551 719 JVM_DTraceProbe* probes;
kamg@551 720 jint probe_count;
kamg@551 721 JVM_DTraceInterfaceAttributes providerAttributes;
kamg@551 722 JVM_DTraceInterfaceAttributes moduleAttributes;
kamg@551 723 JVM_DTraceInterfaceAttributes functionAttributes;
kamg@551 724 JVM_DTraceInterfaceAttributes nameAttributes;
kamg@551 725 JVM_DTraceInterfaceAttributes argsAttributes;
kamg@551 726 void* reserved[4]; // for future use
kamg@551 727 } JVM_DTraceProvider;
kamg@551 728
kamg@551 729 /*
kamg@551 730 * Get the version number the JVM was built with
kamg@551 731 */
kamg@551 732 JNIEXPORT jint JNICALL
kamg@551 733 JVM_DTraceGetVersion(JNIEnv* env);
kamg@551 734
kamg@551 735 /*
kamg@551 736 * Register new probe with given signature, return global handle
kamg@551 737 *
kamg@551 738 * The version passed in is the version that the library code was
kamg@551 739 * built with.
kamg@551 740 */
kamg@551 741 JNIEXPORT jlong JNICALL
kamg@551 742 JVM_DTraceActivate(JNIEnv* env, jint version, jstring module_name,
kamg@551 743 jint providers_count, JVM_DTraceProvider* providers);
kamg@551 744
kamg@551 745 /*
kamg@551 746 * Check JSDT probe
kamg@551 747 */
kamg@551 748 JNIEXPORT jboolean JNICALL
kamg@551 749 JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method);
kamg@551 750
kamg@551 751 /*
kamg@551 752 * Destroy custom DOF
kamg@551 753 */
kamg@551 754 JNIEXPORT void JNICALL
kamg@551 755 JVM_DTraceDispose(JNIEnv* env, jlong handle);
kamg@551 756
kamg@551 757 /*
kamg@551 758 * Check to see if DTrace is supported by OS
kamg@551 759 */
kamg@551 760 JNIEXPORT jboolean JNICALL
kamg@551 761 JVM_DTraceIsSupported(JNIEnv* env);
kamg@551 762
duke@435 763 /*************************************************************************
duke@435 764 PART 2: Support for the Verifier and Class File Format Checker
duke@435 765 ************************************************************************/
duke@435 766 /*
duke@435 767 * Return the class name in UTF format. The result is valid
duke@435 768 * until JVM_ReleaseUTf is called.
duke@435 769 *
duke@435 770 * The caller must treat the string as a constant and not modify it
duke@435 771 * in any way.
duke@435 772 */
duke@435 773 JNIEXPORT const char * JNICALL
duke@435 774 JVM_GetClassNameUTF(JNIEnv *env, jclass cb);
duke@435 775
duke@435 776 /*
duke@435 777 * Returns the constant pool types in the buffer provided by "types."
duke@435 778 */
duke@435 779 JNIEXPORT void JNICALL
duke@435 780 JVM_GetClassCPTypes(JNIEnv *env, jclass cb, unsigned char *types);
duke@435 781
duke@435 782 /*
duke@435 783 * Returns the number of Constant Pool entries.
duke@435 784 */
duke@435 785 JNIEXPORT jint JNICALL
duke@435 786 JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cb);
duke@435 787
duke@435 788 /*
duke@435 789 * Returns the number of *declared* fields or methods.
duke@435 790 */
duke@435 791 JNIEXPORT jint JNICALL
duke@435 792 JVM_GetClassFieldsCount(JNIEnv *env, jclass cb);
duke@435 793
duke@435 794 JNIEXPORT jint JNICALL
duke@435 795 JVM_GetClassMethodsCount(JNIEnv *env, jclass cb);
duke@435 796
duke@435 797 /*
duke@435 798 * Returns the CP indexes of exceptions raised by a given method.
duke@435 799 * Places the result in the given buffer.
duke@435 800 *
duke@435 801 * The method is identified by method_index.
duke@435 802 */
duke@435 803 JNIEXPORT void JNICALL
duke@435 804 JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cb, jint method_index,
duke@435 805 unsigned short *exceptions);
duke@435 806 /*
duke@435 807 * Returns the number of exceptions raised by a given method.
duke@435 808 * The method is identified by method_index.
duke@435 809 */
duke@435 810 JNIEXPORT jint JNICALL
duke@435 811 JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cb, jint method_index);
duke@435 812
duke@435 813 /*
duke@435 814 * Returns the byte code sequence of a given method.
duke@435 815 * Places the result in the given buffer.
duke@435 816 *
duke@435 817 * The method is identified by method_index.
duke@435 818 */
duke@435 819 JNIEXPORT void JNICALL
duke@435 820 JVM_GetMethodIxByteCode(JNIEnv *env, jclass cb, jint method_index,
duke@435 821 unsigned char *code);
duke@435 822
duke@435 823 /*
duke@435 824 * Returns the length of the byte code sequence of a given method.
duke@435 825 * The method is identified by method_index.
duke@435 826 */
duke@435 827 JNIEXPORT jint JNICALL
duke@435 828 JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cb, jint method_index);
duke@435 829
duke@435 830 /*
duke@435 831 * A structure used to a capture exception table entry in a Java method.
duke@435 832 */
duke@435 833 typedef struct {
duke@435 834 jint start_pc;
duke@435 835 jint end_pc;
duke@435 836 jint handler_pc;
duke@435 837 jint catchType;
duke@435 838 } JVM_ExceptionTableEntryType;
duke@435 839
duke@435 840 /*
duke@435 841 * Returns the exception table entry at entry_index of a given method.
duke@435 842 * Places the result in the given buffer.
duke@435 843 *
duke@435 844 * The method is identified by method_index.
duke@435 845 */
duke@435 846 JNIEXPORT void JNICALL
duke@435 847 JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cb, jint method_index,
duke@435 848 jint entry_index,
duke@435 849 JVM_ExceptionTableEntryType *entry);
duke@435 850
duke@435 851 /*
duke@435 852 * Returns the length of the exception table of a given method.
duke@435 853 * The method is identified by method_index.
duke@435 854 */
duke@435 855 JNIEXPORT jint JNICALL
duke@435 856 JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cb, int index);
duke@435 857
duke@435 858 /*
duke@435 859 * Returns the modifiers of a given field.
duke@435 860 * The field is identified by field_index.
duke@435 861 */
duke@435 862 JNIEXPORT jint JNICALL
duke@435 863 JVM_GetFieldIxModifiers(JNIEnv *env, jclass cb, int index);
duke@435 864
duke@435 865 /*
duke@435 866 * Returns the modifiers of a given method.
duke@435 867 * The method is identified by method_index.
duke@435 868 */
duke@435 869 JNIEXPORT jint JNICALL
duke@435 870 JVM_GetMethodIxModifiers(JNIEnv *env, jclass cb, int index);
duke@435 871
duke@435 872 /*
duke@435 873 * Returns the number of local variables of a given method.
duke@435 874 * The method is identified by method_index.
duke@435 875 */
duke@435 876 JNIEXPORT jint JNICALL
duke@435 877 JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cb, int index);
duke@435 878
duke@435 879 /*
duke@435 880 * Returns the number of arguments (including this pointer) of a given method.
duke@435 881 * The method is identified by method_index.
duke@435 882 */
duke@435 883 JNIEXPORT jint JNICALL
duke@435 884 JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cb, int index);
duke@435 885
duke@435 886 /*
duke@435 887 * Returns the maximum amount of stack (in words) used by a given method.
duke@435 888 * The method is identified by method_index.
duke@435 889 */
duke@435 890 JNIEXPORT jint JNICALL
duke@435 891 JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cb, int index);
duke@435 892
duke@435 893 /*
duke@435 894 * Is a given method a constructor.
duke@435 895 * The method is identified by method_index.
duke@435 896 */
duke@435 897 JNIEXPORT jboolean JNICALL
duke@435 898 JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
duke@435 899
duke@435 900 /*
acorn@4499 901 * Is the given method generated by the VM.
acorn@4499 902 * The method is identified by method_index.
acorn@4499 903 */
acorn@4499 904 JNIEXPORT jboolean JNICALL
acorn@4499 905 JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
acorn@4499 906
acorn@4499 907 /*
duke@435 908 * Returns the name of a given method in UTF format.
duke@435 909 * The result remains valid until JVM_ReleaseUTF is called.
duke@435 910 *
duke@435 911 * The caller must treat the string as a constant and not modify it
duke@435 912 * in any way.
duke@435 913 */
duke@435 914 JNIEXPORT const char * JNICALL
duke@435 915 JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cb, jint index);
duke@435 916
duke@435 917 /*
duke@435 918 * Returns the signature of a given method in UTF format.
duke@435 919 * The result remains valid until JVM_ReleaseUTF is called.
duke@435 920 *
duke@435 921 * The caller must treat the string as a constant and not modify it
duke@435 922 * in any way.
duke@435 923 */
duke@435 924 JNIEXPORT const char * JNICALL
duke@435 925 JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
duke@435 926
duke@435 927 /*
duke@435 928 * Returns the name of the field refered to at a given constant pool
duke@435 929 * index.
duke@435 930 *
duke@435 931 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 932 * is called.
duke@435 933 *
duke@435 934 * The caller must treat the string as a constant and not modify it
duke@435 935 * in any way.
duke@435 936 */
duke@435 937 JNIEXPORT const char * JNICALL
duke@435 938 JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
duke@435 939
duke@435 940 /*
duke@435 941 * Returns the name of the method refered to at a given constant pool
duke@435 942 * index.
duke@435 943 *
duke@435 944 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 945 * is called.
duke@435 946 *
duke@435 947 * The caller must treat the string as a constant and not modify it
duke@435 948 * in any way.
duke@435 949 */
duke@435 950 JNIEXPORT const char * JNICALL
duke@435 951 JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
duke@435 952
duke@435 953 /*
duke@435 954 * Returns the signature of the method refered to at a given constant pool
duke@435 955 * index.
duke@435 956 *
duke@435 957 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 958 * is called.
duke@435 959 *
duke@435 960 * The caller must treat the string as a constant and not modify it
duke@435 961 * in any way.
duke@435 962 */
duke@435 963 JNIEXPORT const char * JNICALL
duke@435 964 JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
duke@435 965
duke@435 966 /*
duke@435 967 * Returns the signature of the field refered to at a given constant pool
duke@435 968 * index.
duke@435 969 *
duke@435 970 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 971 * is called.
duke@435 972 *
duke@435 973 * The caller must treat the string as a constant and not modify it
duke@435 974 * in any way.
duke@435 975 */
duke@435 976 JNIEXPORT const char * JNICALL
duke@435 977 JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
duke@435 978
duke@435 979 /*
duke@435 980 * Returns the class name refered to at a given constant pool index.
duke@435 981 *
duke@435 982 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 983 * is called.
duke@435 984 *
duke@435 985 * The caller must treat the string as a constant and not modify it
duke@435 986 * in any way.
duke@435 987 */
duke@435 988 JNIEXPORT const char * JNICALL
duke@435 989 JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
duke@435 990
duke@435 991 /*
duke@435 992 * Returns the class name refered to at a given constant pool index.
duke@435 993 *
duke@435 994 * The constant pool entry must refer to a CONSTANT_Fieldref.
duke@435 995 *
duke@435 996 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 997 * is called.
duke@435 998 *
duke@435 999 * The caller must treat the string as a constant and not modify it
duke@435 1000 * in any way.
duke@435 1001 */
duke@435 1002 JNIEXPORT const char * JNICALL
duke@435 1003 JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
duke@435 1004
duke@435 1005 /*
duke@435 1006 * Returns the class name refered to at a given constant pool index.
duke@435 1007 *
duke@435 1008 * The constant pool entry must refer to CONSTANT_Methodref or
duke@435 1009 * CONSTANT_InterfaceMethodref.
duke@435 1010 *
duke@435 1011 * The result is in UTF format and remains valid until JVM_ReleaseUTF
duke@435 1012 * is called.
duke@435 1013 *
duke@435 1014 * The caller must treat the string as a constant and not modify it
duke@435 1015 * in any way.
duke@435 1016 */
duke@435 1017 JNIEXPORT const char * JNICALL
duke@435 1018 JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cb, jint index);
duke@435 1019
duke@435 1020 /*
duke@435 1021 * Returns the modifiers of a field in calledClass. The field is
duke@435 1022 * referred to in class cb at constant pool entry index.
duke@435 1023 *
duke@435 1024 * The caller must treat the string as a constant and not modify it
duke@435 1025 * in any way.
duke@435 1026 *
duke@435 1027 * Returns -1 if the field does not exist in calledClass.
duke@435 1028 */
duke@435 1029 JNIEXPORT jint JNICALL
duke@435 1030 JVM_GetCPFieldModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
duke@435 1031
duke@435 1032 /*
duke@435 1033 * Returns the modifiers of a method in calledClass. The method is
duke@435 1034 * referred to in class cb at constant pool entry index.
duke@435 1035 *
duke@435 1036 * Returns -1 if the method does not exist in calledClass.
duke@435 1037 */
duke@435 1038 JNIEXPORT jint JNICALL
duke@435 1039 JVM_GetCPMethodModifiers(JNIEnv *env, jclass cb, int index, jclass calledClass);
duke@435 1040
duke@435 1041 /*
duke@435 1042 * Releases the UTF string obtained from the VM.
duke@435 1043 */
duke@435 1044 JNIEXPORT void JNICALL
duke@435 1045 JVM_ReleaseUTF(const char *utf);
duke@435 1046
duke@435 1047 /*
duke@435 1048 * Compare if two classes are in the same package.
duke@435 1049 */
duke@435 1050 JNIEXPORT jboolean JNICALL
duke@435 1051 JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2);
duke@435 1052
duke@435 1053 /* Constants in class files */
duke@435 1054
duke@435 1055 #define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */
duke@435 1056 #define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */
duke@435 1057 #define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */
duke@435 1058 #define JVM_ACC_STATIC 0x0008 /* instance variable is static */
duke@435 1059 #define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */
duke@435 1060 #define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */
duke@435 1061 #define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */
duke@435 1062 #define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */
duke@435 1063 #define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */
duke@435 1064 #define JVM_ACC_TRANSIENT 0x0080 /* not persistent */
duke@435 1065 #define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */
duke@435 1066 #define JVM_ACC_NATIVE 0x0100 /* implemented in C */
duke@435 1067 #define JVM_ACC_INTERFACE 0x0200 /* class is an interface */
duke@435 1068 #define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */
duke@435 1069 #define JVM_ACC_STRICT 0x0800 /* strict floating point */
duke@435 1070 #define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */
duke@435 1071 #define JVM_ACC_ANNOTATION 0x2000 /* annotation type */
duke@435 1072 #define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */
duke@435 1073
duke@435 1074 #define JVM_ACC_PUBLIC_BIT 0
duke@435 1075 #define JVM_ACC_PRIVATE_BIT 1
duke@435 1076 #define JVM_ACC_PROTECTED_BIT 2
duke@435 1077 #define JVM_ACC_STATIC_BIT 3
duke@435 1078 #define JVM_ACC_FINAL_BIT 4
duke@435 1079 #define JVM_ACC_SYNCHRONIZED_BIT 5
duke@435 1080 #define JVM_ACC_SUPER_BIT 5
duke@435 1081 #define JVM_ACC_VOLATILE_BIT 6
duke@435 1082 #define JVM_ACC_BRIDGE_BIT 6
duke@435 1083 #define JVM_ACC_TRANSIENT_BIT 7
duke@435 1084 #define JVM_ACC_VARARGS_BIT 7
duke@435 1085 #define JVM_ACC_NATIVE_BIT 8
duke@435 1086 #define JVM_ACC_INTERFACE_BIT 9
duke@435 1087 #define JVM_ACC_ABSTRACT_BIT 10
duke@435 1088 #define JVM_ACC_STRICT_BIT 11
duke@435 1089 #define JVM_ACC_SYNTHETIC_BIT 12
duke@435 1090 #define JVM_ACC_ANNOTATION_BIT 13
duke@435 1091 #define JVM_ACC_ENUM_BIT 14
duke@435 1092
duke@435 1093 // NOTE: replicated in SA in vm/agent/sun/jvm/hotspot/utilities/ConstantTag.java
duke@435 1094 enum {
duke@435 1095 JVM_CONSTANT_Utf8 = 1,
duke@435 1096 JVM_CONSTANT_Unicode, /* unused */
duke@435 1097 JVM_CONSTANT_Integer,
duke@435 1098 JVM_CONSTANT_Float,
duke@435 1099 JVM_CONSTANT_Long,
duke@435 1100 JVM_CONSTANT_Double,
duke@435 1101 JVM_CONSTANT_Class,
duke@435 1102 JVM_CONSTANT_String,
duke@435 1103 JVM_CONSTANT_Fieldref,
duke@435 1104 JVM_CONSTANT_Methodref,
duke@435 1105 JVM_CONSTANT_InterfaceMethodref,
jrose@1957 1106 JVM_CONSTANT_NameAndType,
jrose@1957 1107 JVM_CONSTANT_MethodHandle = 15, // JSR 292
jrose@2015 1108 JVM_CONSTANT_MethodType = 16, // JSR 292
jrose@2742 1109 //JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only
jrose@2353 1110 JVM_CONSTANT_InvokeDynamic = 18, // JSR 292
jrose@2353 1111 JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles
jrose@1957 1112 };
jrose@1957 1113
jrose@1957 1114 /* JVM_CONSTANT_MethodHandle subtypes */
jrose@1957 1115 enum {
jrose@1957 1116 JVM_REF_getField = 1,
jrose@1957 1117 JVM_REF_getStatic = 2,
jrose@1957 1118 JVM_REF_putField = 3,
jrose@1957 1119 JVM_REF_putStatic = 4,
jrose@1957 1120 JVM_REF_invokeVirtual = 5,
jrose@1957 1121 JVM_REF_invokeStatic = 6,
jrose@1957 1122 JVM_REF_invokeSpecial = 7,
jrose@1957 1123 JVM_REF_newInvokeSpecial = 8,
jrose@1957 1124 JVM_REF_invokeInterface = 9
duke@435 1125 };
duke@435 1126
duke@435 1127 /* Used in the newarray instruction. */
duke@435 1128
duke@435 1129 #define JVM_T_BOOLEAN 4
duke@435 1130 #define JVM_T_CHAR 5
duke@435 1131 #define JVM_T_FLOAT 6
duke@435 1132 #define JVM_T_DOUBLE 7
duke@435 1133 #define JVM_T_BYTE 8
duke@435 1134 #define JVM_T_SHORT 9
duke@435 1135 #define JVM_T_INT 10
duke@435 1136 #define JVM_T_LONG 11
duke@435 1137
duke@435 1138 /* JVM method signatures */
duke@435 1139
duke@435 1140 #define JVM_SIGNATURE_ARRAY '['
duke@435 1141 #define JVM_SIGNATURE_BYTE 'B'
duke@435 1142 #define JVM_SIGNATURE_CHAR 'C'
duke@435 1143 #define JVM_SIGNATURE_CLASS 'L'
duke@435 1144 #define JVM_SIGNATURE_ENDCLASS ';'
duke@435 1145 #define JVM_SIGNATURE_ENUM 'E'
duke@435 1146 #define JVM_SIGNATURE_FLOAT 'F'
duke@435 1147 #define JVM_SIGNATURE_DOUBLE 'D'
duke@435 1148 #define JVM_SIGNATURE_FUNC '('
duke@435 1149 #define JVM_SIGNATURE_ENDFUNC ')'
duke@435 1150 #define JVM_SIGNATURE_INT 'I'
duke@435 1151 #define JVM_SIGNATURE_LONG 'J'
duke@435 1152 #define JVM_SIGNATURE_SHORT 'S'
duke@435 1153 #define JVM_SIGNATURE_VOID 'V'
duke@435 1154 #define JVM_SIGNATURE_BOOLEAN 'Z'
duke@435 1155
duke@435 1156 /*
duke@435 1157 * A function defined by the byte-code verifier and called by the VM.
duke@435 1158 * This is not a function implemented in the VM.
duke@435 1159 *
duke@435 1160 * Returns JNI_FALSE if verification fails. A detailed error message
duke@435 1161 * will be places in msg_buf, whose length is specified by buf_len.
duke@435 1162 */
duke@435 1163 typedef jboolean (*verifier_fn_t)(JNIEnv *env,
duke@435 1164 jclass cb,
duke@435 1165 char * msg_buf,
duke@435 1166 jint buf_len);
duke@435 1167
duke@435 1168
duke@435 1169 /*
duke@435 1170 * Support for a VM-independent class format checker.
duke@435 1171 */
duke@435 1172 typedef struct {
duke@435 1173 unsigned long code; /* byte code */
duke@435 1174 unsigned long excs; /* exceptions */
duke@435 1175 unsigned long etab; /* catch table */
duke@435 1176 unsigned long lnum; /* line number */
duke@435 1177 unsigned long lvar; /* local vars */
duke@435 1178 } method_size_info;
duke@435 1179
duke@435 1180 typedef struct {
duke@435 1181 unsigned int constants; /* constant pool */
duke@435 1182 unsigned int fields;
duke@435 1183 unsigned int methods;
duke@435 1184 unsigned int interfaces;
duke@435 1185 unsigned int fields2; /* number of static 2-word fields */
duke@435 1186 unsigned int innerclasses; /* # of records in InnerClasses attr */
duke@435 1187
duke@435 1188 method_size_info clinit; /* memory used in clinit */
duke@435 1189 method_size_info main; /* used everywhere else */
duke@435 1190 } class_size_info;
duke@435 1191
duke@435 1192 /*
duke@435 1193 * Functions defined in libjava.so to perform string conversions.
duke@435 1194 *
duke@435 1195 */
duke@435 1196
duke@435 1197 typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);
duke@435 1198
duke@435 1199 typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);
duke@435 1200
duke@435 1201 /* This is the function defined in libjava.so that performs class
duke@435 1202 * format checks. This functions fills in size information about
duke@435 1203 * the class file and returns:
duke@435 1204 *
duke@435 1205 * 0: good
duke@435 1206 * -1: out of memory
duke@435 1207 * -2: bad format
duke@435 1208 * -3: unsupported version
duke@435 1209 * -4: bad class name
duke@435 1210 */
duke@435 1211
duke@435 1212 typedef jint (*check_format_fn_t)(char *class_name,
duke@435 1213 unsigned char *data,
duke@435 1214 unsigned int data_size,
duke@435 1215 class_size_info *class_size,
duke@435 1216 char *message_buffer,
duke@435 1217 jint buffer_length,
duke@435 1218 jboolean measure_only,
duke@435 1219 jboolean check_relaxed);
duke@435 1220
duke@435 1221 #define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \
duke@435 1222 JVM_ACC_FINAL | \
duke@435 1223 JVM_ACC_SUPER | \
duke@435 1224 JVM_ACC_INTERFACE | \
duke@435 1225 JVM_ACC_ABSTRACT | \
duke@435 1226 JVM_ACC_ANNOTATION | \
duke@435 1227 JVM_ACC_ENUM | \
duke@435 1228 JVM_ACC_SYNTHETIC)
duke@435 1229
duke@435 1230 #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
duke@435 1231 JVM_ACC_PRIVATE | \
duke@435 1232 JVM_ACC_PROTECTED | \
duke@435 1233 JVM_ACC_STATIC | \
duke@435 1234 JVM_ACC_FINAL | \
duke@435 1235 JVM_ACC_VOLATILE | \
duke@435 1236 JVM_ACC_TRANSIENT | \
duke@435 1237 JVM_ACC_ENUM | \
duke@435 1238 JVM_ACC_SYNTHETIC)
duke@435 1239
duke@435 1240 #define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
duke@435 1241 JVM_ACC_PRIVATE | \
duke@435 1242 JVM_ACC_PROTECTED | \
duke@435 1243 JVM_ACC_STATIC | \
duke@435 1244 JVM_ACC_FINAL | \
duke@435 1245 JVM_ACC_SYNCHRONIZED | \
duke@435 1246 JVM_ACC_BRIDGE | \
duke@435 1247 JVM_ACC_VARARGS | \
duke@435 1248 JVM_ACC_NATIVE | \
duke@435 1249 JVM_ACC_ABSTRACT | \
duke@435 1250 JVM_ACC_STRICT | \
duke@435 1251 JVM_ACC_SYNTHETIC)
duke@435 1252
duke@435 1253 /*
duke@435 1254 * This is the function defined in libjava.so to perform path
duke@435 1255 * canonicalization. VM call this function before opening jar files
duke@435 1256 * to load system classes.
duke@435 1257 *
duke@435 1258 */
duke@435 1259
duke@435 1260 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
duke@435 1261
duke@435 1262 /*************************************************************************
duke@435 1263 PART 3: I/O and Network Support
duke@435 1264 ************************************************************************/
duke@435 1265
duke@435 1266 /* Note that the JVM IO functions are expected to return JVM_IO_ERR
duke@435 1267 * when there is any kind of error. The caller can then use the
duke@435 1268 * platform specific support (e.g., errno) to get the detailed
duke@435 1269 * error info. The JVM_GetLastErrorString procedure may also be used
duke@435 1270 * to obtain a descriptive error string.
duke@435 1271 */
duke@435 1272 #define JVM_IO_ERR (-1)
duke@435 1273
duke@435 1274 /* For interruptible IO. Returning JVM_IO_INTR indicates that an IO
duke@435 1275 * operation has been disrupted by Thread.interrupt. There are a
duke@435 1276 * number of technical difficulties related to interruptible IO that
duke@435 1277 * need to be solved. For example, most existing programs do not handle
duke@435 1278 * InterruptedIOExceptions specially, they simply treat those as any
duke@435 1279 * IOExceptions, which typically indicate fatal errors.
duke@435 1280 *
duke@435 1281 * There are also two modes of operation for interruptible IO. In the
duke@435 1282 * resumption mode, an interrupted IO operation is guaranteed not to
duke@435 1283 * have any side-effects, and can be restarted. In the termination mode,
duke@435 1284 * an interrupted IO operation corrupts the underlying IO stream, so
duke@435 1285 * that the only reasonable operation on an interrupted stream is to
duke@435 1286 * close that stream. The resumption mode seems to be impossible to
duke@435 1287 * implement on Win32 and Solaris. Implementing the termination mode is
duke@435 1288 * easier, but it's not clear that's the right semantics.
duke@435 1289 *
duke@435 1290 * Interruptible IO is not supported on Win32.It can be enabled/disabled
duke@435 1291 * using a compile-time flag on Solaris. Third-party JVM ports do not
duke@435 1292 * need to implement interruptible IO.
duke@435 1293 */
duke@435 1294 #define JVM_IO_INTR (-2)
duke@435 1295
duke@435 1296 /* Write a string into the given buffer, in the platform's local encoding,
duke@435 1297 * that describes the most recent system-level error to occur in this thread.
duke@435 1298 * Return the length of the string or zero if no error occurred.
duke@435 1299 */
duke@435 1300 JNIEXPORT jint JNICALL
duke@435 1301 JVM_GetLastErrorString(char *buf, int len);
duke@435 1302
duke@435 1303 /*
duke@435 1304 * Convert a pathname into native format. This function does syntactic
duke@435 1305 * cleanup, such as removing redundant separator characters. It modifies
duke@435 1306 * the given pathname string in place.
duke@435 1307 */
duke@435 1308 JNIEXPORT char * JNICALL
duke@435 1309 JVM_NativePath(char *);
duke@435 1310
duke@435 1311 /*
duke@435 1312 * JVM I/O error codes
duke@435 1313 */
duke@435 1314 #define JVM_EEXIST -100
duke@435 1315
duke@435 1316 /*
duke@435 1317 * Open a file descriptor. This function returns a negative error code
duke@435 1318 * on error, and a non-negative integer that is the file descriptor on
duke@435 1319 * success.
duke@435 1320 */
duke@435 1321 JNIEXPORT jint JNICALL
duke@435 1322 JVM_Open(const char *fname, jint flags, jint mode);
duke@435 1323
duke@435 1324 /*
duke@435 1325 * Close a file descriptor. This function returns -1 on error, and 0
duke@435 1326 * on success.
duke@435 1327 *
duke@435 1328 * fd the file descriptor to close.
duke@435 1329 */
duke@435 1330 JNIEXPORT jint JNICALL
duke@435 1331 JVM_Close(jint fd);
duke@435 1332
duke@435 1333 /*
duke@435 1334 * Read data from a file decriptor into a char array.
duke@435 1335 *
duke@435 1336 * fd the file descriptor to read from.
duke@435 1337 * buf the buffer where to put the read data.
duke@435 1338 * nbytes the number of bytes to read.
duke@435 1339 *
duke@435 1340 * This function returns -1 on error, and 0 on success.
duke@435 1341 */
duke@435 1342 JNIEXPORT jint JNICALL
duke@435 1343 JVM_Read(jint fd, char *buf, jint nbytes);
duke@435 1344
duke@435 1345 /*
duke@435 1346 * Write data from a char array to a file decriptor.
duke@435 1347 *
duke@435 1348 * fd the file descriptor to read from.
duke@435 1349 * buf the buffer from which to fetch the data.
duke@435 1350 * nbytes the number of bytes to write.
duke@435 1351 *
duke@435 1352 * This function returns -1 on error, and 0 on success.
duke@435 1353 */
duke@435 1354 JNIEXPORT jint JNICALL
duke@435 1355 JVM_Write(jint fd, char *buf, jint nbytes);
duke@435 1356
duke@435 1357 /*
duke@435 1358 * Returns the number of bytes available for reading from a given file
duke@435 1359 * descriptor
duke@435 1360 */
duke@435 1361 JNIEXPORT jint JNICALL
duke@435 1362 JVM_Available(jint fd, jlong *pbytes);
duke@435 1363
duke@435 1364 /*
duke@435 1365 * Move the file descriptor pointer from whence by offset.
duke@435 1366 *
duke@435 1367 * fd the file descriptor to move.
duke@435 1368 * offset the number of bytes to move it by.
duke@435 1369 * whence the start from where to move it.
duke@435 1370 *
duke@435 1371 * This function returns the resulting pointer location.
duke@435 1372 */
duke@435 1373 JNIEXPORT jlong JNICALL
duke@435 1374 JVM_Lseek(jint fd, jlong offset, jint whence);
duke@435 1375
duke@435 1376 /*
duke@435 1377 * Set the length of the file associated with the given descriptor to the given
duke@435 1378 * length. If the new length is longer than the current length then the file
duke@435 1379 * is extended; the contents of the extended portion are not defined. The
duke@435 1380 * value of the file pointer is undefined after this procedure returns.
duke@435 1381 */
duke@435 1382 JNIEXPORT jint JNICALL
duke@435 1383 JVM_SetLength(jint fd, jlong length);
duke@435 1384
duke@435 1385 /*
duke@435 1386 * Synchronize the file descriptor's in memory state with that of the
duke@435 1387 * physical device. Return of -1 is an error, 0 is OK.
duke@435 1388 */
duke@435 1389 JNIEXPORT jint JNICALL
duke@435 1390 JVM_Sync(jint fd);
duke@435 1391
duke@435 1392 /*
duke@435 1393 * Networking library support
duke@435 1394 */
duke@435 1395
duke@435 1396 JNIEXPORT jint JNICALL
duke@435 1397 JVM_InitializeSocketLibrary(void);
duke@435 1398
duke@435 1399 struct sockaddr;
duke@435 1400
duke@435 1401 JNIEXPORT jint JNICALL
duke@435 1402 JVM_Socket(jint domain, jint type, jint protocol);
duke@435 1403
duke@435 1404 JNIEXPORT jint JNICALL
duke@435 1405 JVM_SocketClose(jint fd);
duke@435 1406
duke@435 1407 JNIEXPORT jint JNICALL
duke@435 1408 JVM_SocketShutdown(jint fd, jint howto);
duke@435 1409
duke@435 1410 JNIEXPORT jint JNICALL
duke@435 1411 JVM_Recv(jint fd, char *buf, jint nBytes, jint flags);
duke@435 1412
duke@435 1413 JNIEXPORT jint JNICALL
duke@435 1414 JVM_Send(jint fd, char *buf, jint nBytes, jint flags);
duke@435 1415
duke@435 1416 JNIEXPORT jint JNICALL
duke@435 1417 JVM_Timeout(int fd, long timeout);
duke@435 1418
duke@435 1419 JNIEXPORT jint JNICALL
duke@435 1420 JVM_Listen(jint fd, jint count);
duke@435 1421
duke@435 1422 JNIEXPORT jint JNICALL
duke@435 1423 JVM_Connect(jint fd, struct sockaddr *him, jint len);
duke@435 1424
duke@435 1425 JNIEXPORT jint JNICALL
duke@435 1426 JVM_Bind(jint fd, struct sockaddr *him, jint len);
duke@435 1427
duke@435 1428 JNIEXPORT jint JNICALL
duke@435 1429 JVM_Accept(jint fd, struct sockaddr *him, jint *len);
duke@435 1430
duke@435 1431 JNIEXPORT jint JNICALL
duke@435 1432 JVM_RecvFrom(jint fd, char *buf, int nBytes,
duke@435 1433 int flags, struct sockaddr *from, int *fromlen);
duke@435 1434
duke@435 1435 JNIEXPORT jint JNICALL
duke@435 1436 JVM_SendTo(jint fd, char *buf, int len,
duke@435 1437 int flags, struct sockaddr *to, int tolen);
duke@435 1438
duke@435 1439 JNIEXPORT jint JNICALL
duke@435 1440 JVM_SocketAvailable(jint fd, jint *result);
duke@435 1441
duke@435 1442
duke@435 1443 JNIEXPORT jint JNICALL
duke@435 1444 JVM_GetSockName(jint fd, struct sockaddr *him, int *len);
duke@435 1445
duke@435 1446 JNIEXPORT jint JNICALL
duke@435 1447 JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);
duke@435 1448
duke@435 1449 JNIEXPORT jint JNICALL
duke@435 1450 JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);
duke@435 1451
duke@435 1452 JNIEXPORT int JNICALL
duke@435 1453 JVM_GetHostName(char* name, int namelen);
duke@435 1454
duke@435 1455 /*
duke@435 1456 * The standard printing functions supported by the Java VM. (Should they
duke@435 1457 * be renamed to JVM_* in the future?
duke@435 1458 */
duke@435 1459
duke@435 1460 /*
duke@435 1461 * BE CAREFUL! The following functions do not implement the
duke@435 1462 * full feature set of standard C printf formats.
duke@435 1463 */
coleenp@2507 1464 JNIEXPORT int
duke@435 1465 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
duke@435 1466
coleenp@2507 1467 JNIEXPORT int
duke@435 1468 jio_snprintf(char *str, size_t count, const char *fmt, ...);
duke@435 1469
coleenp@2507 1470 JNIEXPORT int
duke@435 1471 jio_fprintf(FILE *, const char *fmt, ...);
duke@435 1472
coleenp@2507 1473 JNIEXPORT int
duke@435 1474 jio_vfprintf(FILE *, const char *fmt, va_list args);
duke@435 1475
duke@435 1476
duke@435 1477 JNIEXPORT void * JNICALL
duke@435 1478 JVM_RawMonitorCreate(void);
duke@435 1479
duke@435 1480 JNIEXPORT void JNICALL
duke@435 1481 JVM_RawMonitorDestroy(void *mon);
duke@435 1482
duke@435 1483 JNIEXPORT jint JNICALL
duke@435 1484 JVM_RawMonitorEnter(void *mon);
duke@435 1485
duke@435 1486 JNIEXPORT void JNICALL
duke@435 1487 JVM_RawMonitorExit(void *mon);
duke@435 1488
duke@435 1489 /*
duke@435 1490 * java.lang.reflect.Method
duke@435 1491 */
duke@435 1492 JNIEXPORT jobject JNICALL
duke@435 1493 JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0);
duke@435 1494
duke@435 1495 /*
duke@435 1496 * java.lang.reflect.Constructor
duke@435 1497 */
duke@435 1498 JNIEXPORT jobject JNICALL
duke@435 1499 JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0);
duke@435 1500
duke@435 1501 /*
duke@435 1502 * java.lang.management support
duke@435 1503 */
duke@435 1504 JNIEXPORT void* JNICALL
duke@435 1505 JVM_GetManagement(jint version);
duke@435 1506
duke@435 1507 /*
duke@435 1508 * com.sun.tools.attach.VirtualMachine support
duke@435 1509 *
duke@435 1510 * Initialize the agent properties with the properties maintained in the VM.
duke@435 1511 */
duke@435 1512 JNIEXPORT jobject JNICALL
duke@435 1513 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
duke@435 1514
sla@6705 1515 JNIEXPORT jstring JNICALL
sla@6705 1516 JVM_GetTemporaryDirectory(JNIEnv *env);
sla@6705 1517
duke@435 1518 /* Generics reflection support.
duke@435 1519 *
duke@435 1520 * Returns information about the given class's EnclosingMethod
duke@435 1521 * attribute, if present, or null if the class had no enclosing
duke@435 1522 * method.
duke@435 1523 *
duke@435 1524 * If non-null, the returned array contains three elements. Element 0
duke@435 1525 * is the java.lang.Class of which the enclosing method is a member,
duke@435 1526 * and elements 1 and 2 are the java.lang.Strings for the enclosing
duke@435 1527 * method's name and descriptor, respectively.
duke@435 1528 */
duke@435 1529 JNIEXPORT jobjectArray JNICALL
duke@435 1530 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
duke@435 1531
duke@435 1532 /*
duke@435 1533 * Java thread state support
duke@435 1534 */
duke@435 1535 enum {
duke@435 1536 JAVA_THREAD_STATE_NEW = 0,
duke@435 1537 JAVA_THREAD_STATE_RUNNABLE = 1,
duke@435 1538 JAVA_THREAD_STATE_BLOCKED = 2,
duke@435 1539 JAVA_THREAD_STATE_WAITING = 3,
duke@435 1540 JAVA_THREAD_STATE_TIMED_WAITING = 4,
duke@435 1541 JAVA_THREAD_STATE_TERMINATED = 5,
duke@435 1542 JAVA_THREAD_STATE_COUNT = 6
duke@435 1543 };
duke@435 1544
duke@435 1545 /*
duke@435 1546 * Returns an array of the threadStatus values representing the
duke@435 1547 * given Java thread state. Returns NULL if the VM version is
duke@435 1548 * incompatible with the JDK or doesn't support the given
duke@435 1549 * Java thread state.
duke@435 1550 */
duke@435 1551 JNIEXPORT jintArray JNICALL
duke@435 1552 JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState);
duke@435 1553
duke@435 1554 /*
duke@435 1555 * Returns an array of the substate names representing the
duke@435 1556 * given Java thread state. Returns NULL if the VM version is
duke@435 1557 * incompatible with the JDK or the VM doesn't support
duke@435 1558 * the given Java thread state.
duke@435 1559 * values must be the jintArray returned from JVM_GetThreadStateValues
duke@435 1560 * and javaThreadState.
duke@435 1561 */
duke@435 1562 JNIEXPORT jobjectArray JNICALL
duke@435 1563 JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
duke@435 1564
iklam@7322 1565 /*
iklam@7322 1566 * Returns true if the JVM's lookup cache indicates that this class is
iklam@7322 1567 * known to NOT exist for the given loader.
iklam@7322 1568 */
iklam@7322 1569 JNIEXPORT jboolean JNICALL
iklam@7322 1570 JVM_KnownToNotExist(JNIEnv *env, jobject loader, const char *classname);
iklam@7322 1571
iklam@7322 1572 /*
iklam@7322 1573 * Returns an array of all URLs that are stored in the JVM's lookup cache
iklam@7322 1574 * for the given loader. NULL if the lookup cache is unavailable.
iklam@7322 1575 */
iklam@7322 1576 JNIEXPORT jobjectArray JNICALL
iklam@7322 1577 JVM_GetResourceLookupCacheURLs(JNIEnv *env, jobject loader);
iklam@7322 1578
iklam@7322 1579 /*
iklam@7322 1580 * Returns an array of all URLs that *may* contain the resource_name for the
iklam@7322 1581 * given loader. This function returns an integer array, each element
iklam@7322 1582 * of which can be used to index into the array returned by
iklam@7322 1583 * JVM_GetResourceLookupCacheURLs of the same loader to determine the
iklam@7322 1584 * URLs.
iklam@7322 1585 */
iklam@7322 1586 JNIEXPORT jintArray JNICALL
iklam@7322 1587 JVM_GetResourceLookupCache(JNIEnv *env, jobject loader, const char *resource_name);
iklam@7322 1588
iklam@7322 1589
duke@435 1590 /* =========================================================================
duke@435 1591 * The following defines a private JVM interface that the JDK can query
duke@435 1592 * for the JVM version and capabilities. sun.misc.Version defines
duke@435 1593 * the methods for getting the VM version and its capabilities.
duke@435 1594 *
duke@435 1595 * When a new bit is added, the following should be updated to provide
duke@435 1596 * access to the new capability:
duke@435 1597 * HS: JVM_GetVersionInfo and Abstract_VM_Version class
duke@435 1598 * SDK: Version class
duke@435 1599 *
duke@435 1600 * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
duke@435 1601 * JVM to query for the JDK version and capabilities.
duke@435 1602 *
duke@435 1603 * When a new bit is added, the following should be updated to provide
duke@435 1604 * access to the new capability:
duke@435 1605 * HS: JDK_Version class
duke@435 1606 * SDK: JDK_GetVersionInfo0
duke@435 1607 *
duke@435 1608 * ==========================================================================
duke@435 1609 */
duke@435 1610 typedef struct {
duke@435 1611 /* HotSpot Express VM version string:
duke@435 1612 * <major>.<minor>-bxx[-<identifier>][-<debug_flavor>]
duke@435 1613 */
duke@435 1614 unsigned int jvm_version; /* Consists of major.minor.0.build */
duke@435 1615 unsigned int update_version : 8; /* 0 in HotSpot Express VM */
duke@435 1616 unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */
duke@435 1617 unsigned int reserved1 : 16;
duke@435 1618 unsigned int reserved2;
duke@435 1619
duke@435 1620 /* The following bits represents JVM supports that JDK has dependency on.
duke@435 1621 * JDK can use these bits to determine which JVM version
duke@435 1622 * and support it has to maintain runtime compatibility.
duke@435 1623 *
duke@435 1624 * When a new bit is added in a minor or update release, make sure
duke@435 1625 * the new bit is also added in the main/baseline.
duke@435 1626 */
duke@435 1627 unsigned int is_attachable : 1;
zgu@4569 1628 unsigned int : 31;
duke@435 1629 unsigned int : 32;
duke@435 1630 unsigned int : 32;
duke@435 1631 } jvm_version_info;
duke@435 1632
duke@435 1633 #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
sgehwolf@9915 1634 #define JVM_VERSION_MINOR(version) ((version & 0x00FFFF00) >> 8)
duke@435 1635 // Micro version is 0 in HotSpot Express VM (set in jvm.cpp).
sgehwolf@9915 1636 #define JVM_VERSION_MICRO(version) 0
duke@435 1637 /* Build number is available in all HotSpot Express VM builds.
duke@435 1638 * It is defined in make/hotspot_version file.
duke@435 1639 */
duke@435 1640 #define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
duke@435 1641
duke@435 1642 JNIEXPORT void JNICALL
duke@435 1643 JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
duke@435 1644
duke@435 1645 typedef struct {
duke@435 1646 // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
duke@435 1647 unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */
duke@435 1648 /* and build number (xx) */
sgehwolf@9915 1649 unsigned int update_version : 16; /* Update release version (uu) */
duke@435 1650 unsigned int special_update_version : 8; /* Special update release version (c)*/
sgehwolf@9915 1651 unsigned int reserved1 : 8;
duke@435 1652 unsigned int reserved2;
duke@435 1653
duke@435 1654 /* The following bits represents new JDK supports that VM has dependency on.
duke@435 1655 * VM implementation can use these bits to determine which JDK version
duke@435 1656 * and support it has to maintain runtime compatibility.
duke@435 1657 *
duke@435 1658 * When a new bit is added in a minor or update release, make sure
duke@435 1659 * the new bit is also added in the main/baseline.
duke@435 1660 */
duke@435 1661 unsigned int thread_park_blocker : 1;
kevinw@2449 1662 unsigned int post_vm_init_hook_enabled : 1;
ysr@3117 1663 unsigned int pending_list_uses_discovered_field : 1;
ysr@3117 1664 unsigned int : 29;
duke@435 1665 unsigned int : 32;
duke@435 1666 unsigned int : 32;
duke@435 1667 } jdk_version_info;
duke@435 1668
duke@435 1669 #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
duke@435 1670 #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
duke@435 1671 #define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
duke@435 1672
duke@435 1673 /* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN)
duke@435 1674 * It will be zero for internal builds.
duke@435 1675 */
duke@435 1676 #define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
duke@435 1677
duke@435 1678 /*
duke@435 1679 * This is the function JDK_GetVersionInfo0 defined in libjava.so
duke@435 1680 * that is dynamically looked up by JVM.
duke@435 1681 */
duke@435 1682 typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
duke@435 1683
duke@435 1684 /*
duke@435 1685 * This structure is used by the launcher to get the default thread
duke@435 1686 * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
duke@435 1687 * version of 1.1. As it is not supported otherwise, it has been removed
duke@435 1688 * from jni.h
duke@435 1689 */
duke@435 1690 typedef struct JDK1_1InitArgs {
duke@435 1691 jint version;
duke@435 1692
duke@435 1693 char **properties;
duke@435 1694 jint checkSource;
duke@435 1695 jint nativeStackSize;
duke@435 1696 jint javaStackSize;
duke@435 1697 jint minHeapSize;
duke@435 1698 jint maxHeapSize;
duke@435 1699 jint verifyMode;
duke@435 1700 char *classpath;
duke@435 1701
duke@435 1702 jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args);
duke@435 1703 void (JNICALL *exit)(jint code);
duke@435 1704 void (JNICALL *abort)(void);
duke@435 1705
duke@435 1706 jint enableClassGC;
duke@435 1707 jint enableVerboseGC;
duke@435 1708 jint disableAsyncGC;
duke@435 1709 jint verbose;
duke@435 1710 jboolean debugging;
duke@435 1711 jint debugPort;
duke@435 1712 } JDK1_1InitArgs;
duke@435 1713
duke@435 1714 #ifdef __cplusplus
duke@435 1715 } /* extern "C" */
duke@435 1716 #endif /* __cplusplus */
duke@435 1717
duke@435 1718 #endif /* !_JAVASOFT_JVM_H_ */
stefank@2314 1719
stefank@2314 1720 #endif // SHARE_VM_PRIMS_JVM_H

mercurial