annotate src/java.base/share/native/include/jvm.h @ 48224:ddbcfca4d51d

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