Mercurial > hg > graal-compiler
annotate src/share/vm/services/jmm.h @ 2142:8012aa3ccede
4926272: methodOopDesc::method_from_bcp is unsafe
Reviewed-by: coleenp, jrose, kvn, dcubed
author | never |
---|---|
date | Thu, 13 Jan 2011 22:15:41 -0800 |
parents | b1a2afa37ec4 |
children | 78542e2b5e35 |
rev | line source |
---|---|
0 | 1 /* |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
0 | 8 * particular file as subject to the "Classpath" exception as provided |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
0 | 10 * |
11 * This code is distributed in the hope that it will be useful, but WITHOUT | |
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 * version 2 for more details (a copy is included in the LICENSE file that | |
15 * accompanied this code). | |
16 * | |
17 * You should have received a copy of the GNU General Public License version | |
18 * 2 along with this work; if not, write to the Free Software Foundation, | |
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
20 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
23 * questions. |
0 | 24 */ |
25 | |
26 #ifndef _JAVA_JMM_H_ | |
27 #define _JAVA_JMM_H_ | |
28 | |
29 /* | |
30 * This is a private interface used by JDK for JVM monitoring | |
31 * and management. | |
32 * | |
33 * Bump the version number when either of the following happens: | |
34 * | |
35 * 1. There is a change in functions in JmmInterface. | |
36 * | |
37 * 2. There is a change in the contract between VM and Java classes. | |
38 */ | |
39 | |
40 #include "jni.h" | |
41 | |
42 #ifdef __cplusplus | |
43 extern "C" { | |
44 #endif | |
45 | |
46 enum { | |
47 JMM_VERSION_1 = 0x20010000, | |
48 JMM_VERSION_1_0 = 0x20010000, | |
49 JMM_VERSION_1_1 = 0x20010100, // JDK 6 | |
50 JMM_VERSION_1_2 = 0x20010200, // JDK 7 | |
51 JMM_VERSION = 0x20010200 | |
52 }; | |
53 | |
54 typedef struct { | |
55 unsigned int isLowMemoryDetectionSupported : 1; | |
56 unsigned int isCompilationTimeMonitoringSupported : 1; | |
57 unsigned int isThreadContentionMonitoringSupported : 1; | |
58 unsigned int isCurrentThreadCpuTimeSupported : 1; | |
59 unsigned int isOtherThreadCpuTimeSupported : 1; | |
60 unsigned int isBootClassPathSupported : 1; | |
61 unsigned int isObjectMonitorUsageSupported : 1; | |
62 unsigned int isSynchronizerUsageSupported : 1; | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
63 unsigned int isThreadAllocatedMemorySupported : 1; |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
64 unsigned int : 23; |
0 | 65 } jmmOptionalSupport; |
66 | |
67 typedef enum { | |
68 JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */ | |
69 JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */ | |
70 JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */ | |
71 JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */ | |
72 JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */ | |
73 JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */ | |
74 JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */ | |
75 JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */ | |
76 JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */ | |
77 JMM_GC_COUNT = 10, /* Total number of collections */ | |
78 | |
79 JMM_INTERNAL_ATTRIBUTE_INDEX = 100, | |
80 JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ | |
81 JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */ | |
82 JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */ | |
83 JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */ | |
84 JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */ | |
85 JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */ | |
86 JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */ | |
87 JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */ | |
88 JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */ | |
89 JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */ | |
90 JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */ | |
91 JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */ | |
92 JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */ | |
93 JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */ | |
94 JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */ | |
95 JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */ | |
96 JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */ | |
97 | |
98 JMM_OS_ATTRIBUTE_INDEX = 200, | |
99 JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */ | |
100 JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */ | |
101 | |
102 JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */ | |
103 } jmmLongAttribute; | |
104 | |
105 typedef enum { | |
106 JMM_VERBOSE_GC = 21, | |
107 JMM_VERBOSE_CLASS = 22, | |
108 JMM_THREAD_CONTENTION_MONITORING = 23, | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
109 JMM_THREAD_CPU_TIME = 24, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
110 JMM_THREAD_ALLOCATED_MEMORY = 25 |
0 | 111 } jmmBoolAttribute; |
112 | |
113 | |
114 enum { | |
115 JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000, | |
116 JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000 | |
117 }; | |
118 | |
119 #define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000 | |
120 | |
121 typedef enum { | |
122 JMM_STAT_PEAK_THREAD_COUNT = 801, | |
123 JMM_STAT_THREAD_CONTENTION_COUNT = 802, | |
124 JMM_STAT_THREAD_CONTENTION_TIME = 803, | |
125 JMM_STAT_THREAD_CONTENTION_STAT = 804, | |
126 JMM_STAT_PEAK_POOL_USAGE = 805, | |
127 JMM_STAT_GC_STAT = 806 | |
128 } jmmStatisticType; | |
129 | |
130 typedef enum { | |
131 JMM_USAGE_THRESHOLD_HIGH = 901, | |
132 JMM_USAGE_THRESHOLD_LOW = 902, | |
133 JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903, | |
134 JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904 | |
135 } jmmThresholdType; | |
136 | |
137 /* Should match what is allowed in globals.hpp */ | |
138 typedef enum { | |
139 JMM_VMGLOBAL_TYPE_UNKNOWN = 0, | |
140 JMM_VMGLOBAL_TYPE_JBOOLEAN = 1, | |
141 JMM_VMGLOBAL_TYPE_JSTRING = 2, | |
142 JMM_VMGLOBAL_TYPE_JLONG = 3 | |
143 } jmmVMGlobalType; | |
144 | |
145 typedef enum { | |
146 JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */ | |
147 JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */ | |
148 JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */ | |
149 JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */ | |
150 JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */ | |
151 JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */ | |
152 JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */ | |
153 } jmmVMGlobalOrigin; | |
154 | |
155 typedef struct { | |
156 jstring name; | |
157 jvalue value; | |
158 jmmVMGlobalType type; /* Data type */ | |
159 jmmVMGlobalOrigin origin; /* Default or non-default value */ | |
160 unsigned int writeable : 1; /* dynamically writeable */ | |
161 unsigned int external : 1; /* external supported interface */ | |
162 unsigned int reserved : 30; | |
163 void *reserved1; | |
164 void *reserved2; | |
165 } jmmVMGlobal; | |
166 | |
167 typedef struct { | |
168 const char* name; | |
169 char type; | |
170 const char* description; | |
171 } jmmExtAttributeInfo; | |
172 | |
173 /* Caller has to set the following fields before calling GetLastGCStat | |
174 * o usage_before_gc - array of MemoryUsage objects | |
175 * o usage_after_gc - array of MemoryUsage objects | |
176 * o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array | |
177 * o gc_ext_attribtue_values - array of jvalues | |
178 */ | |
179 typedef struct { | |
180 jlong gc_index; /* Index of the collections */ | |
181 jlong start_time; /* Start time of the GC */ | |
182 jlong end_time; /* End time of the GC */ | |
183 jobjectArray usage_before_gc; /* Memory usage array before GC */ | |
184 jobjectArray usage_after_gc; /* Memory usage array after GC */ | |
185 jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */ | |
186 jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */ | |
187 jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */ | |
188 /* -1 indicates gc_ext_attribute_values is not big enough */ | |
189 } jmmGCStat; | |
190 | |
191 typedef struct jmmInterface_1_ { | |
192 void* reserved1; | |
193 void* reserved2; | |
194 | |
195 jint (JNICALL *GetVersion) (JNIEnv *env); | |
196 | |
197 jint (JNICALL *GetOptionalSupport) (JNIEnv *env, | |
198 jmmOptionalSupport* support_ptr); | |
199 | |
200 /* This is used by JDK 6 and earlier. | |
201 * For JDK 7 and after, use GetInputArgumentArray. | |
202 */ | |
203 jobject (JNICALL *GetInputArguments) (JNIEnv *env); | |
204 | |
205 jint (JNICALL *GetThreadInfo) (JNIEnv *env, | |
206 jlongArray ids, | |
207 jint maxDepth, | |
208 jobjectArray infoArray); | |
209 jobjectArray (JNICALL *GetInputArgumentArray) (JNIEnv *env); | |
210 | |
211 jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr); | |
212 | |
213 jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool); | |
214 | |
215 jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool); | |
216 jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool); | |
217 | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
218 void (JNICALL *GetThreadAllocatedMemory) |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
219 (JNIEnv *env, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
220 jlongArray ids, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
221 jlongArray sizeArray); |
0 | 222 |
223 jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap); | |
224 | |
225 jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att); | |
226 jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att); | |
227 jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag); | |
228 | |
229 jint (JNICALL *GetLongAttributes) (JNIEnv *env, | |
230 jobject obj, | |
231 jmmLongAttribute* atts, | |
232 jint count, | |
233 jlong* result); | |
234 | |
235 jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env); | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
236 |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
237 // Not used in JDK 6 or JDK 7 |
0 | 238 jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id); |
239 | |
240 jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env); | |
241 jint (JNICALL *GetVMGlobals) (JNIEnv *env, | |
242 jobjectArray names, | |
243 jmmVMGlobal *globals, | |
244 jint count); | |
245 | |
246 jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env, | |
247 jobjectArray names, | |
248 jlongArray times); | |
249 | |
250 jboolean (JNICALL *ResetStatistic) (JNIEnv *env, | |
251 jvalue obj, | |
252 jmmStatisticType type); | |
253 | |
254 void (JNICALL *SetPoolSensor) (JNIEnv *env, | |
255 jobject pool, | |
256 jmmThresholdType type, | |
257 jobject sensor); | |
258 | |
259 jlong (JNICALL *SetPoolThreshold) (JNIEnv *env, | |
260 jobject pool, | |
261 jmmThresholdType type, | |
262 jlong threshold); | |
263 jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool); | |
264 | |
265 jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env, | |
266 jobject mgr, | |
267 jmmExtAttributeInfo *ext_info, | |
268 jint count); | |
269 void (JNICALL *GetLastGCStat) (JNIEnv *env, | |
270 jobject mgr, | |
271 jmmGCStat *gc_stat); | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
272 |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
273 jlong (JNICALL *GetThreadCpuTimeWithKind) |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
274 (JNIEnv *env, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
275 jlong thread_id, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
276 jboolean user_sys_cpu_time); |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
277 void (JNICALL *GetThreadCpuTimesWithKind) |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
278 (JNIEnv *env, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
279 jlongArray ids, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
280 jlongArray timeArray, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
281 jboolean user_sys_cpu_time); |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
282 |
0 | 283 jint (JNICALL *DumpHeap0) (JNIEnv *env, |
284 jstring outputfile, | |
285 jboolean live); | |
2100
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
286 jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env, |
b1a2afa37ec4
7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents:
1972
diff
changeset
|
287 jboolean object_monitors_only); |
0 | 288 void (JNICALL *SetVMGlobal) (JNIEnv *env, |
289 jstring flag_name, | |
290 jvalue new_value); | |
291 void* reserved6; | |
292 jobjectArray (JNICALL *DumpThreads) (JNIEnv *env, | |
293 jlongArray ids, | |
294 jboolean lockedMonitors, | |
295 jboolean lockedSynchronizers); | |
296 } JmmInterface; | |
297 | |
298 #ifdef __cplusplus | |
299 } /* extern "C" */ | |
300 #endif /* __cplusplus */ | |
301 | |
302 #endif /* !_JAVA_JMM_H_ */ |