author | kbarrett |
Tue, 21 Nov 2017 09:47:55 -0500 | |
changeset 48787 | 7638bf98a312 |
parent 47216 | 71c04702a3d5 |
child 50929 | ef57cfcd22ff |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48787
7638bf98a312
8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
package sun.jvm.hotspot.utilities; |
|
26 |
||
27 |
import java.io.*; |
|
28 |
import sun.jvm.hotspot.debugger.*; |
|
48787
7638bf98a312
8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents:
47216
diff
changeset
|
29 |
import sun.jvm.hotspot.gc.shared.OopStorage; |
1 | 30 |
import sun.jvm.hotspot.memory.*; |
31 |
import sun.jvm.hotspot.oops.*; |
|
32 |
import sun.jvm.hotspot.runtime.*; |
|
33 |
||
34 |
/** |
|
35 |
* This is abstract base class for heap graph writers. This class does |
|
36 |
* not assume any file format for the heap graph. It hides heap |
|
37 |
* iteration, object (fields) iteration mechanism from derived |
|
38 |
* classes. This class does not even accept OutputStream etc. so that |
|
39 |
* derived class can construct specific writer/filter from input |
|
40 |
* stream. |
|
41 |
*/ |
|
42 |
||
43 |
public abstract class AbstractHeapGraphWriter implements HeapGraphWriter { |
|
44 |
// the function iterates heap and calls Oop type specific writers |
|
45 |
protected void write() throws IOException { |
|
46 |
SymbolTable symTbl = VM.getVM().getSymbolTable(); |
|
47 |
javaLangClass = symTbl.probe("java/lang/Class"); |
|
48 |
javaLangString = symTbl.probe("java/lang/String"); |
|
49 |
javaLangThread = symTbl.probe("java/lang/Thread"); |
|
50 |
ObjectHeap heap = VM.getVM().getObjectHeap(); |
|
51 |
try { |
|
52 |
heap.iterate(new DefaultHeapVisitor() { |
|
53 |
public void prologue(long usedSize) { |
|
54 |
try { |
|
55 |
writeHeapHeader(); |
|
56 |
} catch (IOException exp) { |
|
57 |
throw new RuntimeException(exp); |
|
58 |
} |
|
59 |
} |
|
60 |
||
61 |
public boolean doObj(Oop oop) { |
|
62 |
try { |
|
20388
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
63 |
writeHeapRecordPrologue(); |
1 | 64 |
if (oop instanceof TypeArray) { |
65 |
writePrimitiveArray((TypeArray)oop); |
|
66 |
} else if (oop instanceof ObjArray) { |
|
67 |
Klass klass = oop.getKlass(); |
|
68 |
ObjArrayKlass oak = (ObjArrayKlass) klass; |
|
69 |
Klass bottomType = oak.getBottomKlass(); |
|
70 |
if (bottomType instanceof InstanceKlass || |
|
71 |
bottomType instanceof TypeArrayKlass) { |
|
72 |
writeObjectArray((ObjArray)oop); |
|
73 |
} else { |
|
74 |
writeInternalObject(oop); |
|
75 |
} |
|
76 |
} else if (oop instanceof Instance) { |
|
77 |
Instance instance = (Instance) oop; |
|
78 |
Klass klass = instance.getKlass(); |
|
79 |
Symbol name = klass.getName(); |
|
80 |
if (name.equals(javaLangString)) { |
|
81 |
writeString(instance); |
|
82 |
} else if (name.equals(javaLangClass)) { |
|
83 |
writeClass(instance); |
|
84 |
} else if (name.equals(javaLangThread)) { |
|
85 |
writeThread(instance); |
|
86 |
} else { |
|
87 |
klass = klass.getSuper(); |
|
88 |
while (klass != null) { |
|
89 |
name = klass.getName(); |
|
90 |
if (name.equals(javaLangThread)) { |
|
91 |
writeThread(instance); |
|
92 |
return false; |
|
93 |
} |
|
94 |
klass = klass.getSuper(); |
|
95 |
} |
|
96 |
writeInstance(instance); |
|
97 |
} |
|
98 |
} else { |
|
99 |
// not-a-Java-visible oop |
|
100 |
writeInternalObject(oop); |
|
101 |
} |
|
20388
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
102 |
writeHeapRecordEpilogue(); |
1 | 103 |
} catch (IOException exp) { |
104 |
throw new RuntimeException(exp); |
|
105 |
} |
|
106 |
return false; |
|
107 |
} |
|
108 |
||
109 |
public void epilogue() { |
|
110 |
try { |
|
111 |
writeHeapFooter(); |
|
112 |
} catch (IOException exp) { |
|
113 |
throw new RuntimeException(exp); |
|
114 |
} |
|
115 |
} |
|
116 |
}); |
|
117 |
||
43671
a152f2d3320e
8171084: heapdump/JMapHeapCore fails with java.lang.RuntimeException: Heap segment size overflow
jgeorge
parents:
35217
diff
changeset
|
118 |
writeHeapRecordPrologue(); |
a152f2d3320e
8171084: heapdump/JMapHeapCore fails with java.lang.RuntimeException: Heap segment size overflow
jgeorge
parents:
35217
diff
changeset
|
119 |
|
1 | 120 |
// write JavaThreads |
121 |
writeJavaThreads(); |
|
122 |
||
123 |
// write JNI global handles |
|
124 |
writeGlobalJNIHandles(); |
|
125 |
||
126 |
} catch (RuntimeException re) { |
|
127 |
handleRuntimeException(re); |
|
128 |
} |
|
129 |
} |
|
130 |
||
131 |
protected void writeJavaThreads() throws IOException { |
|
132 |
Threads threads = VM.getVM().getThreads(); |
|
133 |
JavaThread jt = threads.first(); |
|
134 |
int index = 1; |
|
135 |
while (jt != null) { |
|
136 |
if (jt.getThreadObj() != null) { |
|
137 |
// Note that the thread serial number range is 1-to-N |
|
138 |
writeJavaThread(jt, index); |
|
139 |
index++; |
|
140 |
} |
|
141 |
jt = jt.next(); |
|
142 |
} |
|
143 |
} |
|
144 |
||
145 |
protected void writeJavaThread(JavaThread jt, int index) |
|
146 |
throws IOException { |
|
147 |
} |
|
148 |
||
149 |
protected void writeGlobalJNIHandles() throws IOException { |
|
150 |
JNIHandles handles = VM.getVM().getJNIHandles(); |
|
48787
7638bf98a312
8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents:
47216
diff
changeset
|
151 |
OopStorage blk = handles.globalHandles(); |
1 | 152 |
if (blk != null) { |
153 |
try { |
|
154 |
blk.oopsDo(new AddressVisitor() { |
|
155 |
public void visitAddress(Address handleAddr) { |
|
156 |
try { |
|
157 |
if (handleAddr != null) { |
|
158 |
writeGlobalJNIHandle(handleAddr); |
|
159 |
} |
|
160 |
} catch (IOException exp) { |
|
161 |
throw new RuntimeException(exp); |
|
162 |
} |
|
163 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
164 |
public void visitCompOopAddress(Address handleAddr) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
165 |
throw new RuntimeException("Should not reach here. JNIHandles are not compressed"); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
166 |
} |
1 | 167 |
}); |
168 |
} catch (RuntimeException re) { |
|
169 |
handleRuntimeException(re); |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
protected void writeGlobalJNIHandle(Address handleAddr) throws IOException { |
|
175 |
} |
|
176 |
||
177 |
protected void writeHeapHeader() throws IOException { |
|
178 |
} |
|
179 |
||
180 |
// write non-Java-visible (hotspot internal) object |
|
181 |
protected void writeInternalObject(Oop oop) throws IOException { |
|
182 |
} |
|
183 |
||
184 |
// write Java primitive array |
|
185 |
protected void writePrimitiveArray(TypeArray array) throws IOException { |
|
186 |
writeObject(array); |
|
187 |
} |
|
188 |
||
189 |
// write Java object array |
|
190 |
protected void writeObjectArray(ObjArray array) throws IOException { |
|
191 |
writeObject(array); |
|
192 |
} |
|
193 |
||
194 |
protected void writeInstance(Instance instance) throws IOException { |
|
195 |
writeObject(instance); |
|
196 |
} |
|
197 |
||
198 |
protected void writeString(Instance instance) throws IOException { |
|
199 |
writeInstance(instance); |
|
200 |
} |
|
201 |
||
202 |
protected void writeClass(Instance instance) throws IOException { |
|
203 |
writeInstance(instance); |
|
204 |
} |
|
205 |
||
206 |
protected void writeThread(Instance instance) throws IOException { |
|
207 |
writeInstance(instance); |
|
208 |
} |
|
209 |
||
210 |
protected void writeObject(Oop oop) throws IOException { |
|
211 |
writeObjectHeader(oop); |
|
212 |
writeObjectFields(oop); |
|
213 |
writeObjectFooter(oop); |
|
214 |
} |
|
215 |
||
216 |
protected void writeObjectHeader(Oop oop) throws IOException { |
|
217 |
} |
|
218 |
||
219 |
// write instance fields of given object |
|
220 |
protected void writeObjectFields(final Oop oop) throws IOException { |
|
221 |
try { |
|
222 |
oop.iterate(new DefaultOopVisitor() { |
|
223 |
public void doOop(OopField field, boolean isVMField) { |
|
224 |
try { |
|
225 |
writeReferenceField(oop, field); |
|
226 |
} catch (IOException exp) { |
|
227 |
throw new RuntimeException(exp); |
|
228 |
} |
|
229 |
} |
|
230 |
||
231 |
public void doByte(ByteField field, boolean isVMField) { |
|
232 |
try { |
|
233 |
writeByteField(oop, field); |
|
234 |
} catch (IOException exp) { |
|
235 |
throw new RuntimeException(exp); |
|
236 |
} |
|
237 |
} |
|
238 |
||
239 |
public void doChar(CharField field, boolean isVMField) { |
|
240 |
try { |
|
241 |
writeCharField(oop, field); |
|
242 |
} catch (IOException exp) { |
|
243 |
throw new RuntimeException(exp); |
|
244 |
} |
|
245 |
} |
|
246 |
||
247 |
public void doBoolean(BooleanField field, boolean vField) { |
|
248 |
try { |
|
249 |
writeBooleanField(oop, field); |
|
250 |
} catch (IOException exp) { |
|
251 |
throw new RuntimeException(exp); |
|
252 |
} |
|
253 |
} |
|
254 |
||
255 |
public void doShort(ShortField field, boolean isVMField) { |
|
256 |
try { |
|
257 |
writeShortField(oop, field); |
|
258 |
} catch (IOException exp) { |
|
259 |
throw new RuntimeException(exp); |
|
260 |
} |
|
261 |
} |
|
262 |
||
263 |
public void doInt(IntField field, boolean isVMField) { |
|
264 |
try { |
|
265 |
writeIntField(oop, field); |
|
266 |
} catch (IOException exp) { |
|
267 |
throw new RuntimeException(exp); |
|
268 |
} |
|
269 |
} |
|
270 |
||
271 |
public void doLong(LongField field, boolean isVMField) { |
|
272 |
try { |
|
273 |
writeLongField(oop, field); |
|
274 |
} catch (IOException exp) { |
|
275 |
throw new RuntimeException(exp); |
|
276 |
} |
|
277 |
} |
|
278 |
||
279 |
public void doFloat(FloatField field, boolean isVMField) { |
|
280 |
try { |
|
281 |
writeFloatField(oop, field); |
|
282 |
} catch (IOException exp) { |
|
283 |
throw new RuntimeException(exp); |
|
284 |
} |
|
285 |
} |
|
286 |
||
287 |
public void doDouble(DoubleField field, boolean vField) { |
|
288 |
try { |
|
289 |
writeDoubleField(oop, field); |
|
290 |
} catch (IOException exp) { |
|
291 |
throw new RuntimeException(exp); |
|
292 |
} |
|
293 |
} |
|
294 |
}, false); |
|
295 |
} catch (RuntimeException re) { |
|
296 |
handleRuntimeException(re); |
|
297 |
} |
|
298 |
} |
|
299 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
300 |
// write instance fields of given object |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
301 |
protected void writeObjectFields(final InstanceKlass oop) throws IOException { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
302 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
303 |
oop.iterateStaticFields(new DefaultOopVisitor() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
304 |
public void doOop(OopField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
305 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
306 |
writeReferenceField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
307 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
308 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
309 |
} |
1 | 310 |
} |
311 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
312 |
public void doByte(ByteField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
313 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
314 |
writeByteField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
315 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
316 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
317 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
318 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
319 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
320 |
public void doChar(CharField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
321 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
322 |
writeCharField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
323 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
324 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
325 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
326 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
327 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
328 |
public void doBoolean(BooleanField field, boolean vField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
329 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
330 |
writeBooleanField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
331 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
332 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
333 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
334 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
335 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
336 |
public void doShort(ShortField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
337 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
338 |
writeShortField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
339 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
340 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
341 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
342 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
343 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
344 |
public void doInt(IntField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
345 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
346 |
writeIntField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
347 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
348 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
349 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
350 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
351 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
352 |
public void doLong(LongField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
353 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
354 |
writeLongField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
355 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
356 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
357 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
358 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
359 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
360 |
public void doFloat(FloatField field, boolean isVMField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
361 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
362 |
writeFloatField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
363 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
364 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
365 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
366 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
367 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
368 |
public void doDouble(DoubleField field, boolean vField) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
369 |
try { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
370 |
writeDoubleField(null, field); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
371 |
} catch (IOException exp) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
372 |
throw new RuntimeException(exp); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
373 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
374 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
375 |
}); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
376 |
} catch (RuntimeException re) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
377 |
handleRuntimeException(re); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
378 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
379 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
380 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5547
diff
changeset
|
381 |
// object field writers |
1 | 382 |
protected void writeReferenceField(Oop oop, OopField field) |
383 |
throws IOException { |
|
384 |
} |
|
385 |
||
386 |
protected void writeByteField(Oop oop, ByteField field) |
|
387 |
throws IOException { |
|
388 |
} |
|
389 |
||
390 |
protected void writeCharField(Oop oop, CharField field) |
|
391 |
throws IOException { |
|
392 |
} |
|
393 |
||
394 |
protected void writeBooleanField(Oop oop, BooleanField field) |
|
395 |
throws IOException { |
|
396 |
} |
|
397 |
||
398 |
protected void writeShortField(Oop oop, ShortField field) |
|
399 |
throws IOException { |
|
400 |
} |
|
401 |
||
402 |
protected void writeIntField(Oop oop, IntField field) |
|
403 |
throws IOException { |
|
404 |
} |
|
405 |
||
406 |
protected void writeLongField(Oop oop, LongField field) |
|
407 |
throws IOException { |
|
408 |
} |
|
409 |
||
410 |
protected void writeFloatField(Oop oop, FloatField field) |
|
411 |
throws IOException { |
|
412 |
} |
|
413 |
||
414 |
protected void writeDoubleField(Oop oop, DoubleField field) |
|
415 |
throws IOException { |
|
416 |
} |
|
417 |
||
418 |
protected void writeObjectFooter(Oop oop) throws IOException { |
|
419 |
} |
|
420 |
||
421 |
protected void writeHeapFooter() throws IOException { |
|
422 |
} |
|
423 |
||
20388
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
424 |
protected void writeHeapRecordPrologue() throws IOException { |
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
425 |
} |
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
426 |
|
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
427 |
protected void writeHeapRecordEpilogue() throws IOException { |
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
428 |
} |
2cf7b26682dc
6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents:
13728
diff
changeset
|
429 |
|
1 | 430 |
// HeapVisitor, OopVisitor methods can't throw any non-runtime |
431 |
// exception. But, derived class write methods (which are called |
|
432 |
// from visitor callbacks) may throw IOException. Hence, we throw |
|
433 |
// RuntimeException with origianal IOException as cause from the |
|
434 |
// visitor methods. This method gets back the original IOException |
|
435 |
// (if any) and re-throws the same. |
|
436 |
protected void handleRuntimeException(RuntimeException re) |
|
437 |
throws IOException { |
|
438 |
Throwable cause = re.getCause(); |
|
439 |
if (cause != null && cause instanceof IOException) { |
|
440 |
throw (IOException) cause; |
|
441 |
} else { |
|
442 |
// some other RuntimeException, just re-throw |
|
443 |
throw re; |
|
444 |
} |
|
445 |
} |
|
446 |
||
447 |
// whether a given oop is Java visible or hotspot internal? |
|
448 |
protected boolean isJavaVisible(Oop oop) { |
|
449 |
if (oop instanceof Instance || oop instanceof TypeArray) { |
|
450 |
return true; |
|
451 |
} else if (oop instanceof ObjArray) { |
|
452 |
ObjArrayKlass oak = (ObjArrayKlass) oop.getKlass(); |
|
453 |
Klass bottomKlass = oak.getBottomKlass(); |
|
454 |
return bottomKlass instanceof InstanceKlass || |
|
455 |
bottomKlass instanceof TypeArrayKlass; |
|
456 |
} else { |
|
457 |
return false; |
|
458 |
} |
|
459 |
} |
|
460 |
||
461 |
protected Symbol javaLangClass; |
|
462 |
protected Symbol javaLangString; |
|
463 |
protected Symbol javaLangThread; |
|
464 |
} |