< prev index next >

src/share/vm/prims/jvm.h

Print this page




 121  */
 122 JNIEXPORT jstring JNICALL
 123 JVM_InternString(JNIEnv *env, jstring str);
 124 
 125 /*
 126  * java.lang.System
 127  */
 128 JNIEXPORT jlong JNICALL
 129 JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
 130 
 131 JNIEXPORT jlong JNICALL
 132 JVM_NanoTime(JNIEnv *env, jclass ignored);
 133 
 134 JNIEXPORT void JNICALL
 135 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
 136               jobject dst, jint dst_pos, jint length);
 137 
 138 JNIEXPORT jobject JNICALL
 139 JVM_InitProperties(JNIEnv *env, jobject p);
 140 
 141 /*
 142  * java.io.File
 143  */
 144 JNIEXPORT void JNICALL
 145 JVM_OnExit(void (*func)(void));
 146 
 147 /*
 148  * java.lang.Runtime
 149  */
 150 JNIEXPORT void JNICALL
 151 JVM_Exit(jint code);
 152 
 153 JNIEXPORT void JNICALL
 154 JVM_Halt(jint code);
 155 
 156 JNIEXPORT void JNICALL
 157 JVM_GC(void);
 158 
 159 /* Returns the number of real-time milliseconds that have elapsed since the
 160  * least-recently-inspected heap object was last inspected by the garbage
 161  * collector.
 162  *
 163  * For simple stop-the-world collectors this value is just the time
 164  * since the most recent collection.  For generational collectors it is the
 165  * time since the oldest generation was most recently collected.  Other
 166  * collectors are free to return a pessimistic estimate of the elapsed time, or
 167  * simply the time since the last full collection was performed.
 168  *
 169  * Note that in the presence of reference objects, a given object that is no
 170  * longer strongly reachable may have to be inspected multiple times before it
 171  * can be reclaimed.
 172  */
 173 JNIEXPORT jlong JNICALL
 174 JVM_MaxObjectInspectionAge(void);
 175 
 176 JNIEXPORT void JNICALL
 177 JVM_TraceInstructions(jboolean on);
 178 
 179 JNIEXPORT void JNICALL
 180 JVM_TraceMethodCalls(jboolean on);
 181 
 182 JNIEXPORT jlong JNICALL
 183 JVM_TotalMemory(void);
 184 
 185 JNIEXPORT jlong JNICALL
 186 JVM_FreeMemory(void);
 187 
 188 JNIEXPORT jlong JNICALL
 189 JVM_MaxMemory(void);
 190 
 191 JNIEXPORT jint JNICALL
 192 JVM_ActiveProcessorCount(void);
 193 
 194 JNIEXPORT void * JNICALL
 195 JVM_LoadLibrary(const char *name);
 196 
 197 JNIEXPORT void JNICALL
 198 JVM_UnloadLibrary(void * handle);
 199 
 200 JNIEXPORT void * JNICALL
 201 JVM_FindLibraryEntry(void *handle, const char *name);
 202 
 203 JNIEXPORT jboolean JNICALL
 204 JVM_IsSupportedJNIVersion(jint version);
 205 
 206 /*
 207  * java.lang.Float and java.lang.Double
 208  */
 209 JNIEXPORT jboolean JNICALL
 210 JVM_IsNaN(jdouble d);
 211 
 212 /*
 213  * java.lang.Throwable
 214  */
 215 JNIEXPORT void JNICALL
 216 JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
 217 
 218 JNIEXPORT jint JNICALL
 219 JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
 220 
 221 JNIEXPORT jobject JNICALL
 222 JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
 223 
 224 /*
 225  * java.lang.Compiler
 226  */
 227 JNIEXPORT void JNICALL
 228 JVM_InitializeCompiler (JNIEnv *env, jclass compCls);
 229 
 230 JNIEXPORT jboolean JNICALL
 231 JVM_IsSilentCompiler(JNIEnv *env, jclass compCls);
 232 
 233 JNIEXPORT jboolean JNICALL
 234 JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls);
 235 
 236 JNIEXPORT jboolean JNICALL
 237 JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname);
 238 
 239 JNIEXPORT jobject JNICALL
 240 JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg);
 241 
 242 JNIEXPORT void JNICALL
 243 JVM_EnableCompiler(JNIEnv *env, jclass compCls);
 244 
 245 JNIEXPORT void JNICALL
 246 JVM_DisableCompiler(JNIEnv *env, jclass compCls);
 247 
 248 /*
 249  * java.lang.Thread
 250  */
 251 JNIEXPORT void JNICALL
 252 JVM_StartThread(JNIEnv *env, jobject thread);
 253 
 254 JNIEXPORT void JNICALL
 255 JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
 256 
 257 JNIEXPORT jboolean JNICALL
 258 JVM_IsThreadAlive(JNIEnv *env, jobject thread);
 259 
 260 JNIEXPORT void JNICALL
 261 JVM_SuspendThread(JNIEnv *env, jobject thread);
 262 
 263 JNIEXPORT void JNICALL
 264 JVM_ResumeThread(JNIEnv *env, jobject thread);
 265 
 266 JNIEXPORT void JNICALL
 267 JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
 268 


 314 
 315 JNIEXPORT jint JNICALL
 316 JVM_ClassDepth(JNIEnv *env, jstring name);
 317 
 318 JNIEXPORT jint JNICALL
 319 JVM_ClassLoaderDepth(JNIEnv *env);
 320 
 321 /*
 322  * java.lang.Package
 323  */
 324 JNIEXPORT jstring JNICALL
 325 JVM_GetSystemPackage(JNIEnv *env, jstring name);
 326 
 327 JNIEXPORT jobjectArray JNICALL
 328 JVM_GetSystemPackages(JNIEnv *env);
 329 
 330 /*
 331  * java.io.ObjectInputStream
 332  */
 333 JNIEXPORT jobject JNICALL
 334 JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass,
 335                       jclass initClass);
 336 
 337 JNIEXPORT jobject JNICALL
 338 JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass,
 339                      jint length);
 340 
 341 JNIEXPORT jobject JNICALL
 342 JVM_LatestUserDefinedLoader(JNIEnv *env);
 343 
 344 /*
 345  * This function has been deprecated and should not be considered
 346  * part of the specified JVM interface.
 347  */
 348 JNIEXPORT jclass JNICALL
 349 JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass,
 350                jstring currClassName);
 351 
 352 /*
 353  * java.lang.reflect.Array
 354  */
 355 JNIEXPORT jint JNICALL
 356 JVM_GetArrayLength(JNIEnv *env, jobject arr);
 357 
 358 JNIEXPORT jobject JNICALL
 359 JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
 360 
 361 JNIEXPORT jvalue JNICALL
 362 JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
 363 
 364 JNIEXPORT void JNICALL
 365 JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
 366 
 367 JNIEXPORT void JNICALL
 368 JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
 369                              unsigned char vCode);
 370 
 371 JNIEXPORT jobject JNICALL
 372 JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);


 382 
 383 /*
 384  * Returns the class in which the code invoking the native method
 385  * belongs.
 386  *
 387  * Note that in JDK 1.1, native methods did not create a frame.
 388  * In 1.2, they do. Therefore native methods like Class.forName
 389  * can no longer look at the current frame for the caller class.
 390  */
 391 JNIEXPORT jclass JNICALL
 392 JVM_GetCallerClass(JNIEnv *env, int n);
 393 
 394 /*
 395  * Find primitive classes
 396  * utf: class name
 397  */
 398 JNIEXPORT jclass JNICALL
 399 JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
 400 
 401 /*
 402  * Link the class
 403  */
 404 JNIEXPORT void JNICALL
 405 JVM_ResolveClass(JNIEnv *env, jclass cls);
 406 
 407 /*
 408  * Find a class from a given class loader. Throw ClassNotFoundException
 409  * or NoClassDefFoundError depending on the value of the last
 410  * argument.
 411  */
 412 JNIEXPORT jclass JNICALL
 413 JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
 414                              jobject loader, jboolean throwError);
 415 
 416 /*
 417  * Find a class from a boot class loader. Returns NULL if class not found.
 418  */
 419 JNIEXPORT jclass JNICALL
 420 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
 421 
 422 /*
 423  * Find a class from a given class.
 424  */
 425 JNIEXPORT jclass JNICALL
 426 JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
 427                              jclass from);


 482 
 483 JNIEXPORT jint JNICALL
 484 JVM_GetClassModifiers(JNIEnv *env, jclass cls);
 485 
 486 JNIEXPORT jobjectArray JNICALL
 487 JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
 488 
 489 JNIEXPORT jclass JNICALL
 490 JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
 491 
 492 /* Generics support (JDK 1.5) */
 493 JNIEXPORT jstring JNICALL
 494 JVM_GetClassSignature(JNIEnv *env, jclass cls);
 495 
 496 /* Annotations support (JDK 1.5) */
 497 JNIEXPORT jbyteArray JNICALL
 498 JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
 499 
 500 /* Annotations support (JDK 1.6) */
 501 
 502 // field is a handle to a java.lang.reflect.Field object
 503 JNIEXPORT jbyteArray JNICALL
 504 JVM_GetFieldAnnotations(JNIEnv *env, jobject field);
 505 
 506 // method is a handle to a java.lang.reflect.Method object
 507 JNIEXPORT jbyteArray JNICALL
 508 JVM_GetMethodAnnotations(JNIEnv *env, jobject method);
 509 
 510 // method is a handle to a java.lang.reflect.Method object
 511 JNIEXPORT jbyteArray JNICALL
 512 JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method);
 513 
 514 // method is a handle to a java.lang.reflect.Method object
 515 JNIEXPORT jbyteArray JNICALL
 516 JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method);
 517 
 518 /* Type use annotations support (JDK 1.8) */
 519 
 520 JNIEXPORT jbyteArray JNICALL
 521 JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
 522 
 523 // field is a handle to a java.lang.reflect.Field object
 524 JNIEXPORT jbyteArray JNICALL
 525 JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
 526 
 527 // method is a handle to a java.lang.reflect.Method object
 528 JNIEXPORT jbyteArray JNICALL
 529 JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
 530 
 531 /*
 532  * New (JDK 1.4) reflection implementation
 533  */
 534 
 535 JNIEXPORT jobjectArray JNICALL
 536 JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 537 


 630 JVM_FindSignal(const char *name);
 631 
 632 /*
 633  * Retrieve the assertion directives for the specified class.
 634  */
 635 JNIEXPORT jboolean JNICALL
 636 JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
 637 
 638 /*
 639  * Retrieve the assertion directives from the VM.
 640  */
 641 JNIEXPORT jobject JNICALL
 642 JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
 643 
 644 /*
 645  * java.util.concurrent.atomic.AtomicLong
 646  */
 647 JNIEXPORT jboolean JNICALL
 648 JVM_SupportsCX8(void);
 649 
 650 JNIEXPORT jboolean JNICALL
 651 JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fldID, jlong oldVal, jlong newVal);
 652 
 653 /*
 654  * com.sun.dtrace.jsdt support
 655  */
 656 
 657 #define JVM_TRACING_DTRACE_VERSION 1
 658 
 659 /*
 660  * Structure to pass one probe description to JVM.
 661  *
 662  * The VM will overwrite the definition of the referenced method with
 663  * code that will fire the probe.
 664  */
 665 typedef struct {
 666     jmethodID method;
 667     jstring   function;
 668     jstring   name;
 669     void*     reserved[4];     // for future use
 670 } JVM_DTraceProbe;
 671 
 672 /**


1213                                          JVM_ACC_BRIDGE | \
1214                                          JVM_ACC_VARARGS | \
1215                                          JVM_ACC_NATIVE | \
1216                                          JVM_ACC_ABSTRACT | \
1217                                          JVM_ACC_STRICT | \
1218                                          JVM_ACC_SYNTHETIC)
1219 
1220 /*
1221  * This is the function defined in libjava.so to perform path
1222  * canonicalization. VM call this function before opening jar files
1223  * to load system classes.
1224  *
1225  */
1226 
1227 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
1228 
1229 /*************************************************************************
1230  PART 3: I/O and Network Support
1231  ************************************************************************/
1232 
1233 /* Note that the JVM IO functions are expected to return JVM_IO_ERR
1234  * when there is any kind of error. The caller can then use the
1235  * platform specific support (e.g., errno) to get the detailed
1236  * error info.  The JVM_GetLastErrorString procedure may also be used
1237  * to obtain a descriptive error string.
1238  */
1239 #define JVM_IO_ERR  (-1)
1240 
1241 /* For interruptible IO. Returning JVM_IO_INTR indicates that an IO
1242  * operation has been disrupted by Thread.interrupt. There are a
1243  * number of technical difficulties related to interruptible IO that
1244  * need to be solved. For example, most existing programs do not handle
1245  * InterruptedIOExceptions specially, they simply treat those as any
1246  * IOExceptions, which typically indicate fatal errors.
1247  *
1248  * There are also two modes of operation for interruptible IO. In the
1249  * resumption mode, an interrupted IO operation is guaranteed not to
1250  * have any side-effects, and can be restarted. In the termination mode,
1251  * an interrupted IO operation corrupts the underlying IO stream, so
1252  * that the only reasonable operation on an interrupted stream is to
1253  * close that stream. The resumption mode seems to be impossible to
1254  * implement on Win32 and Solaris. Implementing the termination mode is
1255  * easier, but it's not clear that's the right semantics.
1256  *
1257  * Interruptible IO is not supported on Win32.It can be enabled/disabled
1258  * using a compile-time flag on Solaris. Third-party JVM ports do not
1259  * need to implement interruptible IO.
1260  */
1261 #define JVM_IO_INTR (-2)
1262 
1263 /* Write a string into the given buffer, in the platform's local encoding,
1264  * that describes the most recent system-level error to occur in this thread.
1265  * Return the length of the string or zero if no error occurred.
1266  */
1267 JNIEXPORT jint JNICALL
1268 JVM_GetLastErrorString(char *buf, int len);
1269 
1270 /*
1271  * Convert a pathname into native format.  This function does syntactic
1272  * cleanup, such as removing redundant separator characters.  It modifies
1273  * the given pathname string in place.
1274  */
1275 JNIEXPORT char * JNICALL
1276 JVM_NativePath(char *);
1277 
1278 /*
1279  * JVM I/O error codes
1280  */
1281 #define JVM_EEXIST       -100
1282 
1283 /*
1284  * Open a file descriptor. This function returns a negative error code
1285  * on error, and a non-negative integer that is the file descriptor on
1286  * success.
1287  */
1288 JNIEXPORT jint JNICALL
1289 JVM_Open(const char *fname, jint flags, jint mode);
1290 
1291 /*
1292  * Close a file descriptor. This function returns -1 on error, and 0
1293  * on success.
1294  *
1295  * fd        the file descriptor to close.
1296  */
1297 JNIEXPORT jint JNICALL
1298 JVM_Close(jint fd);
1299 
1300 /*
1301  * Read data from a file decriptor into a char array.
1302  *
1303  * fd        the file descriptor to read from.
1304  * buf       the buffer where to put the read data.
1305  * nbytes    the number of bytes to read.
1306  *
1307  * This function returns -1 on error, and 0 on success.
1308  */
1309 JNIEXPORT jint JNICALL
1310 JVM_Read(jint fd, char *buf, jint nbytes);
1311 
1312 /*
1313  * Write data from a char array to a file decriptor.
1314  *
1315  * fd        the file descriptor to read from.
1316  * buf       the buffer from which to fetch the data.
1317  * nbytes    the number of bytes to write.
1318  *
1319  * This function returns -1 on error, and 0 on success.
1320  */
1321 JNIEXPORT jint JNICALL
1322 JVM_Write(jint fd, char *buf, jint nbytes);
1323 
1324 /*
1325  * Returns the number of bytes available for reading from a given file
1326  * descriptor
1327  */
1328 JNIEXPORT jint JNICALL
1329 JVM_Available(jint fd, jlong *pbytes);
1330 
1331 /*
1332  * Move the file descriptor pointer from whence by offset.
1333  *
1334  * fd        the file descriptor to move.
1335  * offset    the number of bytes to move it by.
1336  * whence    the start from where to move it.
1337  *
1338  * This function returns the resulting pointer location.
1339  */
1340 JNIEXPORT jlong JNICALL
1341 JVM_Lseek(jint fd, jlong offset, jint whence);
1342 
1343 /*
1344  * Set the length of the file associated with the given descriptor to the given
1345  * length.  If the new length is longer than the current length then the file
1346  * is extended; the contents of the extended portion are not defined.  The
1347  * value of the file pointer is undefined after this procedure returns.
1348  */
1349 JNIEXPORT jint JNICALL
1350 JVM_SetLength(jint fd, jlong length);
1351 
1352 /*
1353  * Synchronize the file descriptor's in memory state with that of the
1354  * physical device.  Return of -1 is an error, 0 is OK.
1355  */
1356 JNIEXPORT jint JNICALL
1357 JVM_Sync(jint fd);
1358 
1359 /*
1360  * Networking library support
1361  */
1362 
1363 JNIEXPORT jint JNICALL
1364 JVM_InitializeSocketLibrary(void);
1365 
1366 struct sockaddr;
1367 
1368 JNIEXPORT jint JNICALL
1369 JVM_Socket(jint domain, jint type, jint protocol);
1370 
1371 JNIEXPORT jint JNICALL
1372 JVM_SocketClose(jint fd);
1373 
1374 JNIEXPORT jint JNICALL
1375 JVM_SocketShutdown(jint fd, jint howto);
1376 
1377 JNIEXPORT jint JNICALL
1378 JVM_Recv(jint fd, char *buf, jint nBytes, jint flags);
1379 
1380 JNIEXPORT jint JNICALL
1381 JVM_Send(jint fd, char *buf, jint nBytes, jint flags);
1382 
1383 JNIEXPORT jint JNICALL
1384 JVM_Timeout(int fd, long timeout);
1385 
1386 JNIEXPORT jint JNICALL
1387 JVM_Listen(jint fd, jint count);
1388 
1389 JNIEXPORT jint JNICALL
1390 JVM_Connect(jint fd, struct sockaddr *him, jint len);
1391 
1392 JNIEXPORT jint JNICALL
1393 JVM_Bind(jint fd, struct sockaddr *him, jint len);
1394 
1395 JNIEXPORT jint JNICALL
1396 JVM_Accept(jint fd, struct sockaddr *him, jint *len);
1397 
1398 JNIEXPORT jint JNICALL
1399 JVM_RecvFrom(jint fd, char *buf, int nBytes,
1400                   int flags, struct sockaddr *from, int *fromlen);
1401 
1402 JNIEXPORT jint JNICALL
1403 JVM_SendTo(jint fd, char *buf, int len,
1404                 int flags, struct sockaddr *to, int tolen);
1405 
1406 JNIEXPORT jint JNICALL
1407 JVM_SocketAvailable(jint fd, jint *result);
1408 
1409 
1410 JNIEXPORT jint JNICALL
1411 JVM_GetSockName(jint fd, struct sockaddr *him, int *len);
1412 
1413 JNIEXPORT jint JNICALL
1414 JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);
1415 
1416 JNIEXPORT jint JNICALL
1417 JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);
1418 
1419 JNIEXPORT int JNICALL
1420 JVM_GetHostName(char* name, int namelen);
1421 
1422 /*
1423  * The standard printing functions supported by the Java VM. (Should they
1424  * be renamed to JVM_* in the future?
1425  */
1426 
1427 /*
1428  * BE CAREFUL! The following functions do not implement the
1429  * full feature set of standard C printf formats.
1430  */
1431 JNIEXPORT int
1432 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
1433 
1434 JNIEXPORT int
1435 jio_snprintf(char *str, size_t count, const char *fmt, ...);
1436 
1437 JNIEXPORT int
1438 jio_fprintf(FILE *, const char *fmt, ...);
1439 
1440 JNIEXPORT int
1441 jio_vfprintf(FILE *, const char *fmt, va_list args);
1442 


