annotate agent/src/share/classes/sun/jvm/hotspot/ui/tree/OopTreeNodeAdapter.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 844
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 844
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: 844
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.ui.tree;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.io.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import sun.jvm.hotspot.oops.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import sun.jvm.hotspot.runtime.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 /** An adapter class which allows oops to be displayed in a tree via
a61af66fc99e Initial load
duke
parents:
diff changeset
33 the SimpleTreeNode interface. FIXME: must attach this to some sort
a61af66fc99e Initial load
duke
parents:
diff changeset
34 of policy object which determines how to display names and whether
a61af66fc99e Initial load
duke
parents:
diff changeset
35 VM fields should be shown. (Must also fix oop visitation mechanism
a61af66fc99e Initial load
duke
parents:
diff changeset
36 in oops package.) */
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public class OopTreeNodeAdapter extends FieldTreeNodeAdapter {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 private Oop oop;
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 /** The oop may be null (for oop fields of oops which are null); the
a61af66fc99e Initial load
duke
parents:
diff changeset
42 FieldIdentifier may also be null (for the root node).
a61af66fc99e Initial load
duke
parents:
diff changeset
43 treeTableMode defaults to false. */
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public OopTreeNodeAdapter(Oop oop, FieldIdentifier id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 this(oop, id, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 }
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 /** The oop may be null (for oop fields of oops which are null); the
a61af66fc99e Initial load
duke
parents:
diff changeset
49 FieldIdentifier may also be null (for the root node). */
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public OopTreeNodeAdapter(Oop oop, FieldIdentifier id, boolean treeTableMode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 super(id, treeTableMode);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 this.oop = oop;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public Oop getOop() {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 return oop;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 public int getChildCount() {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 if (oop == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 Counter c = new Counter();
a61af66fc99e Initial load
duke
parents:
diff changeset
65 oop.iterate(c, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
66 return c.getNumFields() + (VM.getVM().getRevPtrs() == null ? 0 : 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 public SimpleTreeNode getChild(int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 if (oop == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 }
a61af66fc99e Initial load
duke
parents:
diff changeset
73 if (VM.getVM().getRevPtrs() != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 if (index == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
75 return new RevPtrsTreeNodeAdapter(oop, getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
76 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 index -= 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 Fetcher f = new Fetcher(index);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 oop.iterate(f, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return f.getChild();
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 public boolean isLeaf() {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 return (oop == null);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 public int getIndexOfChild(SimpleTreeNode child) {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if (child instanceof RevPtrsTreeNodeAdapter) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // assert(VM.getVM().getRevPtrs() != null, "Only created from revptrs");
a61af66fc99e Initial load
duke
parents:
diff changeset
93 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 FieldIdentifier id = ((FieldTreeNodeAdapter) child).getID();
a61af66fc99e Initial load
duke
parents:
diff changeset
96 Finder f = new Finder(id);
a61af66fc99e Initial load
duke
parents:
diff changeset
97 oop.iterate(f, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 return f.getIndex() + (VM.getVM().getRevPtrs() == null ? 0 : 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public String getValue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 if (oop != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // FIXME: choose style of printing depending on whether we're
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // displaying VM fields? Want to make Java objects look like
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Java objects.
a61af66fc99e Initial load
duke
parents:
diff changeset
106 ByteArrayOutputStream bos = new ByteArrayOutputStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
107 Oop.printOopValueOn(oop, new PrintStream(bos));
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return bos.toString();
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return "null";
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 /** Should be applied to one oop at a time, then have the number of
a61af66fc99e Initial load
duke
parents:
diff changeset
114 fields fetched. FIXME: want this to distinguish between VM and
a61af66fc99e Initial load
duke
parents:
diff changeset
115 non-VM fields. */
a61af66fc99e Initial load
duke
parents:
diff changeset
116 static class Counter extends DefaultOopVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 private int numFields;
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 public int getNumFields() {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 return numFields;
a61af66fc99e Initial load
duke
parents:
diff changeset
121 }
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 public void prologue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 numFields = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
127 public void doMetadata(MetadataField field, boolean isVMField) { ++numFields; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
128 public void doOop(OopField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 public void doByte(ByteField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 public void doChar(CharField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 public void doBoolean(BooleanField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 public void doShort(ShortField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
133 public void doInt(IntField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 public void doLong(LongField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 public void doFloat(FloatField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
136 public void doDouble(DoubleField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
137 public void doCInt(CIntField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
138 }
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 /** Creates a new SimpleTreeNode for the given field. FIXME: want
a61af66fc99e Initial load
duke
parents:
diff changeset
141 this to distinguish between VM and non-VM fields. */
a61af66fc99e Initial load
duke
parents:
diff changeset
142 class Fetcher extends DefaultOopVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 private int index;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 private int curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 private SimpleTreeNode child;
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 public Fetcher(int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
148 this.index = index;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 }
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 public SimpleTreeNode getChild() {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 return child;
a61af66fc99e Initial load
duke
parents:
diff changeset
153 }
a61af66fc99e Initial load
duke
parents:
diff changeset
154
a61af66fc99e Initial load
duke
parents:
diff changeset
155 public void prologue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 curField = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
159 public void doMetadata(MetadataField field, boolean isVMField) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
160 if (curField == index) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
161 try {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
162 child = new MetadataTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
163 } catch (AddressException e) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
164 child = new BadAddressTreeNodeAdapter(getObj().getHandle().getAddressAt(field.getOffset()), field, getTreeTableMode());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
165 } catch (UnknownOopException e) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
166 child = new BadAddressTreeNodeAdapter(getObj().getHandle().getAddressAt(field.getOffset()), field, getTreeTableMode());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
167 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
168 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
169 ++curField;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
170 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
171
0
a61af66fc99e Initial load
duke
parents:
diff changeset
172 public void doOop(OopField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
174 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 child = new OopTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
176 } catch (AddressException e) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
177 child = new BadAddressTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field, getTreeTableMode());
833
acba6af809c8 6840775: Multiple JVM crashes seen with 1.6.0_10 through 1.6.0_14
kvn
parents: 0
diff changeset
178 } catch (UnknownOopException e) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
179 child = new BadAddressTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field, getTreeTableMode());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
180 }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 }
a61af66fc99e Initial load
duke
parents:
diff changeset
182 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 public void doByte(ByteField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
186 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
187 child = new LongTreeNodeAdapter(field.getValue(getObj()) & 0xFF, field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
188 }
a61af66fc99e Initial load
duke
parents:
diff changeset
189 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 public void doChar(CharField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
193 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
194 child = new CharTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
197 }
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 public void doBoolean(BooleanField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 child = new BooleanTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
204 }
a61af66fc99e Initial load
duke
parents:
diff changeset
205
a61af66fc99e Initial load
duke
parents:
diff changeset
206 public void doShort(ShortField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
207 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 child = new LongTreeNodeAdapter(field.getValue(getObj()) & 0xFFFF, field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
209 }
a61af66fc99e Initial load
duke
parents:
diff changeset
210 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 public void doInt(IntField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 child = new LongTreeNodeAdapter(field.getValue(getObj()) & 0xFFFFFFFF, field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
216 }
a61af66fc99e Initial load
duke
parents:
diff changeset
217 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220 public void doLong(LongField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
222 child = new LongTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 public void doFloat(FloatField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 child = new FloatTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
230 }
a61af66fc99e Initial load
duke
parents:
diff changeset
231 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 public void doDouble(DoubleField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
236 child = new DoubleTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
237 }
a61af66fc99e Initial load
duke
parents:
diff changeset
238 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 }
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 public void doCInt(CIntField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
243 child = new LongTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
246 }
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 /** Finds the index of the given FieldIdentifier. */
a61af66fc99e Initial load
duke
parents:
diff changeset
250 static class Finder extends DefaultOopVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 private FieldIdentifier id;
a61af66fc99e Initial load
duke
parents:
diff changeset
252 private int curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
253 private int index;
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 public Finder(FieldIdentifier id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 this.id = id;
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 /** Returns -1 if not found */
a61af66fc99e Initial load
duke
parents:
diff changeset
260 public int getIndex() {
a61af66fc99e Initial load
duke
parents:
diff changeset
261 return index;
a61af66fc99e Initial load
duke
parents:
diff changeset
262 }
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 public void prologue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
265 curField = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
266 index = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268
a61af66fc99e Initial load
duke
parents:
diff changeset
269 public void doOop(OopField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
270 public void doByte(ByteField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
271 public void doChar(CharField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 public void doBoolean(BooleanField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
273 public void doShort(ShortField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
274 public void doInt(IntField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
275 public void doLong(LongField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 public void doFloat(FloatField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
277 public void doDouble(DoubleField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
278 public void doCInt(CIntField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280 }