comparison agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java @ 2411:63997f575155

7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue Reviewed-by: kvn, dcubed
author never
date Wed, 30 Mar 2011 07:47:19 -0700
parents c18cbe5936b8
children 38ea2efa32a7
comparison
equal deleted inserted replaced
2410:fe1dbd98e18f 2411:63997f575155
1 /* 1 /*
2 * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2004, 2011, 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.
62 * is the number of objects in the queue, and 'head' is the head of the 62 * is the number of objects in the queue, and 'head' is the head of the
63 * queue. 63 * queue.
64 */ 64 */
65 InstanceKlass ik = 65 InstanceKlass ik =
66 SystemDictionaryHelper.findInstanceKlass("java.lang.ref.Finalizer"); 66 SystemDictionaryHelper.findInstanceKlass("java.lang.ref.Finalizer");
67 final OopField queueField[] = new OopField[1]; 67 final Oop[] queueref = new Oop[1];
68 ik.iterateFields(new DefaultOopVisitor() { 68 ik.iterateStaticFields(new DefaultOopVisitor() {
69 public void doOop(OopField field, boolean isVMField) { 69 public void doOop(OopField field, boolean isVMField) {
70 String name = field.getID().getName(); 70 String name = field.getID().getName();
71 if (name.equals("queue")) { 71 if (name.equals("queue")) {
72 queueField[0] = field; 72 queueref[0] = field.getValue(getObj());
73 } 73 }
74 } 74 }
75 }, false); 75 });
76 Oop queue = queueField[0].getValue(ik); 76 Oop queue = queueref[0];
77 77
78 InstanceKlass k = (InstanceKlass) queue.getKlass(); 78 InstanceKlass k = (InstanceKlass) queue.getKlass();
79 79
80 LongField queueLengthField = (LongField) k.findField("queueLength", "J"); 80 LongField queueLengthField = (LongField) k.findField("queueLength", "J");
81 long queueLength = queueLengthField.getValue(queue); 81 long queueLength = queueLengthField.getValue(queue);