1479 JNIEXPORT jobject JNICALL
1480 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
1481 
1482 JNIEXPORT jstring JNICALL
1483 JVM_GetTemporaryDirectory(JNIEnv *env);
1484 
1485 /* Generics reflection support.
1486  *
1487  * Returns information about the given class's EnclosingMethod
1488  * attribute, if present, or null if the class had no enclosing
1489  * method.
1490  *
1491  * If non-null, the returned array contains three elements. Element 0
1492  * is the java.lang.Class of which the enclosing method is a member,
1493  * and elements 1 and 2 are the java.lang.Strings for the enclosing
1494  * method's name and descriptor, respectively.
1495  */
1496 JNIEXPORT jobjectArray JNICALL
1497 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
1498 
1499 /*
1500  * Java thread state support
1501  */
1502 enum {
1503     JAVA_THREAD_STATE_NEW           = 0,
1504     JAVA_THREAD_STATE_RUNNABLE      = 1,
1505     JAVA_THREAD_STATE_BLOCKED       = 2,
1506     JAVA_THREAD_STATE_WAITING       = 3,
1507     JAVA_THREAD_STATE_TIMED_WAITING = 4,
1508     JAVA_THREAD_STATE_TERMINATED    = 5,
1509     JAVA_THREAD_STATE_COUNT         = 6
1510 };
1511 
1512 /*
1513  * Returns an array of the threadStatus values representing the
1514  * given Java thread state.  Returns NULL if the VM version is
1515  * incompatible with the JDK or doesn't support the given
1516  * Java thread state.
1517  */
1518 JNIEXPORT jintArray JNICALL
1519 JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState);
1520 
1521 /*
1522  * Returns an array of the substate names representing the
1523  * given Java thread state.  Returns NULL if the VM version is
1524  * incompatible with the JDK or the VM doesn't support
1525  * the given Java thread state.
1526  * values must be the jintArray returned from JVM_GetThreadStateValues
1527  * and javaThreadState.
1528  */
1529 JNIEXPORT jobjectArray JNICALL
1530 JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
1531 
1532 /* =========================================================================
1533  * The following defines a private JVM interface that the JDK can query
1534  * for the JVM version and capabilities.  sun.misc.Version defines
1535  * the methods for getting the VM version and its capabilities.
1536  *
1537  * When a new bit is added, the following should be updated to provide
1538  * access to the new capability:
1539  *    HS:   JVM_GetVersionInfo and Abstract_VM_Version class
1540  *    SDK:  Version class
1541  *
1542  * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
1543  * JVM to query for the JDK version and capabilities.
1544  *
1545  * When a new bit is added, the following should be updated to provide
1546  * access to the new capability:
1547  *    HS:   JDK_Version class
1548  *    SDK:  JDK_GetVersionInfo0
1549  *
1550  * ==========================================================================
1551  */




 121  */
 122 JNIEXPORT jstring JNICALL
 123 JVM_InternString(JNIEnv *env, jstring str);
 124 
 125 /*
 126  * java.lang.System
 127  */
 128 JNIEXPORT jlong JNICALL
 129 JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored);
 130 
 131 JNIEXPORT jlong JNICALL
 132 JVM_NanoTime(JNIEnv *env, jclass ignored);
 133 
 134 JNIEXPORT void JNICALL
 135 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
 136               jobject dst, jint dst_pos, jint length);
 137 
 138 JNIEXPORT jobject JNICALL
 139 JVM_InitProperties(JNIEnv *env, jobject p);
 140 












 141 JNIEXPORT void JNICALL
 142 JVM_Halt(jint code);
 143 
 144 JNIEXPORT void JNICALL
 145 JVM_GC(void);
 146 
 147 /* Returns the number of real-time milliseconds that have elapsed since the
 148  * least-recently-inspected heap object was last inspected by the garbage
 149  * collector.
 150  *
 151  * For simple stop-the-world collectors this value is just the time
 152  * since the most recent collection.  For generational collectors it is the
 153  * time since the oldest generation was most recently collected.  Other
 154  * collectors are free to return a pessimistic estimate of the elapsed time, or
 155  * simply the time since the last full collection was performed.
 156  *
 157  * Note that in the presence of reference objects, a given object that is no
 158  * longer strongly reachable may have to be inspected multiple times before it
 159  * can be reclaimed.
 160  */
 161 JNIEXPORT jlong JNICALL
 162 JVM_MaxObjectInspectionAge(void);
 163 






 164 JNIEXPORT jlong JNICALL
 165 JVM_TotalMemory(void);
 166 
 167 JNIEXPORT jlong JNICALL
 168 JVM_FreeMemory(void);
 169 
 170 JNIEXPORT jlong JNICALL
 171 JVM_MaxMemory(void);
 172 
 173 JNIEXPORT jint JNICALL
 174 JVM_ActiveProcessorCount(void);
 175 
 176 JNIEXPORT void * JNICALL
 177 JVM_LoadLibrary(const char *name);
 178 
 179 JNIEXPORT void JNICALL
 180 JVM_UnloadLibrary(void * handle);
 181 
 182 JNIEXPORT void * JNICALL
 183 JVM_FindLibraryEntry(void *handle, const char *name);
 184 
 185 JNIEXPORT jboolean JNICALL
 186 JVM_IsSupportedJNIVersion(jint version);
 187 
 188 /*






 189  * java.lang.Throwable
 190  */
 191 JNIEXPORT void JNICALL
 192 JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
 193 
 194 JNIEXPORT jint JNICALL
 195 JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
 196 
 197 JNIEXPORT jobject JNICALL
 198 JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index);
 199 
 200 /*
























 201  * java.lang.Thread
 202  */
 203 JNIEXPORT void JNICALL
 204 JVM_StartThread(JNIEnv *env, jobject thread);
 205 
 206 JNIEXPORT void JNICALL
 207 JVM_StopThread(JNIEnv *env, jobject thread, jobject exception);
 208 
 209 JNIEXPORT jboolean JNICALL
 210 JVM_IsThreadAlive(JNIEnv *env, jobject thread);
 211 
 212 JNIEXPORT void JNICALL
 213 JVM_SuspendThread(JNIEnv *env, jobject thread);
 214 
 215 JNIEXPORT void JNICALL
 216 JVM_ResumeThread(JNIEnv *env, jobject thread);
 217 
 218 JNIEXPORT void JNICALL
 219 JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio);
 220 


 266 
 267 JNIEXPORT jint JNICALL
 268 JVM_ClassDepth(JNIEnv *env, jstring name);
 269 
 270 JNIEXPORT jint JNICALL
 271 JVM_ClassLoaderDepth(JNIEnv *env);
 272 
 273 /*
 274  * java.lang.Package
 275  */
 276 JNIEXPORT jstring JNICALL
 277 JVM_GetSystemPackage(JNIEnv *env, jstring name);
 278 
 279 JNIEXPORT jobjectArray JNICALL
 280 JVM_GetSystemPackages(JNIEnv *env);
 281 
 282 /*
 283  * java.io.ObjectInputStream
 284  */
 285 JNIEXPORT jobject JNICALL








 286 JVM_LatestUserDefinedLoader(JNIEnv *env);
 287 
 288 /*








 289  * java.lang.reflect.Array
 290  */
 291 JNIEXPORT jint JNICALL
 292 JVM_GetArrayLength(JNIEnv *env, jobject arr);
 293 
 294 JNIEXPORT jobject JNICALL
 295 JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index);
 296 
 297 JNIEXPORT jvalue JNICALL
 298 JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode);
 299 
 300 JNIEXPORT void JNICALL
 301 JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val);
 302 
 303 JNIEXPORT void JNICALL
 304 JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v,
 305                              unsigned char vCode);
 306 
 307 JNIEXPORT jobject JNICALL
 308 JVM_NewArray(JNIEnv *env, jclass eltClass, jint length);


 318 
 319 /*
 320  * Returns the class in which the code invoking the native method
 321  * belongs.
 322  *
 323  * Note that in JDK 1.1, native methods did not create a frame.
 324  * In 1.2, they do. Therefore native methods like Class.forName
 325  * can no longer look at the current frame for the caller class.
 326  */
 327 JNIEXPORT jclass JNICALL
 328 JVM_GetCallerClass(JNIEnv *env, int n);
 329 
 330 /*
 331  * Find primitive classes
 332  * utf: class name
 333  */
 334 JNIEXPORT jclass JNICALL
 335 JVM_FindPrimitiveClass(JNIEnv *env, const char *utf);
 336 
 337 /*






 338  * Find a class from a given class loader. Throw ClassNotFoundException
 339  * or NoClassDefFoundError depending on the value of the last
 340  * argument.
 341  */
 342 JNIEXPORT jclass JNICALL
 343 JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init,
 344                              jobject loader, jboolean throwError);
 345 
 346 /*
 347  * Find a class from a boot class loader. Returns NULL if class not found.
 348  */
 349 JNIEXPORT jclass JNICALL
 350 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
 351 
 352 /*
 353  * Find a class from a given class.
 354  */
 355 JNIEXPORT jclass JNICALL
 356 JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init,
 357                              jclass from);


 412 
 413 JNIEXPORT jint JNICALL
 414 JVM_GetClassModifiers(JNIEnv *env, jclass cls);
 415 
 416 JNIEXPORT jobjectArray JNICALL
 417 JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
 418 
 419 JNIEXPORT jclass JNICALL
 420 JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
 421 
 422 /* Generics support (JDK 1.5) */
 423 JNIEXPORT jstring JNICALL
 424 JVM_GetClassSignature(JNIEnv *env, jclass cls);
 425 
 426 /* Annotations support (JDK 1.5) */
 427 JNIEXPORT jbyteArray JNICALL
 428 JVM_GetClassAnnotations(JNIEnv *env, jclass cls);
 429 
 430 /* Annotations support (JDK 1.6) */
 431 
















 432 /* Type use annotations support (JDK 1.8) */
 433 
 434 JNIEXPORT jbyteArray JNICALL
 435 JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
 436 
 437 // field is a handle to a java.lang.reflect.Field object
 438 JNIEXPORT jbyteArray JNICALL
 439 JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field);
 440 
 441 // method is a handle to a java.lang.reflect.Method object
 442 JNIEXPORT jbyteArray JNICALL
 443 JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method);
 444 
 445 /*
 446  * New (JDK 1.4) reflection implementation
 447  */
 448 
 449 JNIEXPORT jobjectArray JNICALL
 450 JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly);
 451 


 544 JVM_FindSignal(const char *name);
 545 
 546 /*
 547  * Retrieve the assertion directives for the specified class.
 548  */
 549 JNIEXPORT jboolean JNICALL
 550 JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);
 551 
 552 /*
 553  * Retrieve the assertion directives from the VM.
 554  */
 555 JNIEXPORT jobject JNICALL
 556 JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);
 557 
 558 /*
 559  * java.util.concurrent.atomic.AtomicLong
 560  */
 561 JNIEXPORT jboolean JNICALL
 562 JVM_SupportsCX8(void);
 563 



 564 /*
 565  * com.sun.dtrace.jsdt support
 566  */
 567 
 568 #define JVM_TRACING_DTRACE_VERSION 1
 569 
 570 /*
 571  * Structure to pass one probe description to JVM.
 572  *
 573  * The VM will overwrite the definition of the referenced method with
 574  * code that will fire the probe.
 575  */
 576 typedef struct {
 577     jmethodID method;
 578     jstring   function;
 579     jstring   name;
 580     void*     reserved[4];     // for future use
 581 } JVM_DTraceProbe;
 582 
 583 /**


1124                                          JVM_ACC_BRIDGE | \
1125                                          JVM_ACC_VARARGS | \
1126                                          JVM_ACC_NATIVE | \
1127                                          JVM_ACC_ABSTRACT | \
1128                                          JVM_ACC_STRICT | \
1129                                          JVM_ACC_SYNTHETIC)
1130 
1131 /*
1132  * This is the function defined in libjava.so to perform path
1133  * canonicalization. VM call this function before opening jar files
1134  * to load system classes.
1135  *
1136  */
1137 
1138 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len);
1139 
1140 /*************************************************************************
1141  PART 3: I/O and Network Support
1142  ************************************************************************/
1143 





































