1 /* |
1 /* |
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
50 private static int INITVAL_INDEX_OFFSET; |
50 private static int INITVAL_INDEX_OFFSET; |
51 private static int LOW_OFFSET; |
51 private static int LOW_OFFSET; |
52 private static int HIGH_OFFSET; |
52 private static int HIGH_OFFSET; |
53 private static int GENERIC_SIGNATURE_INDEX_OFFSET; |
53 private static int GENERIC_SIGNATURE_INDEX_OFFSET; |
54 private static int FIELD_SLOTS; |
54 private static int FIELD_SLOTS; |
55 public static int IMPLEMENTORS_LIMIT; |
|
56 |
55 |
57 // ClassState constants |
56 // ClassState constants |
58 private static int CLASS_STATE_UNPARSABLE_BY_GC; |
57 private static int CLASS_STATE_UNPARSABLE_BY_GC; |
59 private static int CLASS_STATE_ALLOCATED; |
58 private static int CLASS_STATE_ALLOCATED; |
60 private static int CLASS_STATE_LOADED; |
59 private static int CLASS_STATE_LOADED; |
68 arrayKlasses = new OopField(type.getOopField("_array_klasses"), Oop.getHeaderSize()); |
67 arrayKlasses = new OopField(type.getOopField("_array_klasses"), Oop.getHeaderSize()); |
69 methods = new OopField(type.getOopField("_methods"), Oop.getHeaderSize()); |
68 methods = new OopField(type.getOopField("_methods"), Oop.getHeaderSize()); |
70 methodOrdering = new OopField(type.getOopField("_method_ordering"), Oop.getHeaderSize()); |
69 methodOrdering = new OopField(type.getOopField("_method_ordering"), Oop.getHeaderSize()); |
71 localInterfaces = new OopField(type.getOopField("_local_interfaces"), Oop.getHeaderSize()); |
70 localInterfaces = new OopField(type.getOopField("_local_interfaces"), Oop.getHeaderSize()); |
72 transitiveInterfaces = new OopField(type.getOopField("_transitive_interfaces"), Oop.getHeaderSize()); |
71 transitiveInterfaces = new OopField(type.getOopField("_transitive_interfaces"), Oop.getHeaderSize()); |
73 nofImplementors = new CIntField(type.getCIntegerField("_nof_implementors"), Oop.getHeaderSize()); |
|
74 IMPLEMENTORS_LIMIT = db.lookupIntConstant("instanceKlass::implementors_limit").intValue(); |
|
75 implementors = new OopField[IMPLEMENTORS_LIMIT]; |
|
76 for (int i = 0; i < IMPLEMENTORS_LIMIT; i++) { |
|
77 long arrayOffset = Oop.getHeaderSize() + (i * db.getAddressSize()); |
|
78 implementors[i] = new OopField(type.getOopField("_implementors[0]"), arrayOffset); |
|
79 } |
|
80 fields = new OopField(type.getOopField("_fields"), Oop.getHeaderSize()); |
72 fields = new OopField(type.getOopField("_fields"), Oop.getHeaderSize()); |
81 javaFieldsCount = new CIntField(type.getCIntegerField("_java_fields_count"), Oop.getHeaderSize()); |
73 javaFieldsCount = new CIntField(type.getCIntegerField("_java_fields_count"), Oop.getHeaderSize()); |
82 constants = new OopField(type.getOopField("_constants"), Oop.getHeaderSize()); |
74 constants = new OopField(type.getOopField("_constants"), Oop.getHeaderSize()); |
83 classLoader = new OopField(type.getOopField("_class_loader"), Oop.getHeaderSize()); |
75 classLoader = new OopField(type.getOopField("_class_loader"), Oop.getHeaderSize()); |
84 protectionDomain = new OopField(type.getOopField("_protection_domain"), Oop.getHeaderSize()); |
76 protectionDomain = new OopField(type.getOopField("_protection_domain"), Oop.getHeaderSize()); |
134 private static OopField arrayKlasses; |
126 private static OopField arrayKlasses; |
135 private static OopField methods; |
127 private static OopField methods; |
136 private static OopField methodOrdering; |
128 private static OopField methodOrdering; |
137 private static OopField localInterfaces; |
129 private static OopField localInterfaces; |
138 private static OopField transitiveInterfaces; |
130 private static OopField transitiveInterfaces; |
139 private static CIntField nofImplementors; |
|
140 private static OopField[] implementors; |
|
141 private static OopField fields; |
131 private static OopField fields; |
142 private static CIntField javaFieldsCount; |
132 private static CIntField javaFieldsCount; |
143 private static OopField constants; |
133 private static OopField constants; |
144 private static OopField classLoader; |
134 private static OopField classLoader; |
145 private static OopField protectionDomain; |
135 private static OopField protectionDomain; |
315 public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } |
305 public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } |
316 public ObjArray getMethods() { return (ObjArray) methods.getValue(this); } |
306 public ObjArray getMethods() { return (ObjArray) methods.getValue(this); } |
317 public TypeArray getMethodOrdering() { return (TypeArray) methodOrdering.getValue(this); } |
307 public TypeArray getMethodOrdering() { return (TypeArray) methodOrdering.getValue(this); } |
318 public ObjArray getLocalInterfaces() { return (ObjArray) localInterfaces.getValue(this); } |
308 public ObjArray getLocalInterfaces() { return (ObjArray) localInterfaces.getValue(this); } |
319 public ObjArray getTransitiveInterfaces() { return (ObjArray) transitiveInterfaces.getValue(this); } |
309 public ObjArray getTransitiveInterfaces() { return (ObjArray) transitiveInterfaces.getValue(this); } |
320 public long nofImplementors() { return nofImplementors.getValue(this); } |
|
321 public Klass getImplementor() { return (Klass) implementors[0].getValue(this); } |
|
322 public Klass getImplementor(int i) { return (Klass) implementors[i].getValue(this); } |
|
323 public TypeArray getFields() { return (TypeArray) fields.getValue(this); } |
310 public TypeArray getFields() { return (TypeArray) fields.getValue(this); } |
324 public int getJavaFieldsCount() { return (int) javaFieldsCount.getValue(this); } |
311 public int getJavaFieldsCount() { return (int) javaFieldsCount.getValue(this); } |
325 public int getAllFieldsCount() { return (int)getFields().getLength() / FIELD_SLOTS; } |
312 public int getAllFieldsCount() { return (int)getFields().getLength() / FIELD_SLOTS; } |
326 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } |
313 public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); } |
327 public Oop getClassLoader() { return classLoader.getValue(this); } |
314 public Oop getClassLoader() { return classLoader.getValue(this); } |
525 visitor.doOop(arrayKlasses, true); |
512 visitor.doOop(arrayKlasses, true); |
526 visitor.doOop(methods, true); |
513 visitor.doOop(methods, true); |
527 visitor.doOop(methodOrdering, true); |
514 visitor.doOop(methodOrdering, true); |
528 visitor.doOop(localInterfaces, true); |
515 visitor.doOop(localInterfaces, true); |
529 visitor.doOop(transitiveInterfaces, true); |
516 visitor.doOop(transitiveInterfaces, true); |
530 visitor.doCInt(nofImplementors, true); |
|
531 for (int i = 0; i < IMPLEMENTORS_LIMIT; i++) |
|
532 visitor.doOop(implementors[i], true); |
|
533 visitor.doOop(fields, true); |
517 visitor.doOop(fields, true); |
534 visitor.doOop(constants, true); |
518 visitor.doOop(constants, true); |
535 visitor.doOop(classLoader, true); |
519 visitor.doOop(classLoader, true); |
536 visitor.doOop(protectionDomain, true); |
520 visitor.doOop(protectionDomain, true); |
537 visitor.doOop(signers, true); |
521 visitor.doOop(signers, true); |