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