1144 /*
1145  * Convert a pathname into native format.  This function does syntactic
1146  * cleanup, such as removing redundant separator characters.  It modifies
1147  * the given pathname string in place.
1148  */
1149 JNIEXPORT char * JNICALL
1150 JVM_NativePath(char *);
1151 
1152 /*
















































































































































1153  * The standard printing functions supported by the Java VM. (Should they
1154  * be renamed to JVM_* in the future?
1155  */
1156 
1157 /*
1158  * BE CAREFUL! The following functions do not implement the
1159  * full feature set of standard C printf formats.
1160  */
1161 JNIEXPORT int
1162 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
1163 
1164 JNIEXPORT int
1165 jio_snprintf(char *str, size_t count, const char *fmt, ...);
1166 
1167 JNIEXPORT int
1168 jio_fprintf(FILE *, const char *fmt, ...);
1169 
1170 JNIEXPORT int
1171 jio_vfprintf(FILE *, const char *fmt, va_list args);
1172 


1209 JNIEXPORT jobject JNICALL
1210 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
1211 
1212 JNIEXPORT jstring JNICALL
1213 JVM_GetTemporaryDirectory(JNIEnv *env);
1214 
1215 /* Generics reflection support.
1216  *
1217  * Returns information about the given class's EnclosingMethod
1218  * attribute, if present, or null if the class had no enclosing
1219  * method.
1220  *
1221  * If non-null, the returned array contains three elements. Element 0
1222  * is the java.lang.Class of which the enclosing method is a member,
1223  * and elements 1 and 2 are the java.lang.Strings for the enclosing
1224  * method's name and descriptor, respectively.
1225  */
1226 JNIEXPORT jobjectArray JNICALL
1227 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
1228 

































1229 /* =========================================================================
1230  * The following defines a private JVM interface that the JDK can query
1231  * for the JVM version and capabilities.  sun.misc.Version defines
1232  * the methods for getting the VM version and its capabilities.
1233  *
1234  * When a new bit is added, the following should be updated to provide
1235  * access to the new capability:
1236  *    HS:   JVM_GetVersionInfo and Abstract_VM_Version class
1237  *    SDK:  Version class
1238  *
1239  * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
1240  * JVM to query for the JDK version and capabilities.
1241  *
1242  * When a new bit is added, the following should be updated to provide
1243  * access to the new capability:
1244  *    HS:   JDK_Version class
1245  *    SDK:  JDK_GetVersionInfo0
1246  *
1247  * ==========================================================================
1248  */


< prev index next >