51 initialize(VM.getVM().getTypeDataBase());
52 }
53 });
54 }
55
56 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
57 type = db.lookupType("Method");
58 constMethod = type.getAddressField("_constMethod");
59 methodData = type.getAddressField("_method_data");
60 methodCounters = type.getAddressField("_method_counters");
61 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
62 code = type.getAddressField("_code");
63 vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0);
64
65 /*
66 fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
67 interpreterEntry = type.getAddressField("_from_interpreted_entry");
68 */
69
70 objectInitializerName = null;
71 classInitializerName = null;
72 }
73
74 public Method(Address addr) {
75 super(addr);
76 }
77
78 public boolean isMethod() { return true; }
79
80 // Not a Method field, used to keep type.
81 private static Type type;
82
83 // Fields
84 private static AddressField constMethod;
85 private static AddressField methodData;
86 private static AddressField methodCounters;
87 private static CIntField accessFlags;
88 private static CIntField vtableIndex;
89
90 private static AddressField code;
91 /*
92 private static AddressCField fromCompiledCodeEntryPoint;
93 private static AddressField interpreterEntry;
94 */
95
96
97 // constant method names - <init>, <clinit>
98 // Initialized lazily to avoid initialization ordering dependencies between ArrayKlass and String
99 private static String objectInitializerName;
100 private static String classInitializerName;
101 private static String objectInitializerName() {
102 if (objectInitializerName == null) {
103 objectInitializerName = "<init>";
104 }
105 return objectInitializerName;
106 }
107 private static String classInitializerName() {
108 if (classInitializerName == null) {
109 classInitializerName = "<clinit>";
110 }
111 return classInitializerName;
112 }
113
114
115 // Accessors for declared fields
116 public ConstMethod getConstMethod() {
117 Address addr = constMethod.getValue(getAddress());
118 return VMObjectFactory.newObject(ConstMethod.class, addr);
119 }
120 public ConstantPool getConstants() {
121 return getConstMethod().getConstants();
122 }
123 public boolean hasStackMapTable() {
124 return getConstMethod().hasStackMapTable();
125 }
126 public U1Array getStackMapData() {
236 // Method holder (the Klass holding this method)
237 public InstanceKlass getMethodHolder() { return getConstants().getPoolHolder(); }
238
239 // Access flags
240 public boolean isPublic() { return getAccessFlagsObj().isPublic(); }
241 public boolean isPrivate() { return getAccessFlagsObj().isPrivate(); }
242 public boolean isProtected() { return getAccessFlagsObj().isProtected(); }
243 public boolean isPackagePrivate() { AccessFlags af = getAccessFlagsObj();
244 return (!af.isPublic() && !af.isPrivate() && !af.isProtected()); }
245 public boolean isStatic() { return getAccessFlagsObj().isStatic(); }
246 public boolean isFinal() { return getAccessFlagsObj().isFinal(); }
247 public boolean isSynchronized() { return getAccessFlagsObj().isSynchronized(); }
248 public boolean isBridge() { return getAccessFlagsObj().isBridge(); }
249 public boolean isVarArgs() { return getAccessFlagsObj().isVarArgs(); }
250 public boolean isNative() { return getAccessFlagsObj().isNative(); }
251 public boolean isAbstract() { return getAccessFlagsObj().isAbstract(); }
252 public boolean isStrict() { return getAccessFlagsObj().isStrict(); }
253 public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); }
254
255 public boolean isConstructor() {
256 return (!isStatic()) && getName().equals(objectInitializerName());
257 }
258
259 public boolean isStaticInitializer() {
260 return isStatic() && getName().equals(classInitializerName());
261 }
262
263 public OopMapCacheEntry getMaskFor(int bci) {
264 OopMapCacheEntry entry = new OopMapCacheEntry();
265 entry.fill(this, bci);
266 return entry;
267 }
268
269 public long getSize() {
270 return type.getSize() + (isNative() ? 2: 0);
271 }
272
273 public void printValueOn(PrintStream tty) {
274 tty.print("Method " + getMethodHolder().getName().asString() + "." +
275 getName().asString() + getSignature().asString() + "@" + getAddress());
276 }
|
51 initialize(VM.getVM().getTypeDataBase());
52 }
53 });
54 }
55
56 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
57 type = db.lookupType("Method");
58 constMethod = type.getAddressField("_constMethod");
59 methodData = type.getAddressField("_method_data");
60 methodCounters = type.getAddressField("_method_counters");
61 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
62 code = type.getAddressField("_code");
63 vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0);
64
65 /*
66 fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
67 interpreterEntry = type.getAddressField("_from_interpreted_entry");
68 */
69
70 objectInitializerName = null;
71 valueFactoryName = null;
72 classInitializerName = null;
73 }
74
75 public Method(Address addr) {
76 super(addr);
77 }
78
79 public boolean isMethod() { return true; }
80
81 // Not a Method field, used to keep type.
82 private static Type type;
83
84 // Fields
85 private static AddressField constMethod;
86 private static AddressField methodData;
87 private static AddressField methodCounters;
88 private static CIntField accessFlags;
89 private static CIntField vtableIndex;
90
91 private static AddressField code;
92 /*
93 private static AddressCField fromCompiledCodeEntryPoint;
94 private static AddressField interpreterEntry;
95 */
96
97
98 // constant method names - <init>, <clinit>
99 // Initialized lazily to avoid initialization ordering dependencies between ArrayKlass and String
100 private static String objectInitializerName;
101 private static String valueFactoryName;
102 private static String classInitializerName;
103 private static String objectInitializerName() {
104 if (objectInitializerName == null) {
105 objectInitializerName = "<init>";
106 }
107 return objectInitializerName;
108 }
109 private static String valueFactoryName() {
110 if (valueFactoryName == null) {
111 valueFactoryName = "<vnew>";
112 }
113 return classInitializerName;
114 }
115 private static String classInitializerName() {
116 if (classInitializerName == null) {
117 classInitializerName = "<clinit>";
118 }
119 return classInitializerName;
120 }
121
122
123 // Accessors for declared fields
124 public ConstMethod getConstMethod() {
125 Address addr = constMethod.getValue(getAddress());
126 return VMObjectFactory.newObject(ConstMethod.class, addr);
127 }
128 public ConstantPool getConstants() {
129 return getConstMethod().getConstants();
130 }
131 public boolean hasStackMapTable() {
132 return getConstMethod().hasStackMapTable();
133 }
134 public U1Array getStackMapData() {
244 // Method holder (the Klass holding this method)
245 public InstanceKlass getMethodHolder() { return getConstants().getPoolHolder(); }
246
247 // Access flags
248 public boolean isPublic() { return getAccessFlagsObj().isPublic(); }
249 public boolean isPrivate() { return getAccessFlagsObj().isPrivate(); }
250 public boolean isProtected() { return getAccessFlagsObj().isProtected(); }
251 public boolean isPackagePrivate() { AccessFlags af = getAccessFlagsObj();
252 return (!af.isPublic() && !af.isPrivate() && !af.isProtected()); }
253 public boolean isStatic() { return getAccessFlagsObj().isStatic(); }
254 public boolean isFinal() { return getAccessFlagsObj().isFinal(); }
255 public boolean isSynchronized() { return getAccessFlagsObj().isSynchronized(); }
256 public boolean isBridge() { return getAccessFlagsObj().isBridge(); }
257 public boolean isVarArgs() { return getAccessFlagsObj().isVarArgs(); }
258 public boolean isNative() { return getAccessFlagsObj().isNative(); }
259 public boolean isAbstract() { return getAccessFlagsObj().isAbstract(); }
260 public boolean isStrict() { return getAccessFlagsObj().isStrict(); }
261 public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); }
262
263 public boolean isConstructor() {
264 return (!isStatic()) && (getName().equals(objectInitializerName()) || getName().equals(valueFactoryName()));
265 }
266
267 public boolean isStaticInitializer() {
268 return isStatic() && getName().equals(classInitializerName());
269 }
270
271 public OopMapCacheEntry getMaskFor(int bci) {
272 OopMapCacheEntry entry = new OopMapCacheEntry();
273 entry.fill(this, bci);
274 return entry;
275 }
276
277 public long getSize() {
278 return type.getSize() + (isNative() ? 2: 0);
279 }
280
281 public void printValueOn(PrintStream tty) {
282 tty.print("Method " + getMethodHolder().getName().asString() + "." +
283 getName().asString() + getSignature().asString() + "@" + getAddress());
284 }
|