annotate agent/src/share/classes/sun/jvm/hotspot/ui/tree/OopTreeNodeAdapter.java @ 844:bd02caa94611

6862919: Update copyright year Summary: Update copyright for files that have been modified in 2009, up to 07/09 Reviewed-by: tbell, ohair
author xdono
date Tue, 28 Jul 2009 12:12:40 -0700
parents acba6af809c8
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
844
bd02caa94611 6862919: Update copyright year
xdono
parents: 833
diff changeset
2 * Copyright 2000-2009 Sun Microsystems, Inc. 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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
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
a61af66fc99e Initial load
duke
parents:
diff changeset
127 public void doOop(OopField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
128 public void doByte(ByteField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 public void doChar(CharField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 public void doBoolean(BooleanField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 public void doShort(ShortField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 public void doInt(IntField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
133 public void doLong(LongField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 public void doFloat(FloatField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 public void doDouble(DoubleField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
136 public void doCInt(CIntField field, boolean isVMField) { ++numFields; }
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 /** Creates a new SimpleTreeNode for the given field. FIXME: want
a61af66fc99e Initial load
duke
parents:
diff changeset
140 this to distinguish between VM and non-VM fields. */
a61af66fc99e Initial load
duke
parents:
diff changeset
141 class Fetcher extends DefaultOopVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 private int index;
a61af66fc99e Initial load
duke
parents:
diff changeset
143 private int curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 private SimpleTreeNode child;
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 public Fetcher(int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 this.index = index;
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 public SimpleTreeNode getChild() {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 return child;
a61af66fc99e Initial load
duke
parents:
diff changeset
152 }
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 public void prologue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
155 curField = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
156 }
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 public void doOop(OopField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
159 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
160 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
161 child = new OopTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
162 } catch (AddressException e) {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 child = new BadOopTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field.getID(), getTreeTableMode());
833
acba6af809c8 6840775: Multiple JVM crashes seen with 1.6.0_10 through 1.6.0_14
kvn
parents: 0
diff changeset
164 } catch (UnknownOopException e) {
acba6af809c8 6840775: Multiple JVM crashes seen with 1.6.0_10 through 1.6.0_14
kvn
parents: 0
diff changeset
165 child = new BadOopTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field.getID(), getTreeTableMode());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
166 }
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 }
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 public void doByte(ByteField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 child = new LongTreeNodeAdapter(field.getValue(getObj()) & 0xFF, field.getID(), getTreeTableMode());
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 ++curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 public void doChar(CharField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
180 child = new CharTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
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 doBoolean(BooleanField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
186 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
187 child = new BooleanTreeNodeAdapter(field.getValue(getObj()), 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 doShort(ShortField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
193 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
194 child = new LongTreeNodeAdapter(field.getValue(getObj()) & 0xFFFF, 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 doInt(IntField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 child = new LongTreeNodeAdapter(field.getValue(getObj()) & 0xFFFFFFFF, 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 doLong(LongField 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()), 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 doFloat(FloatField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 child = new FloatTreeNodeAdapter(field.getValue(getObj()), 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 doDouble(DoubleField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
222 child = new DoubleTreeNodeAdapter(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 doCInt(CIntField field, boolean isVMField) {
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (curField == index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 child = new LongTreeNodeAdapter(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
a61af66fc99e Initial load
duke
parents:
diff changeset
235 /** Finds the index of the given FieldIdentifier. */
a61af66fc99e Initial load
duke
parents:
diff changeset
236 static class Finder extends DefaultOopVisitor {
a61af66fc99e Initial load
duke
parents:
diff changeset
237 private FieldIdentifier id;
a61af66fc99e Initial load
duke
parents:
diff changeset
238 private int curField;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 private int index;
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 public Finder(FieldIdentifier id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 this.id = id;
a61af66fc99e Initial load
duke
parents:
diff changeset
243 }
a61af66fc99e Initial load
duke
parents:
diff changeset
244
a61af66fc99e Initial load
duke
parents:
diff changeset
245 /** Returns -1 if not found */
a61af66fc99e Initial load
duke
parents:
diff changeset
246 public int getIndex() {
a61af66fc99e Initial load
duke
parents:
diff changeset
247 return index;
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 public void prologue() {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 curField = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
252 index = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
253 }
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 public void doOop(OopField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
256 public void doByte(ByteField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
257 public void doChar(CharField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 public void doBoolean(BooleanField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
259 public void doShort(ShortField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
260 public void doInt(IntField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
261 public void doLong(LongField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
262 public void doFloat(FloatField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
263 public void doDouble(DoubleField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
264 public void doCInt(CIntField field, boolean isVMField) { if (field.getID().equals(id)) { index = curField; } ++curField; }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 }
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }