comparison agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents c18cbe5936b8
children 8ef918538e22
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
215 protected void writeObjectFields(final Oop oop) throws IOException { 215 protected void writeObjectFields(final Oop oop) throws IOException {
216 try { 216 try {
217 oop.iterate(new DefaultOopVisitor() { 217 oop.iterate(new DefaultOopVisitor() {
218 public void doOop(OopField field, boolean isVMField) { 218 public void doOop(OopField field, boolean isVMField) {
219 try { 219 try {
220 Oop ref = field.getValue(oop);
221 if (ref instanceof TypeArray ||
222 ref instanceof ObjArray ||
223 ref instanceof Instance) {
224 writeReferenceField(oop, field); 220 writeReferenceField(oop, field);
225 } else {
226 writeInternalReferenceField(oop, field);
227 }
228 } catch (IOException exp) { 221 } catch (IOException exp) {
229 throw new RuntimeException(exp); 222 throw new RuntimeException(exp);
230 } 223 }
231 } 224 }
232 225
297 } catch (RuntimeException re) { 290 } catch (RuntimeException re) {
298 handleRuntimeException(re); 291 handleRuntimeException(re);
299 } 292 }
300 } 293 }
301 294
295 // write instance fields of given object
296 protected void writeObjectFields(final InstanceKlass oop) throws IOException {
297 try {
298 oop.iterateStaticFields(new DefaultOopVisitor() {
299 public void doOop(OopField field, boolean isVMField) {
300 try {
301 writeReferenceField(null, field);
302 } catch (IOException exp) {
303 throw new RuntimeException(exp);
304 }
305 }
306
307 public void doByte(ByteField field, boolean isVMField) {
308 try {
309 writeByteField(null, field);
310 } catch (IOException exp) {
311 throw new RuntimeException(exp);
312 }
313 }
314
315 public void doChar(CharField field, boolean isVMField) {
316 try {
317 writeCharField(null, field);
318 } catch (IOException exp) {
319 throw new RuntimeException(exp);
320 }
321 }
322
323 public void doBoolean(BooleanField field, boolean vField) {
324 try {
325 writeBooleanField(null, field);
326 } catch (IOException exp) {
327 throw new RuntimeException(exp);
328 }
329 }
330
331 public void doShort(ShortField field, boolean isVMField) {
332 try {
333 writeShortField(null, field);
334 } catch (IOException exp) {
335 throw new RuntimeException(exp);
336 }
337 }
338
339 public void doInt(IntField field, boolean isVMField) {
340 try {
341 writeIntField(null, field);
342 } catch (IOException exp) {
343 throw new RuntimeException(exp);
344 }
345 }
346
347 public void doLong(LongField field, boolean isVMField) {
348 try {
349 writeLongField(null, field);
350 } catch (IOException exp) {
351 throw new RuntimeException(exp);
352 }
353 }
354
355 public void doFloat(FloatField field, boolean isVMField) {
356 try {
357 writeFloatField(null, field);
358 } catch (IOException exp) {
359 throw new RuntimeException(exp);
360 }
361 }
362
363 public void doDouble(DoubleField field, boolean vField) {
364 try {
365 writeDoubleField(null, field);
366 } catch (IOException exp) {
367 throw new RuntimeException(exp);
368 }
369 }
370 });
371 } catch (RuntimeException re) {
372 handleRuntimeException(re);
373 }
374 }
375
302 // object field writers 376 // object field writers
303 protected void writeInternalReferenceField(Oop oop, OopField field)
304 throws IOException {
305 }
306
307 protected void writeReferenceField(Oop oop, OopField field) 377 protected void writeReferenceField(Oop oop, OopField field)
308 throws IOException { 378 throws IOException {
309 } 379 }
310 380
311 protected void writeByteField(Oop oop, ByteField field) 381 protected void writeByteField(Oop oop, ByteField field)