annotate src/share/vm/prims/jvm.h @ 13526:f5dd157e3889

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