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