author | coleenp |
Wed, 22 May 2013 14:37:49 -0400 | |
changeset 17826 | 9ad5cd464a75 |
parent 15225 | 40677d8847bd |
child 19326 | 14cb6cf26a96 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
12369
48fd3da4025c
7154670: The instanceKlass _implementors[] and _nof_implementors are not needed for non-interface klass.
jiangli
parents:
12231
diff
changeset
|
2 |
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
package sun.jvm.hotspot.oops; |
|
26 |
||
27 |
import java.io.*; |
|
28 |
import java.util.*; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
29 |
import sun.jvm.hotspot.classfile.ClassLoaderData; |
1 | 30 |
import sun.jvm.hotspot.debugger.*; |
31 |
import sun.jvm.hotspot.memory.*; |
|
32 |
import sun.jvm.hotspot.runtime.*; |
|
33 |
import sun.jvm.hotspot.types.*; |
|
34 |
import sun.jvm.hotspot.utilities.*; |
|
35 |
||
36 |
// An InstanceKlass is the VM level representation of a Java class. |
|
37 |
||
38 |
public class InstanceKlass extends Klass { |
|
39 |
static { |
|
40 |
VM.registerVMInitializedObserver(new Observer() { |
|
41 |
public void update(Observable o, Object data) { |
|
42 |
initialize(VM.getVM().getTypeDataBase()); |
|
43 |
} |
|
44 |
}); |
|
45 |
} |
|
46 |
||
47 |
// field offset constants |
|
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
48 |
private static int ACCESS_FLAGS_OFFSET; |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
49 |
private static int NAME_INDEX_OFFSET; |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
50 |
private static int SIGNATURE_INDEX_OFFSET; |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
51 |
private static int INITVAL_INDEX_OFFSET; |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
52 |
private static int LOW_OFFSET; |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
53 |
private static int HIGH_OFFSET; |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
54 |
private static int FIELD_SLOTS; |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
55 |
private static short FIELDINFO_TAG_SIZE; |
15225
40677d8847bd
8006403: Regression: jstack failed due to the FieldInfo regression in SA
sla
parents:
15193
diff
changeset
|
56 |
private static short FIELDINFO_TAG_MASK; |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
57 |
private static short FIELDINFO_TAG_OFFSET; |
1 | 58 |
|
59 |
// ClassState constants |
|
60 |
private static int CLASS_STATE_ALLOCATED; |
|
61 |
private static int CLASS_STATE_LOADED; |
|
62 |
private static int CLASS_STATE_LINKED; |
|
63 |
private static int CLASS_STATE_BEING_INITIALIZED; |
|
64 |
private static int CLASS_STATE_FULLY_INITIALIZED; |
|
65 |
private static int CLASS_STATE_INITIALIZATION_ERROR; |
|
66 |
||
67 |
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
68 |
Type type = db.lookupType("InstanceKlass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
69 |
arrayKlasses = new MetadataField(type.getAddressField("_array_klasses"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
70 |
methods = type.getAddressField("_methods"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
71 |
methodOrdering = type.getAddressField("_method_ordering"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
72 |
localInterfaces = type.getAddressField("_local_interfaces"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
73 |
transitiveInterfaces = type.getAddressField("_transitive_interfaces"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
74 |
fields = type.getAddressField("_fields"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
75 |
javaFieldsCount = new CIntField(type.getCIntegerField("_java_fields_count"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
76 |
constants = new MetadataField(type.getAddressField("_constants"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
77 |
classLoaderData = type.getAddressField("_class_loader_data"); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
78 |
sourceFileName = type.getAddressField("_source_file_name"); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
79 |
sourceDebugExtension = type.getAddressField("_source_debug_extension"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
80 |
innerClasses = type.getAddressField("_inner_classes"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
81 |
nonstaticFieldSize = new CIntField(type.getCIntegerField("_nonstatic_field_size"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
82 |
staticFieldSize = new CIntField(type.getCIntegerField("_static_field_size"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
83 |
staticOopFieldCount = new CIntField(type.getCIntegerField("_static_oop_field_count"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
84 |
nonstaticOopMapSize = new CIntField(type.getCIntegerField("_nonstatic_oop_map_size"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
85 |
isMarkedDependent = new CIntField(type.getCIntegerField("_is_marked_dependent"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
86 |
initState = new CIntField(type.getCIntegerField("_init_state"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
87 |
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
88 |
itableLen = new CIntField(type.getCIntegerField("_itable_len"), 0); |
1 | 89 |
breakpoints = type.getAddressField("_breakpoints"); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
90 |
genericSignature = type.getAddressField("_generic_signature"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
91 |
majorVersion = new CIntField(type.getCIntegerField("_major_version"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
92 |
minorVersion = new CIntField(type.getCIntegerField("_minor_version"), 0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
93 |
headerSize = Oop.alignObjectOffset(type.getSize()); |
1 | 94 |
|
95 |
// read field offset constants |
|
10546 | 96 |
ACCESS_FLAGS_OFFSET = db.lookupIntConstant("FieldInfo::access_flags_offset").intValue(); |
97 |
NAME_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::name_index_offset").intValue(); |
|
98 |
SIGNATURE_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::signature_index_offset").intValue(); |
|
99 |
INITVAL_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::initval_index_offset").intValue(); |
|
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
100 |
LOW_OFFSET = db.lookupIntConstant("FieldInfo::low_packed_offset").intValue(); |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
101 |
HIGH_OFFSET = db.lookupIntConstant("FieldInfo::high_packed_offset").intValue(); |
10546 | 102 |
FIELD_SLOTS = db.lookupIntConstant("FieldInfo::field_slots").intValue(); |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
103 |
FIELDINFO_TAG_SIZE = db.lookupIntConstant("FIELDINFO_TAG_SIZE").shortValue(); |
15225
40677d8847bd
8006403: Regression: jstack failed due to the FieldInfo regression in SA
sla
parents:
15193
diff
changeset
|
104 |
FIELDINFO_TAG_MASK = db.lookupIntConstant("FIELDINFO_TAG_MASK").shortValue(); |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
105 |
FIELDINFO_TAG_OFFSET = db.lookupIntConstant("FIELDINFO_TAG_OFFSET").shortValue(); |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
106 |
|
1 | 107 |
// read ClassState constants |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
108 |
CLASS_STATE_ALLOCATED = db.lookupIntConstant("InstanceKlass::allocated").intValue(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
109 |
CLASS_STATE_LOADED = db.lookupIntConstant("InstanceKlass::loaded").intValue(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
110 |
CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
111 |
CLASS_STATE_BEING_INITIALIZED = db.lookupIntConstant("InstanceKlass::being_initialized").intValue(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
112 |
CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("InstanceKlass::fully_initialized").intValue(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
113 |
CLASS_STATE_INITIALIZATION_ERROR = db.lookupIntConstant("InstanceKlass::initialization_error").intValue(); |
1 | 114 |
|
115 |
} |
|
116 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
117 |
public InstanceKlass(Address addr) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
118 |
super(addr); |
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
119 |
if (getJavaFieldsCount() != getAllFieldsCount()) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
120 |
// Exercise the injected field logic |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
121 |
for (int i = getJavaFieldsCount(); i < getAllFieldsCount(); i++) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
122 |
getFieldName(i); |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
123 |
getFieldSignature(i); |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
124 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
125 |
} |
1 | 126 |
} |
127 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
128 |
private static MetadataField arrayKlasses; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
129 |
private static AddressField methods; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
130 |
private static AddressField methodOrdering; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
131 |
private static AddressField localInterfaces; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
132 |
private static AddressField transitiveInterfaces; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
133 |
private static AddressField fields; |
10546 | 134 |
private static CIntField javaFieldsCount; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
135 |
private static MetadataField constants; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
136 |
private static AddressField classLoaderData; |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
137 |
private static AddressField sourceFileName; |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
138 |
private static AddressField sourceDebugExtension; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
139 |
private static AddressField innerClasses; |
1 | 140 |
private static CIntField nonstaticFieldSize; |
141 |
private static CIntField staticFieldSize; |
|
8725
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
8076
diff
changeset
|
142 |
private static CIntField staticOopFieldCount; |
1 | 143 |
private static CIntField nonstaticOopMapSize; |
11440
dea12ec80745
7129240: backout fix for 7102776 until 7128770 is resolved
dcubed
parents:
11405
diff
changeset
|
144 |
private static CIntField isMarkedDependent; |
1 | 145 |
private static CIntField initState; |
146 |
private static CIntField vtableLen; |
|
147 |
private static CIntField itableLen; |
|
148 |
private static AddressField breakpoints; |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
149 |
private static AddressField genericSignature; |
1 | 150 |
private static CIntField majorVersion; |
151 |
private static CIntField minorVersion; |
|
152 |
||
153 |
// type safe enum for ClassState from instanceKlass.hpp |
|
154 |
public static class ClassState { |
|
155 |
public static final ClassState ALLOCATED = new ClassState("allocated"); |
|
156 |
public static final ClassState LOADED = new ClassState("loaded"); |
|
157 |
public static final ClassState LINKED = new ClassState("linked"); |
|
158 |
public static final ClassState BEING_INITIALIZED = new ClassState("beingInitialized"); |
|
159 |
public static final ClassState FULLY_INITIALIZED = new ClassState("fullyInitialized"); |
|
160 |
public static final ClassState INITIALIZATION_ERROR = new ClassState("initializationError"); |
|
161 |
||
162 |
private ClassState(String value) { |
|
163 |
this.value = value; |
|
164 |
} |
|
165 |
||
166 |
public String toString() { |
|
167 |
return value; |
|
168 |
} |
|
169 |
||
170 |
private String value; |
|
171 |
} |
|
172 |
||
10547 | 173 |
public int getInitStateAsInt() { return (int) initState.getValue(this); } |
1 | 174 |
public ClassState getInitState() { |
175 |
int state = getInitStateAsInt(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
176 |
if (state == CLASS_STATE_ALLOCATED) { |
1 | 177 |
return ClassState.ALLOCATED; |
178 |
} else if (state == CLASS_STATE_LOADED) { |
|
179 |
return ClassState.LOADED; |
|
180 |
} else if (state == CLASS_STATE_LINKED) { |
|
181 |
return ClassState.LINKED; |
|
182 |
} else if (state == CLASS_STATE_BEING_INITIALIZED) { |
|
183 |
return ClassState.BEING_INITIALIZED; |
|
184 |
} else if (state == CLASS_STATE_FULLY_INITIALIZED) { |
|
185 |
return ClassState.FULLY_INITIALIZED; |
|
186 |
} else if (state == CLASS_STATE_INITIALIZATION_ERROR) { |
|
187 |
return ClassState.INITIALIZATION_ERROR; |
|
188 |
} else { |
|
189 |
throw new RuntimeException("should not reach here"); |
|
190 |
} |
|
191 |
} |
|
192 |
||
193 |
// initialization state quaries |
|
194 |
public boolean isLoaded() { |
|
195 |
return getInitStateAsInt() >= CLASS_STATE_LOADED; |
|
196 |
} |
|
197 |
||
198 |
public boolean isLinked() { |
|
199 |
return getInitStateAsInt() >= CLASS_STATE_LINKED; |
|
200 |
} |
|
201 |
||
202 |
public boolean isInitialized() { |
|
203 |
return getInitStateAsInt() == CLASS_STATE_FULLY_INITIALIZED; |
|
204 |
} |
|
205 |
||
206 |
public boolean isNotInitialized() { |
|
207 |
return getInitStateAsInt() < CLASS_STATE_BEING_INITIALIZED; |
|
208 |
} |
|
209 |
||
210 |
public boolean isBeingInitialized() { |
|
211 |
return getInitStateAsInt() == CLASS_STATE_BEING_INITIALIZED; |
|
212 |
} |
|
213 |
||
214 |
public boolean isInErrorState() { |
|
215 |
return getInitStateAsInt() == CLASS_STATE_INITIALIZATION_ERROR; |
|
216 |
} |
|
217 |
||
218 |
public int getClassStatus() { |
|
219 |
int result = 0; |
|
220 |
if (isLinked()) { |
|
221 |
result |= JVMDIClassStatus.VERIFIED | JVMDIClassStatus.PREPARED; |
|
222 |
} |
|
223 |
||
224 |
if (isInitialized()) { |
|
225 |
if (Assert.ASSERTS_ENABLED) { |
|
226 |
Assert.that(isLinked(), "Class status is not consistent"); |
|
227 |
} |
|
228 |
result |= JVMDIClassStatus.INITIALIZED; |
|
229 |
} |
|
230 |
||
231 |
if (isInErrorState()) { |
|
232 |
result |= JVMDIClassStatus.ERROR; |
|
233 |
} |
|
234 |
return result; |
|
235 |
} |
|
236 |
||
237 |
// Byteside of the header |
|
238 |
private static long headerSize; |
|
239 |
||
8878
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
240 |
public long getObjectSize(Oop object) { |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
241 |
return getSizeHelper() * VM.getVM().getAddressSize(); |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
242 |
} |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
243 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
244 |
public long getSize() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
245 |
return Oop.alignObjectSize(getHeaderSize() + Oop.alignObjectOffset(getVtableLen()) + |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
246 |
Oop.alignObjectOffset(getItableLen()) + Oop.alignObjectOffset(getNonstaticOopMapSize())); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
247 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
248 |
|
1 | 249 |
public static long getHeaderSize() { return headerSize; } |
250 |
||
10546 | 251 |
public short getFieldAccessFlags(int index) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
252 |
return getFields().at(index * FIELD_SLOTS + ACCESS_FLAGS_OFFSET); |
10546 | 253 |
} |
254 |
||
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
255 |
public short getFieldNameIndex(int index) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
256 |
if (index >= getJavaFieldsCount()) throw new IndexOutOfBoundsException("not a Java field;"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
257 |
return getFields().at(index * FIELD_SLOTS + NAME_INDEX_OFFSET); |
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
258 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
259 |
|
10546 | 260 |
public Symbol getFieldName(int index) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
261 |
int nameIndex = getFields().at(index * FIELD_SLOTS + NAME_INDEX_OFFSET); |
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
262 |
if (index < getJavaFieldsCount()) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
263 |
return getConstants().getSymbolAt(nameIndex); |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
264 |
} else { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
265 |
return vmSymbols.symbolAt(nameIndex); |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
266 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
267 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
268 |
|
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
269 |
public short getFieldSignatureIndex(int index) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
270 |
if (index >= getJavaFieldsCount()) throw new IndexOutOfBoundsException("not a Java field;"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
271 |
return getFields().at(index * FIELD_SLOTS + SIGNATURE_INDEX_OFFSET); |
10546 | 272 |
} |
273 |
||
274 |
public Symbol getFieldSignature(int index) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
275 |
int signatureIndex = getFields().at(index * FIELD_SLOTS + SIGNATURE_INDEX_OFFSET); |
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
276 |
if (index < getJavaFieldsCount()) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
277 |
return getConstants().getSymbolAt(signatureIndex); |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
278 |
} else { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
279 |
return vmSymbols.symbolAt(signatureIndex); |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
280 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
281 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
282 |
|
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
283 |
public short getFieldGenericSignatureIndex(int index) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
284 |
// int len = getFields().length(); |
12772
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
285 |
int allFieldsCount = getAllFieldsCount(); |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
286 |
int generic_signature_slot = allFieldsCount * FIELD_SLOTS; |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
287 |
for (int i = 0; i < allFieldsCount; i++) { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
288 |
short flags = getFieldAccessFlags(i); |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
289 |
AccessFlags access = new AccessFlags(flags); |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
290 |
if (i == index) { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
291 |
if (access.fieldHasGenericSignature()) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
292 |
return getFields().at(generic_signature_slot); |
12772
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
293 |
} else { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
294 |
return 0; |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
295 |
} |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
296 |
} else { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
297 |
if (access.fieldHasGenericSignature()) { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
298 |
generic_signature_slot ++; |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
299 |
} |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
300 |
} |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
301 |
} |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
302 |
return 0; |
10546 | 303 |
} |
304 |
||
305 |
public Symbol getFieldGenericSignature(int index) { |
|
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
306 |
short genericSignatureIndex = getFieldGenericSignatureIndex(index); |
10546 | 307 |
if (genericSignatureIndex != 0) { |
308 |
return getConstants().getSymbolAt(genericSignatureIndex); |
|
309 |
} |
|
310 |
return null; |
|
311 |
} |
|
312 |
||
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
313 |
public short getFieldInitialValueIndex(int index) { |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
314 |
if (index >= getJavaFieldsCount()) throw new IndexOutOfBoundsException("not a Java field;"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
315 |
return getFields().at(index * FIELD_SLOTS + INITVAL_INDEX_OFFSET); |
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
316 |
} |
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
317 |
|
10546 | 318 |
public int getFieldOffset(int index) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
319 |
U2Array fields = getFields(); |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
320 |
short lo = fields.at(index * FIELD_SLOTS + LOW_OFFSET); |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
321 |
short hi = fields.at(index * FIELD_SLOTS + HIGH_OFFSET); |
15225
40677d8847bd
8006403: Regression: jstack failed due to the FieldInfo regression in SA
sla
parents:
15193
diff
changeset
|
322 |
if ((lo & FIELDINFO_TAG_MASK) == FIELDINFO_TAG_OFFSET) { |
15193
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
323 |
return VM.getVM().buildIntFromShorts(lo, hi) >> FIELDINFO_TAG_SIZE; |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
324 |
} |
8e6b5694267f
8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents:
14477
diff
changeset
|
325 |
throw new RuntimeException("should not reach here"); |
10546 | 326 |
} |
327 |
||
1 | 328 |
// Accessors for declared fields |
329 |
public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
330 |
public MethodArray getMethods() { return new MethodArray(methods.getValue(getAddress())); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
331 |
public KlassArray getLocalInterfaces() { return new KlassArray(localInterfaces.getValue(getAddress())); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
332 |
public KlassArray getTransitiveInterfaces() { return new KlassArray(transitiveInterfaces.getValue(getAddress())); } |
10546 | 333 |
public int getJavaFieldsCount() { return (int) javaFieldsCount.getValue(this); } |
12772
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
334 |
public int getAllFieldsCount() { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
335 |
int len = getFields().length(); |
12772
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
336 |
int allFieldsCount = 0; |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
337 |
for (; allFieldsCount*FIELD_SLOTS < len; allFieldsCount++) { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
338 |
short flags = getFieldAccessFlags(allFieldsCount); |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
339 |
AccessFlags access = new AccessFlags(flags); |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
340 |
if (access.fieldHasGenericSignature()) { |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
341 |
len --; |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
342 |
} |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
343 |
} |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
344 |
return allFieldsCount; |
d317e5e08194
7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents:
12369
diff
changeset
|
345 |
} |
1 | 346 |
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
347 |
public ClassLoaderData getClassLoaderData() { return ClassLoaderData.instantiateWrapperFor(classLoaderData.getValue(getAddress())); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
348 |
public Oop getClassLoader() { return getClassLoaderData().getClassLoader(); } |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
349 |
public Symbol getSourceFileName() { return getSymbol(sourceFileName); } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
350 |
public String getSourceDebugExtension(){ return CStringUtilities.getString(sourceDebugExtension.getValue(getAddress())); } |
1 | 351 |
public long getNonstaticFieldSize() { return nonstaticFieldSize.getValue(this); } |
8725
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
8076
diff
changeset
|
352 |
public long getStaticOopFieldCount() { return staticOopFieldCount.getValue(this); } |
1 | 353 |
public long getNonstaticOopMapSize() { return nonstaticOopMapSize.getValue(this); } |
11440
dea12ec80745
7129240: backout fix for 7102776 until 7128770 is resolved
dcubed
parents:
11405
diff
changeset
|
354 |
public boolean getIsMarkedDependent() { return isMarkedDependent.getValue(this) != 0; } |
1 | 355 |
public long getVtableLen() { return vtableLen.getValue(this); } |
356 |
public long getItableLen() { return itableLen.getValue(this); } |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
357 |
public Symbol getGenericSignature() { return getSymbol(genericSignature); } |
1 | 358 |
public long majorVersion() { return majorVersion.getValue(this); } |
359 |
public long minorVersion() { return minorVersion.getValue(this); } |
|
360 |
||
361 |
// "size helper" == instance size in words |
|
362 |
public long getSizeHelper() { |
|
363 |
int lh = getLayoutHelper(); |
|
364 |
if (Assert.ASSERTS_ENABLED) { |
|
365 |
Assert.that(lh > 0, "layout helper initialized for instance class"); |
|
366 |
} |
|
367 |
return lh / VM.getVM().getAddressSize(); |
|
368 |
} |
|
369 |
||
370 |
// same as enum InnerClassAttributeOffset in VM code. |
|
371 |
public static interface InnerClassAttributeOffset { |
|
372 |
// from JVM spec. "InnerClasses" attribute |
|
373 |
public static final int innerClassInnerClassInfoOffset = 0; |
|
374 |
public static final int innerClassOuterClassInfoOffset = 1; |
|
375 |
public static final int innerClassInnerNameOffset = 2; |
|
376 |
public static final int innerClassAccessFlagsOffset = 3; |
|
377 |
public static final int innerClassNextOffset = 4; |
|
378 |
}; |
|
379 |
||
12231
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
380 |
public static interface EnclosingMethodAttributeOffset { |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
381 |
public static final int enclosing_method_class_index_offset = 0; |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
382 |
public static final int enclosing_method_method_index_offset = 1; |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
383 |
public static final int enclosing_method_attribute_size = 2; |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
384 |
}; |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
385 |
|
1 | 386 |
// refer to compute_modifier_flags in VM code. |
387 |
public long computeModifierFlags() { |
|
388 |
long access = getAccessFlags(); |
|
389 |
// But check if it happens to be member class. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
390 |
U2Array innerClassList = getInnerClasses(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
391 |
int length = (innerClassList == null)? 0 : (int) innerClassList.length(); |
1 | 392 |
if (length > 0) { |
393 |
if (Assert.ASSERTS_ENABLED) { |
|
12231
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
394 |
Assert.that(length % InnerClassAttributeOffset.innerClassNextOffset == 0 || |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
395 |
length % InnerClassAttributeOffset.innerClassNextOffset == EnclosingMethodAttributeOffset.enclosing_method_attribute_size, |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
396 |
"just checking"); |
1 | 397 |
} |
398 |
for (int i = 0; i < length; i += InnerClassAttributeOffset.innerClassNextOffset) { |
|
12231
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
399 |
if (i == length - EnclosingMethodAttributeOffset.enclosing_method_attribute_size) { |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
400 |
break; |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
401 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
402 |
int ioff = innerClassList.at(i + |
1 | 403 |
InnerClassAttributeOffset.innerClassInnerClassInfoOffset); |
404 |
// 'ioff' can be zero. |
|
405 |
// refer to JVM spec. section 4.7.5. |
|
406 |
if (ioff != 0) { |
|
407 |
// only look at classes that are already loaded |
|
408 |
// since we are looking for the flags for our self. |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
409 |
ConstantPool.CPSlot classInfo = getConstants().getSlotAt(ioff); |
1 | 410 |
Symbol name = null; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
411 |
if (classInfo.isResolved()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
412 |
name = classInfo.getKlass().getName(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
413 |
} else if (classInfo.isUnresolved()) { |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
414 |
name = classInfo.getSymbol(); |
1 | 415 |
} else { |
416 |
throw new RuntimeException("should not reach here"); |
|
417 |
} |
|
418 |
||
419 |
if (name.equals(getName())) { |
|
420 |
// This is really a member class |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
421 |
access = innerClassList.at(i + |
1 | 422 |
InnerClassAttributeOffset.innerClassAccessFlagsOffset); |
423 |
break; |
|
424 |
} |
|
425 |
} |
|
426 |
} // for inner classes |
|
427 |
} |
|
428 |
||
429 |
// Remember to strip ACC_SUPER bit |
|
430 |
return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; |
|
431 |
} |
|
432 |
||
433 |
||
434 |
// whether given Symbol is name of an inner/nested Klass of this Klass? |
|
435 |
// anonymous and local classes are excluded. |
|
436 |
public boolean isInnerClassName(Symbol sym) { |
|
437 |
return isInInnerClasses(sym, false); |
|
438 |
} |
|
439 |
||
440 |
// whether given Symbol is name of an inner/nested Klass of this Klass? |
|
441 |
// anonymous classes excluded, but local classes are included. |
|
442 |
public boolean isInnerOrLocalClassName(Symbol sym) { |
|
443 |
return isInInnerClasses(sym, true); |
|
444 |
} |
|
445 |
||
446 |
private boolean isInInnerClasses(Symbol sym, boolean includeLocals) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
447 |
U2Array innerClassList = getInnerClasses(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
448 |
int length = ( innerClassList == null)? 0 : (int) innerClassList.length(); |
1 | 449 |
if (length > 0) { |
450 |
if (Assert.ASSERTS_ENABLED) { |
|
12231
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
451 |
Assert.that(length % InnerClassAttributeOffset.innerClassNextOffset == 0 || |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
452 |
length % InnerClassAttributeOffset.innerClassNextOffset == EnclosingMethodAttributeOffset.enclosing_method_attribute_size, |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
453 |
"just checking"); |
1 | 454 |
} |
455 |
for (int i = 0; i < length; i += InnerClassAttributeOffset.innerClassNextOffset) { |
|
12231
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
456 |
if (i == length - EnclosingMethodAttributeOffset.enclosing_method_attribute_size) { |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
457 |
break; |
6a9cfc59a18a
7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents:
11440
diff
changeset
|
458 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
459 |
int ioff = innerClassList.at(i + |
1 | 460 |
InnerClassAttributeOffset.innerClassInnerClassInfoOffset); |
461 |
// 'ioff' can be zero. |
|
462 |
// refer to JVM spec. section 4.7.5. |
|
463 |
if (ioff != 0) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
464 |
ConstantPool.CPSlot iclassInfo = getConstants().getSlotAt(ioff); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
465 |
Symbol innerName = getConstants().getKlassNameAt(ioff); |
1 | 466 |
Symbol myname = getName(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
467 |
int ooff = innerClassList.at(i + |
1 | 468 |
InnerClassAttributeOffset.innerClassOuterClassInfoOffset); |
469 |
// for anonymous classes inner_name_index of InnerClasses |
|
470 |
// attribute is zero. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
471 |
int innerNameIndex = innerClassList.at(i + |
1 | 472 |
InnerClassAttributeOffset.innerClassInnerNameOffset); |
473 |
// if this is not a member (anonymous, local etc.), 'ooff' will be zero |
|
474 |
// refer to JVM spec. section 4.7.5. |
|
475 |
if (ooff == 0) { |
|
476 |
if (includeLocals) { |
|
477 |
// does it looks like my local class? |
|
478 |
if (innerName.equals(sym) && |
|
479 |
innerName.asString().startsWith(myname.asString())) { |
|
480 |
// exclude anonymous classes. |
|
481 |
return (innerNameIndex != 0); |
|
482 |
} |
|
483 |
} |
|
484 |
} else { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
485 |
ConstantPool.CPSlot oclassInfo = getConstants().getSlotAt(ooff); |
1 | 486 |
Symbol outerName = null; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
487 |
if (oclassInfo.isResolved()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
488 |
outerName = oclassInfo.getKlass().getName(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
489 |
} else if (oclassInfo.isUnresolved()) { |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
490 |
outerName = oclassInfo.getSymbol(); |
1 | 491 |
} else { |
492 |
throw new RuntimeException("should not reach here"); |
|
493 |
} |
|
494 |
||
495 |
// include only if current class is outer class. |
|
496 |
if (outerName.equals(myname) && innerName.equals(sym)) { |
|
497 |
return true; |
|
498 |
} |
|
499 |
} |
|
500 |
} |
|
501 |
} // for inner classes |
|
502 |
return false; |
|
503 |
} else { |
|
504 |
return false; |
|
505 |
} |
|
506 |
} |
|
507 |
||
508 |
public boolean implementsInterface(Klass k) { |
|
509 |
if (Assert.ASSERTS_ENABLED) { |
|
510 |
Assert.that(k.isInterface(), "should not reach here"); |
|
511 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
512 |
KlassArray interfaces = getTransitiveInterfaces(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
513 |
final int len = interfaces.length(); |
1 | 514 |
for (int i = 0; i < len; i++) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
515 |
if (interfaces.getAt(i).equals(k)) return true; |
1 | 516 |
} |
517 |
return false; |
|
518 |
} |
|
519 |
||
520 |
boolean computeSubtypeOf(Klass k) { |
|
521 |
if (k.isInterface()) { |
|
522 |
return implementsInterface(k); |
|
523 |
} else { |
|
524 |
return super.computeSubtypeOf(k); |
|
525 |
} |
|
526 |
} |
|
527 |
||
528 |
public void printValueOn(PrintStream tty) { |
|
529 |
tty.print("InstanceKlass for " + getName().asString()); |
|
530 |
} |
|
531 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
532 |
public void iterateFields(MetadataVisitor visitor) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
533 |
super.iterateFields(visitor); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
534 |
visitor.doMetadata(arrayKlasses, true); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
535 |
// visitor.doOop(methods, true); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
536 |
// visitor.doOop(localInterfaces, true); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
537 |
// visitor.doOop(transitiveInterfaces, true); |
1 | 538 |
visitor.doCInt(nonstaticFieldSize, true); |
539 |
visitor.doCInt(staticFieldSize, true); |
|
8725
8c1e3dd5fe1b
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
8076
diff
changeset
|
540 |
visitor.doCInt(staticOopFieldCount, true); |
1 | 541 |
visitor.doCInt(nonstaticOopMapSize, true); |
11440
dea12ec80745
7129240: backout fix for 7102776 until 7128770 is resolved
dcubed
parents:
11405
diff
changeset
|
542 |
visitor.doCInt(isMarkedDependent, true); |
1 | 543 |
visitor.doCInt(initState, true); |
544 |
visitor.doCInt(vtableLen, true); |
|
545 |
visitor.doCInt(itableLen, true); |
|
546 |
} |
|
547 |
||
8878
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
548 |
/* |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
549 |
* Visit the static fields of this InstanceKlass with the obj of |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
550 |
* the visitor set to the oop holding the fields, which is |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
551 |
* currently the java mirror. |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
552 |
*/ |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
553 |
public void iterateStaticFields(OopVisitor visitor) { |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
554 |
visitor.setObj(getJavaMirror()); |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
555 |
visitor.prologue(); |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
556 |
iterateStaticFieldsInternal(visitor); |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
557 |
visitor.epilogue(); |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
558 |
|
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
559 |
} |
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
560 |
|
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
561 |
void iterateStaticFieldsInternal(OopVisitor visitor) { |
10546 | 562 |
int length = getJavaFieldsCount(); |
10552 | 563 |
for (int index = 0; index < length; index++) { |
564 |
short accessFlags = getFieldAccessFlags(index); |
|
565 |
FieldType type = new FieldType(getFieldSignature(index)); |
|
1 | 566 |
AccessFlags access = new AccessFlags(accessFlags); |
567 |
if (access.isStatic()) { |
|
568 |
visitField(visitor, type, index); |
|
569 |
} |
|
570 |
} |
|
571 |
} |
|
572 |
||
573 |
public Klass getJavaSuper() { |
|
574 |
return getSuper(); |
|
575 |
} |
|
576 |
||
10547 | 577 |
public static class StaticField { |
578 |
public AccessFlags flags; |
|
579 |
public Field field; |
|
580 |
||
581 |
StaticField(Field field, AccessFlags flags) { |
|
582 |
this.field = field; |
|
583 |
this.flags = flags; |
|
584 |
} |
|
585 |
} |
|
586 |
||
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
587 |
public Field[] getStaticFields() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
588 |
U2Array fields = getFields(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
589 |
int length = getJavaFieldsCount(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
590 |
ArrayList result = new ArrayList(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
591 |
for (int index = 0; index < length; index++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
592 |
Field f = newField(index); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
593 |
if (f.isStatic()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
594 |
result.add(f); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
595 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
596 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
597 |
return (Field[])result.toArray(new Field[result.size()]); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
598 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
599 |
|
8878
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
600 |
public void iterateNonStaticFields(OopVisitor visitor, Oop obj) { |
1 | 601 |
if (getSuper() != null) { |
8878
a6283814032c
7031614: jmap -permstat fails with java.lang.InternalError in sun.jvm.hotspot.oops.OopField.getValue
never
parents:
8725
diff
changeset
|
602 |
((InstanceKlass) getSuper()).iterateNonStaticFields(visitor, obj); |
1 | 603 |
} |
10546 | 604 |
int length = getJavaFieldsCount(); |
10552 | 605 |
for (int index = 0; index < length; index++) { |
606 |
short accessFlags = getFieldAccessFlags(index); |
|
607 |
FieldType type = new FieldType(getFieldSignature(index)); |
|
1 | 608 |
AccessFlags access = new AccessFlags(accessFlags); |
609 |
if (!access.isStatic()) { |
|
610 |
visitField(visitor, type, index); |
|
611 |
} |
|
612 |
} |
|
613 |
} |
|
614 |
||
615 |
/** Field access by name. */ |
|
616 |
public Field findLocalField(Symbol name, Symbol sig) { |
|
10567
149651837c4a
7092278: "jmap -finalizerinfo" throws "sun.jvm.hotspot.utilities.AssertionFailure: invalid cp index 0 137"
never
parents:
10552
diff
changeset
|
617 |
int length = getJavaFieldsCount(); |
10552 | 618 |
for (int i = 0; i < length; i++) { |
619 |
Symbol f_name = getFieldName(i); |
|
620 |
Symbol f_sig = getFieldSignature(i); |
|
1 | 621 |
if (name.equals(f_name) && sig.equals(f_sig)) { |
622 |
return newField(i); |
|
623 |
} |
|
624 |
} |
|
625 |
||
626 |
return null; |
|
627 |
} |
|
628 |
||
629 |
/** Find field in direct superinterfaces. */ |
|
630 |
public Field findInterfaceField(Symbol name, Symbol sig) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
631 |
KlassArray interfaces = getLocalInterfaces(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
632 |
int n = interfaces.length(); |
1 | 633 |
for (int i = 0; i < n; i++) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
634 |
InstanceKlass intf1 = (InstanceKlass) interfaces.getAt(i); |
1 | 635 |
if (Assert.ASSERTS_ENABLED) { |
636 |
Assert.that(intf1.isInterface(), "just checking type"); |
|
637 |
} |
|
638 |
// search for field in current interface |
|
639 |
Field f = intf1.findLocalField(name, sig); |
|
640 |
if (f != null) { |
|
641 |
if (Assert.ASSERTS_ENABLED) { |
|
642 |
Assert.that(f.getAccessFlagsObj().isStatic(), "interface field must be static"); |
|
643 |
} |
|
644 |
return f; |
|
645 |
} |
|
646 |
// search for field in direct superinterfaces |
|
647 |
f = intf1.findInterfaceField(name, sig); |
|
648 |
if (f != null) return f; |
|
649 |
} |
|
650 |
// otherwise field lookup fails |
|
651 |
return null; |
|
652 |
} |
|
653 |
||
654 |
/** Find field according to JVM spec 5.4.3.2, returns the klass in |
|
655 |
which the field is defined. */ |
|
656 |
public Field findField(Symbol name, Symbol sig) { |
|
657 |
// search order according to newest JVM spec (5.4.3.2, p.167). |
|
658 |
// 1) search for field in current klass |
|
659 |
Field f = findLocalField(name, sig); |
|
660 |
if (f != null) return f; |
|
661 |
||
662 |
// 2) search for field recursively in direct superinterfaces |
|
663 |
f = findInterfaceField(name, sig); |
|
664 |
if (f != null) return f; |
|
665 |
||
666 |
// 3) apply field lookup recursively if superclass exists |
|
667 |
InstanceKlass supr = (InstanceKlass) getSuper(); |
|
668 |
if (supr != null) return supr.findField(name, sig); |
|
669 |
||
670 |
// 4) otherwise field lookup fails |
|
671 |
return null; |
|
672 |
} |
|
673 |
||
674 |
/** Find field according to JVM spec 5.4.3.2, returns the klass in |
|
675 |
which the field is defined (convenience routine) */ |
|
676 |
public Field findField(String name, String sig) { |
|
677 |
SymbolTable symbols = VM.getVM().getSymbolTable(); |
|
678 |
Symbol nameSym = symbols.probe(name); |
|
679 |
Symbol sigSym = symbols.probe(sig); |
|
680 |
if (nameSym == null || sigSym == null) { |
|
681 |
return null; |
|
682 |
} |
|
683 |
return findField(nameSym, sigSym); |
|
684 |
} |
|
685 |
||
686 |
/** Find field according to JVM spec 5.4.3.2, returns the klass in |
|
687 |
which the field is defined (retained only for backward |
|
688 |
compatibility with jdbx) */ |
|
689 |
public Field findFieldDbg(String name, String sig) { |
|
690 |
return findField(name, sig); |
|
691 |
} |
|
692 |
||
693 |
/** Get field by its index in the fields array. Only designed for |
|
694 |
use in a debugging system. */ |
|
10552 | 695 |
public Field getFieldByIndex(int fieldIndex) { |
696 |
return newField(fieldIndex); |
|
1 | 697 |
} |
698 |
||
699 |
||
700 |
/** Return a List of SA Fields for the fields declared in this class. |
|
701 |
Inherited fields are not included. |
|
702 |
Return an empty list if there are no fields declared in this class. |
|
703 |
Only designed for use in a debugging system. */ |
|
704 |
public List getImmediateFields() { |
|
705 |
// A list of Fields for each field declared in this class/interface, |
|
706 |
// not including inherited fields. |
|
10546 | 707 |
int length = getJavaFieldsCount(); |
708 |
List immediateFields = new ArrayList(length); |
|
10552 | 709 |
for (int index = 0; index < length; index++) { |
1 | 710 |
immediateFields.add(getFieldByIndex(index)); |
711 |
} |
|
712 |
||
713 |
return immediateFields; |
|
714 |
} |
|
715 |
||
716 |
/** Return a List of SA Fields for all the java fields in this class, |
|
717 |
including all inherited fields. This includes hidden |
|
718 |
fields. Thus the returned list can contain fields with |
|
719 |
the same name. |
|
720 |
Return an empty list if there are no fields. |
|
721 |
Only designed for use in a debugging system. */ |
|
722 |
public List getAllFields() { |
|
723 |
// Contains a Field for each field in this class, including immediate |
|
724 |
// fields and inherited fields. |
|
725 |
List allFields = getImmediateFields(); |
|
726 |
||
727 |
// transitiveInterfaces contains all interfaces implemented |
|
728 |
// by this class and its superclass chain with no duplicates. |
|
729 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
730 |
KlassArray interfaces = getTransitiveInterfaces(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
731 |
int n = interfaces.length(); |
1 | 732 |
for (int i = 0; i < n; i++) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
733 |
InstanceKlass intf1 = (InstanceKlass) interfaces.getAt(i); |
1 | 734 |
if (Assert.ASSERTS_ENABLED) { |
735 |
Assert.that(intf1.isInterface(), "just checking type"); |
|
736 |
} |
|
737 |
allFields.addAll(intf1.getImmediateFields()); |
|
738 |
} |
|
739 |
||
740 |
// Get all fields in the superclass, recursively. But, don't |
|
741 |
// include fields in interfaces implemented by superclasses; |
|
742 |
// we already have all those. |
|
743 |
if (!isInterface()) { |
|
744 |
InstanceKlass supr; |
|
745 |
if ( (supr = (InstanceKlass) getSuper()) != null) { |
|
746 |
allFields.addAll(supr.getImmediateFields()); |
|
747 |
} |
|
748 |
} |
|
749 |
||
750 |
return allFields; |
|
751 |
} |
|
752 |
||
753 |
||
754 |
/** Return a List of SA Methods declared directly in this class/interface. |
|
755 |
Return an empty list if there are none, or if this isn't a class/ |
|
756 |
interface. |
|
757 |
*/ |
|
758 |
public List getImmediateMethods() { |
|
759 |
// Contains a Method for each method declared in this class/interface |
|
760 |
// not including inherited methods. |
|
761 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
762 |
MethodArray methods = getMethods(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
763 |
int length = methods.length(); |
1 | 764 |
Object[] tmp = new Object[length]; |
765 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
766 |
IntArray methodOrdering = getMethodOrdering(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
767 |
if (methodOrdering.length() != length) { |
1 | 768 |
// no ordering info present |
769 |
for (int index = 0; index < length; index++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
770 |
tmp[index] = methods.at(index); |
1 | 771 |
} |
772 |
} else { |
|
773 |
for (int index = 0; index < length; index++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
774 |
int originalIndex = methodOrdering.at(index); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
775 |
tmp[originalIndex] = methods.at(index); |
1 | 776 |
} |
777 |
} |
|
778 |
||
779 |
return Arrays.asList(tmp); |
|
780 |
} |
|
781 |
||
782 |
/** Return a List containing an SA InstanceKlass for each |
|
783 |
interface named in this class's 'implements' clause. |
|
784 |
*/ |
|
785 |
public List getDirectImplementedInterfaces() { |
|
786 |
// Contains an InstanceKlass for each interface in this classes |
|
787 |
// 'implements' clause. |
|
788 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
789 |
KlassArray interfaces = getLocalInterfaces(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
790 |
int length = interfaces.length(); |
1 | 791 |
List directImplementedInterfaces = new ArrayList(length); |
792 |
||
793 |
for (int index = 0; index < length; index ++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
794 |
directImplementedInterfaces.add(interfaces.getAt(index)); |
1 | 795 |
} |
796 |
||
797 |
return directImplementedInterfaces; |
|
798 |
} |
|
799 |
||
800 |
public Klass arrayKlassImpl(boolean orNull, int n) { |
|
801 |
// FIXME: in reflective system this would need to change to |
|
802 |
// actually allocate |
|
803 |
if (getArrayKlasses() == null) { return null; } |
|
804 |
ObjArrayKlass oak = (ObjArrayKlass) getArrayKlasses(); |
|
805 |
if (orNull) { |
|
806 |
return oak.arrayKlassOrNull(n); |
|
807 |
} |
|
808 |
return oak.arrayKlass(n); |
|
809 |
} |
|
810 |
||
811 |
public Klass arrayKlassImpl(boolean orNull) { |
|
812 |
return arrayKlassImpl(orNull, 1); |
|
813 |
} |
|
814 |
||
815 |
public String signature() { |
|
816 |
return "L" + super.signature() + ";"; |
|
817 |
} |
|
818 |
||
819 |
/** Convenience routine taking Strings; lookup is done in |
|
820 |
SymbolTable. */ |
|
821 |
public Method findMethod(String name, String sig) { |
|
822 |
SymbolTable syms = VM.getVM().getSymbolTable(); |
|
823 |
Symbol nameSym = syms.probe(name); |
|
824 |
Symbol sigSym = syms.probe(sig); |
|
825 |
if (nameSym == null || sigSym == null) { |
|
826 |
return null; |
|
827 |
} |
|
828 |
return findMethod(nameSym, sigSym); |
|
829 |
} |
|
830 |
||
831 |
/** Find method in vtable. */ |
|
832 |
public Method findMethod(Symbol name, Symbol sig) { |
|
833 |
return findMethod(getMethods(), name, sig); |
|
834 |
} |
|
835 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
836 |
/** Breakpoint support (see methods on Method* for details) */ |
1 | 837 |
public BreakpointInfo getBreakpoints() { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
838 |
Address addr = getAddress().getAddressAt(breakpoints.getOffset()); |
1 | 839 |
return (BreakpointInfo) VMObjectFactory.newObject(BreakpointInfo.class, addr); |
840 |
} |
|
841 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
842 |
public IntArray getMethodOrdering() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
843 |
Address addr = getAddress().getAddressAt(methodOrdering.getOffset()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
844 |
return (IntArray) VMObjectFactory.newObject(IntArray.class, addr); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
845 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
846 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
847 |
public U2Array getFields() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
848 |
Address addr = getAddress().getAddressAt(fields.getOffset()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
849 |
return (U2Array) VMObjectFactory.newObject(U2Array.class, addr); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
850 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
851 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
852 |
public U2Array getInnerClasses() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
853 |
Address addr = getAddress().getAddressAt(innerClasses.getOffset()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
854 |
return (U2Array) VMObjectFactory.newObject(U2Array.class, addr); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
855 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
856 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
857 |
|
1 | 858 |
//---------------------------------------------------------------------- |
859 |
// Internals only below this point |
|
860 |
// |
|
861 |
||
862 |
private void visitField(OopVisitor visitor, FieldType type, int index) { |
|
863 |
Field f = newField(index); |
|
864 |
if (type.isOop()) { |
|
865 |
visitor.doOop((OopField) f, false); |
|
866 |
return; |
|
867 |
} |
|
868 |
if (type.isByte()) { |
|
869 |
visitor.doByte((ByteField) f, false); |
|
870 |
return; |
|
871 |
} |
|
872 |
if (type.isChar()) { |
|
873 |
visitor.doChar((CharField) f, false); |
|
874 |
return; |
|
875 |
} |
|
876 |
if (type.isDouble()) { |
|
877 |
visitor.doDouble((DoubleField) f, false); |
|
878 |
return; |
|
879 |
} |
|
880 |
if (type.isFloat()) { |
|
881 |
visitor.doFloat((FloatField) f, false); |
|
882 |
return; |
|
883 |
} |
|
884 |
if (type.isInt()) { |
|
885 |
visitor.doInt((IntField) f, false); |
|
886 |
return; |
|
887 |
} |
|
888 |
if (type.isLong()) { |
|
889 |
visitor.doLong((LongField) f, false); |
|
890 |
return; |
|
891 |
} |
|
892 |
if (type.isShort()) { |
|
893 |
visitor.doShort((ShortField) f, false); |
|
894 |
return; |
|
895 |
} |
|
896 |
if (type.isBoolean()) { |
|
897 |
visitor.doBoolean((BooleanField) f, false); |
|
898 |
return; |
|
899 |
} |
|
900 |
} |
|
901 |
||
902 |
// Creates new field from index in fields TypeArray |
|
903 |
private Field newField(int index) { |
|
10552 | 904 |
FieldType type = new FieldType(getFieldSignature(index)); |
1 | 905 |
if (type.isOop()) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
906 |
if (VM.getVM().isCompressedOopsEnabled()) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
907 |
return new NarrowOopField(this, index); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
908 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
909 |
return new OopField(this, index); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
910 |
} |
1 | 911 |
} |
912 |
if (type.isByte()) { |
|
913 |
return new ByteField(this, index); |
|
914 |
} |
|
915 |
if (type.isChar()) { |
|
916 |
return new CharField(this, index); |
|
917 |
} |
|
918 |
if (type.isDouble()) { |
|
919 |
return new DoubleField(this, index); |
|
920 |
} |
|
921 |
if (type.isFloat()) { |
|
922 |
return new FloatField(this, index); |
|
923 |
} |
|
924 |
if (type.isInt()) { |
|
925 |
return new IntField(this, index); |
|
926 |
} |
|
927 |
if (type.isLong()) { |
|
928 |
return new LongField(this, index); |
|
929 |
} |
|
930 |
if (type.isShort()) { |
|
931 |
return new ShortField(this, index); |
|
932 |
} |
|
933 |
if (type.isBoolean()) { |
|
934 |
return new BooleanField(this, index); |
|
935 |
} |
|
936 |
throw new RuntimeException("Illegal field type at index " + index); |
|
937 |
} |
|
938 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
939 |
private static Method findMethod(MethodArray methods, Symbol name, Symbol signature) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
940 |
int len = methods.length(); |
1 | 941 |
// methods are sorted, so do binary search |
942 |
int l = 0; |
|
943 |
int h = len - 1; |
|
944 |
while (l <= h) { |
|
945 |
int mid = (l + h) >> 1; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
946 |
Method m = methods.at(mid); |
1 | 947 |
int res = m.getName().fastCompare(name); |
948 |
if (res == 0) { |
|
949 |
// found matching name; do linear search to find matching signature |
|
950 |
// first, quick check for common case |
|
951 |
if (m.getSignature().equals(signature)) return m; |
|
952 |
// search downwards through overloaded methods |
|
953 |
int i; |
|
954 |
for (i = mid - 1; i >= l; i--) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
955 |
Method m1 = methods.at(i); |
1 | 956 |
if (!m1.getName().equals(name)) break; |
957 |
if (m1.getSignature().equals(signature)) return m1; |
|
958 |
} |
|
959 |
// search upwards |
|
960 |
for (i = mid + 1; i <= h; i++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
961 |
Method m1 = methods.at(i); |
1 | 962 |
if (!m1.getName().equals(name)) break; |
963 |
if (m1.getSignature().equals(signature)) return m1; |
|
964 |
} |
|
965 |
// not found |
|
966 |
if (Assert.ASSERTS_ENABLED) { |
|
967 |
int index = linearSearch(methods, name, signature); |
|
968 |
if (index != -1) { |
|
969 |
throw new DebuggerException("binary search bug: should have found entry " + index); |
|
970 |
} |
|
971 |
} |
|
972 |
return null; |
|
973 |
} else if (res < 0) { |
|
974 |
l = mid + 1; |
|
975 |
} else { |
|
976 |
h = mid - 1; |
|
977 |
} |
|
978 |
} |
|
979 |
if (Assert.ASSERTS_ENABLED) { |
|
980 |
int index = linearSearch(methods, name, signature); |
|
981 |
if (index != -1) { |
|
982 |
throw new DebuggerException("binary search bug: should have found entry " + index); |
|
983 |
} |
|
984 |
} |
|
985 |
return null; |
|
986 |
} |
|
987 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
988 |
private static int linearSearch(MethodArray methods, Symbol name, Symbol signature) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
989 |
int len = (int) methods.length(); |
1 | 990 |
for (int index = 0; index < len; index++) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13201
diff
changeset
|
991 |
Method m = methods.at(index); |
1 | 992 |
if (m.getSignature().equals(signature) && m.getName().equals(name)) { |
993 |
return index; |
|
994 |
} |
|
995 |
} |
|
996 |
return -1; |
|
997 |
} |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
998 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
999 |
public void dumpReplayData(PrintStream out) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1000 |
ConstantPool cp = getConstants(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1001 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1002 |
// Try to record related loaded classes |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1003 |
Klass sub = getSubklassKlass(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1004 |
while (sub != null) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1005 |
if (sub instanceof InstanceKlass) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1006 |
out.println("instanceKlass " + sub.getName().asString()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1007 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1008 |
sub = sub.getNextSiblingKlass(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1009 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1010 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1011 |
final int length = (int) cp.getLength(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1012 |
out.print("ciInstanceKlass " + getName().asString() + " " + (isLinked() ? 1 : 0) + " " + (isInitialized() ? 1 : 0) + " " + length); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1013 |
for (int index = 1; index < length; index++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1014 |
out.print(" " + cp.getTags().at(index)); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1015 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1016 |
out.println(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1017 |
if (isInitialized()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1018 |
Field[] staticFields = getStaticFields(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1019 |
for (int i = 0; i < staticFields.length; i++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1020 |
Field f = staticFields[i]; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1021 |
Oop mirror = getJavaMirror(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1022 |
if (f.isFinal() && !f.hasInitialValue()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1023 |
out.print("staticfield " + getName().asString() + " " + |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1024 |
OopUtilities.escapeString(f.getID().getName()) + " " + |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1025 |
f.getFieldType().getSignature().asString() + " "); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1026 |
if (f instanceof ByteField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1027 |
ByteField bf = (ByteField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1028 |
out.println(bf.getValue(mirror)); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1029 |
} else if (f instanceof BooleanField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1030 |
BooleanField bf = (BooleanField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1031 |
out.println(bf.getValue(mirror) ? 1 : 0); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1032 |
} else if (f instanceof ShortField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1033 |
ShortField bf = (ShortField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1034 |
out.println(bf.getValue(mirror)); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1035 |
} else if (f instanceof CharField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1036 |
CharField bf = (CharField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1037 |
out.println(bf.getValue(mirror) & 0xffff); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1038 |
} else if (f instanceof IntField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1039 |
IntField bf = (IntField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1040 |
out.println(bf.getValue(mirror)); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1041 |
} else if (f instanceof LongField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1042 |
LongField bf = (LongField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1043 |
out.println(bf.getValue(mirror)); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1044 |
} else if (f instanceof FloatField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1045 |
FloatField bf = (FloatField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1046 |
out.println(Float.floatToRawIntBits(bf.getValue(mirror))); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1047 |
} else if (f instanceof DoubleField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1048 |
DoubleField bf = (DoubleField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1049 |
out.println(Double.doubleToRawLongBits(bf.getValue(mirror))); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1050 |
} else if (f instanceof OopField) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1051 |
OopField bf = (OopField)f; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1052 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1053 |
Oop value = bf.getValue(mirror); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1054 |
if (value == null) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1055 |
out.println("null"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1056 |
} else if (value.isInstance()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1057 |
Instance inst = (Instance)value; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1058 |
if (inst.isA(SystemDictionary.getStringKlass())) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1059 |
out.println("\"" + OopUtilities.stringOopToEscapedString(inst) + "\""); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1060 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1061 |
out.println(inst.getKlass().getName().asString()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1062 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1063 |
} else if (value.isObjArray()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1064 |
ObjArray oa = (ObjArray)value; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1065 |
Klass ek = (ObjArrayKlass)oa.getKlass(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1066 |
out.println(oa.getLength() + " " + ek.getName().asString()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1067 |
} else if (value.isTypeArray()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1068 |
TypeArray ta = (TypeArray)value; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1069 |
out.println(ta.getLength()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1070 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1071 |
out.println(value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1072 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1073 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1074 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1075 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1076 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
1077 |
} |
1 | 1078 |
} |