32 #include "jvm_md.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39 * This file contains additional functions exported from the VM.
40 * These functions are complementary to the standard JNI support.
41 * There are three parts to this file:
42 *
43 * First, this file contains the VM-related functions needed by native
44 * libraries in the standard Java API. For example, the java.lang.Object
45 * class needs VM-level functions that wait for and notify monitors.
46 *
47 * Second, this file contains the functions and constant definitions
48 * needed by the byte code verifier and class file format checker.
49 * These functions allow the verifier and format checker to be written
50 * in a VM-independent way.
51 *
52 * Third, this file contains various I/O and nerwork operations needed
53 * by the standard Java I/O and network APIs.
54 */
55
56 /*
57 * Bump the version number when either of the following happens:
58 *
59 * 1. There is a change in JVM_* functions.
60 *
61 * 2. There is a change in the contract between VM and Java classes.
62 * For example, if the VM relies on a new private field in Thread
63 * class.
64 */
65
66 #define JVM_INTERFACE_VERSION 4
67
68 JNIEXPORT jint JNICALL
69 JVM_GetInterfaceVersion(void);
70
71 /*************************************************************************
72 PART 1: Functions for Native Libraries
1110 * The following defines a private JVM interface that the JDK can query
1111 * for the JVM version and capabilities. sun.misc.Version defines
1112 * the methods for getting the VM version and its capabilities.
1113 *
1114 * When a new bit is added, the following should be updated to provide
1115 * access to the new capability:
1116 * HS: JVM_GetVersionInfo and Abstract_VM_Version class
1117 * SDK: Version class
1118 *
1119 * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
1120 * JVM to query for the JDK version and capabilities.
1121 *
1122 * When a new bit is added, the following should be updated to provide
1123 * access to the new capability:
1124 * HS: JDK_Version class
1125 * SDK: JDK_GetVersionInfo0
1126 *
1127 * ==========================================================================
1128 */
1129 typedef struct {
1130 /* Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx */
1131 unsigned int jvm_version; /* Consists of major, minor, micro (n.n.n) */
1132 /* and build number (xx) */
1133 unsigned int update_version : 8; /* Update release version (uu) */
1134 unsigned int special_update_version : 8; /* Special update release version (c)*/
1135 unsigned int reserved1 : 16;
1136 unsigned int reserved2;
1137
1138 /* The following bits represents JVM supports that JDK has dependency on.
1139 * JDK can use these bits to determine which JVM version
1140 * and support it has to maintain runtime compatibility.
1141 *
1142 * When a new bit is added in a minor or update release, make sure
1143 * the new bit is also added in the main/baseline.
1144 */
1145 unsigned int is_attach_supported : 1;
1146 unsigned int : 31;
1147 unsigned int : 32;
1148 unsigned int : 32;
1149 } jvm_version_info;
1150
1151 #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1152 #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1153 #define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
1154
1155 /* Build number is available only for RE builds.
1156 * It will be zero for internal builds.
1157 */
1158 #define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
1159
1160 JNIEXPORT void JNICALL
1161 JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
1162
1163 typedef struct {
1164 // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
1165 unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */
1166 /* and build number (xx) */
1167 unsigned int update_version : 8; /* Update release version (uu) */
1168 unsigned int special_update_version : 8; /* Special update release version (c)*/
1169 unsigned int reserved1 : 16;
1170 unsigned int reserved2;
1171
1172 /* The following bits represents new JDK supports that VM has dependency on.
1173 * VM implementation can use these bits to determine which JDK version
1174 * and support it has to maintain runtime compatibility.
1175 *
1176 * When a new bit is added in a minor or update release, make sure
1177 * the new bit is also added in the main/baseline.
1178 */
1179 unsigned int thread_park_blocker : 1;
1180 unsigned int post_vm_init_hook_enabled : 1;
1181 unsigned int pending_list_uses_discovered_field : 1;
1182 unsigned int : 29;
1183 unsigned int : 32;
1184 unsigned int : 32;
1185 } jdk_version_info;
1186
1187 #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1188 #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1189 #define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
1190
1191 /* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN)
1192 * It will be zero for internal builds.
1193 */
1194 #define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
1195
1196 /*
1197 * This is the function JDK_GetVersionInfo0 defined in libjava.so
1198 * that is dynamically looked up by JVM.
1199 */
1200 typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
1201
1202 /*
1203 * This structure is used by the launcher to get the default thread
1204 * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
1205 * version of 1.1. As it is not supported otherwise, it has been removed
1206 * from jni.h
1207 */
1208 typedef struct JDK1_1InitArgs {
1209 jint version;
1210
1211 char **properties;
|
32 #include "jvm_md.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39 * This file contains additional functions exported from the VM.
40 * These functions are complementary to the standard JNI support.
41 * There are three parts to this file:
42 *
43 * First, this file contains the VM-related functions needed by native
44 * libraries in the standard Java API. For example, the java.lang.Object
45 * class needs VM-level functions that wait for and notify monitors.
46 *
47 * Second, this file contains the functions and constant definitions
48 * needed by the byte code verifier and class file format checker.
49 * These functions allow the verifier and format checker to be written
50 * in a VM-independent way.
51 *
52 * Third, this file contains various I/O and network operations needed
53 * by the standard Java I/O and network APIs.
54 */
55
56 /*
57 * Bump the version number when either of the following happens:
58 *
59 * 1. There is a change in JVM_* functions.
60 *
61 * 2. There is a change in the contract between VM and Java classes.
62 * For example, if the VM relies on a new private field in Thread
63 * class.
64 */
65
66 #define JVM_INTERFACE_VERSION 4
67
68 JNIEXPORT jint JNICALL
69 JVM_GetInterfaceVersion(void);
70
71 /*************************************************************************
72 PART 1: Functions for Native Libraries
1110 * The following defines a private JVM interface that the JDK can query
1111 * for the JVM version and capabilities. sun.misc.Version defines
1112 * the methods for getting the VM version and its capabilities.
1113 *
1114 * When a new bit is added, the following should be updated to provide
1115 * access to the new capability:
1116 * HS: JVM_GetVersionInfo and Abstract_VM_Version class
1117 * SDK: Version class
1118 *
1119 * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
1120 * JVM to query for the JDK version and capabilities.
1121 *
1122 * When a new bit is added, the following should be updated to provide
1123 * access to the new capability:
1124 * HS: JDK_Version class
1125 * SDK: JDK_GetVersionInfo0
1126 *
1127 * ==========================================================================
1128 */
1129 typedef struct {
1130 unsigned int jvm_version; /* Follows JDK version string as specified by JEP-223 */
1131 unsigned int update_version : 8; /* Update release version (uu) */
1132 unsigned int special_update_version : 8; /* Special update release version (c)*/
1133 unsigned int reserved1 : 16;
1134 unsigned int reserved2;
1135
1136 /* The following bits represents JVM supports that JDK has dependency on.
1137 * JDK can use these bits to determine which JVM version
1138 * and support it has to maintain runtime compatibility.
1139 *
1140 * When a new bit is added in a minor or update release, make sure
1141 * the new bit is also added in the main/baseline.
1142 */
1143 unsigned int is_attach_supported : 1;
1144 unsigned int : 31;
1145 unsigned int : 32;
1146 unsigned int : 32;
1147 } jvm_version_info;
1148
1149 #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1150 #define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1151 #define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
1152
1153 /* Build number is available only for RE builds.
1154 * It will be zero for internal builds.
1155 */
1156 #define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
1157
1158 JNIEXPORT void JNICALL
1159 JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
1160
1161 typedef struct {
1162 unsigned int jdk_version; /* JDK version string as specified by JEP-223 */
1163 unsigned int update_version : 8; /* Update release version (uu) */
1164 unsigned int special_update_version : 8; /* Special update release version (c)*/
1165 unsigned int reserved1 : 16;
1166 unsigned int reserved2;
1167
1168 /* The following bits represents new JDK supports that VM has dependency on.
1169 * VM implementation can use these bits to determine which JDK version
1170 * and support it has to maintain runtime compatibility.
1171 *
1172 * When a new bit is added in a minor or update release, make sure
1173 * the new bit is also added in the main/baseline.
1174 */
1175 unsigned int thread_park_blocker : 1;
1176 unsigned int post_vm_init_hook_enabled : 1;
1177 unsigned int pending_list_uses_discovered_field : 1;
1178 unsigned int : 29;
1179 unsigned int : 32;
1180 unsigned int : 32;
1181 } jdk_version_info;
1182
1183 #define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
1184 #define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
1185 #define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
1186
1187 /* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to NN)
1188 * It will be zero for internal builds.
1189 */
1190 #define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
1191
1192 /*
1193 * This is the function JDK_GetVersionInfo0 defined in libjava.so
1194 * that is dynamically looked up by JVM.
1195 */
1196 typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
1197
1198 /*
1199 * This structure is used by the launcher to get the default thread
1200 * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
1201 * version of 1.1. As it is not supported otherwise, it has been removed
1202 * from jni.h
1203 */
1204 typedef struct JDK1_1InitArgs {
1205 jint version;
1206
1207 char **properties;
|