51 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
51 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
52 Type type = db.lookupType("Klass"); |
52 Type type = db.lookupType("Klass"); |
53 javaMirror = new OopField(type.getOopField("_java_mirror"), Oop.getHeaderSize()); |
53 javaMirror = new OopField(type.getOopField("_java_mirror"), Oop.getHeaderSize()); |
54 superField = new OopField(type.getOopField("_super"), Oop.getHeaderSize()); |
54 superField = new OopField(type.getOopField("_super"), Oop.getHeaderSize()); |
55 layoutHelper = new IntField(type.getJIntField("_layout_helper"), Oop.getHeaderSize()); |
55 layoutHelper = new IntField(type.getJIntField("_layout_helper"), Oop.getHeaderSize()); |
56 name = new OopField(type.getOopField("_name"), Oop.getHeaderSize()); |
56 name = type.getAddressField("_name"); |
57 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), Oop.getHeaderSize()); |
57 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), Oop.getHeaderSize()); |
58 subklass = new OopField(type.getOopField("_subklass"), Oop.getHeaderSize()); |
58 subklass = new OopField(type.getOopField("_subklass"), Oop.getHeaderSize()); |
59 nextSibling = new OopField(type.getOopField("_next_sibling"), Oop.getHeaderSize()); |
59 nextSibling = new OopField(type.getOopField("_next_sibling"), Oop.getHeaderSize()); |
60 allocCount = new CIntField(type.getCIntegerField("_alloc_count"), Oop.getHeaderSize()); |
60 allocCount = new CIntField(type.getCIntegerField("_alloc_count"), Oop.getHeaderSize()); |
61 |
61 |
81 |
81 |
82 // Fields |
82 // Fields |
83 private static OopField javaMirror; |
83 private static OopField javaMirror; |
84 private static OopField superField; |
84 private static OopField superField; |
85 private static IntField layoutHelper; |
85 private static IntField layoutHelper; |
86 private static OopField name; |
86 private static AddressField name; |
87 private static CIntField accessFlags; |
87 private static CIntField accessFlags; |
88 private static OopField subklass; |
88 private static OopField subklass; |
89 private static OopField nextSibling; |
89 private static OopField nextSibling; |
90 private static CIntField allocCount; |
90 private static CIntField allocCount; |
|
91 |
|
92 private Address getValue(AddressField field) { |
|
93 return getHandle().getAddressAt(field.getOffset() + Oop.getHeaderSize()); |
|
94 } |
|
95 |
|
96 protected Symbol getSymbol(AddressField field) { |
|
97 return Symbol.create(getHandle().getAddressAt(field.getOffset() + Oop.getHeaderSize())); |
|
98 } |
91 |
99 |
92 // Accessors for declared fields |
100 // Accessors for declared fields |
93 public Instance getJavaMirror() { return (Instance) javaMirror.getValue(this); } |
101 public Instance getJavaMirror() { return (Instance) javaMirror.getValue(this); } |
94 public Klass getSuper() { return (Klass) superField.getValue(this); } |
102 public Klass getSuper() { return (Klass) superField.getValue(this); } |
95 public Klass getJavaSuper() { return null; } |
103 public Klass getJavaSuper() { return null; } |
96 public int getLayoutHelper() { return (int) layoutHelper.getValue(this); } |
104 public int getLayoutHelper() { return (int) layoutHelper.getValue(this); } |
97 public Symbol getName() { return (Symbol) name.getValue(this); } |
105 public Symbol getName() { return getSymbol(name); } |
98 public long getAccessFlags() { return accessFlags.getValue(this); } |
106 public long getAccessFlags() { return accessFlags.getValue(this); } |
99 // Convenience routine |
107 // Convenience routine |
100 public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); } |
108 public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); } |
101 public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); } |
109 public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); } |
102 public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); } |
110 public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); } |
160 super.iterateFields(visitor, doVMFields); |
168 super.iterateFields(visitor, doVMFields); |
161 if (doVMFields) { |
169 if (doVMFields) { |
162 visitor.doOop(javaMirror, true); |
170 visitor.doOop(javaMirror, true); |
163 visitor.doOop(superField, true); |
171 visitor.doOop(superField, true); |
164 visitor.doInt(layoutHelper, true); |
172 visitor.doInt(layoutHelper, true); |
165 visitor.doOop(name, true); |
173 // visitor.doOop(name, true); |
166 visitor.doCInt(accessFlags, true); |
174 visitor.doCInt(accessFlags, true); |
167 visitor.doOop(subklass, true); |
175 visitor.doOop(subklass, true); |
168 visitor.doOop(nextSibling, true); |
176 visitor.doOop(nextSibling, true); |
169 visitor.doCInt(allocCount, true); |
177 visitor.doCInt(allocCount, true); |
170 } |
178 } |