< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Method.java

Print this page

 49           initialize(VM.getVM().getTypeDataBase());
 50         }
 51       });
 52   }
 53 
 54   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
 55     type                       = db.lookupType("Method");
 56     constMethod                = type.getAddressField("_constMethod");
 57     methodData                 = type.getAddressField("_method_data");
 58     methodCounters             = type.getAddressField("_method_counters");
 59     accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
 60     code                       = type.getAddressField("_code");
 61     vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
 62 
 63     /*
 64     fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
 65     interpreterEntry           = type.getAddressField("_from_interpreted_entry");
 66     */
 67 
 68     objectInitializerName = null;

 69     classInitializerName = null;
 70   }
 71 
 72   public Method(Address addr) {
 73     super(addr);
 74   }
 75 
 76   public boolean isMethod()            { return true; }
 77 
 78   // Not a Method field, used to keep type.
 79   private static Type type;
 80 
 81   // Fields
 82   private static AddressField  constMethod;
 83   private static AddressField  methodData;
 84   private static AddressField  methodCounters;
 85   private static CIntField accessFlags;
 86   private static CIntField vtableIndex;
 87 
 88   private static AddressField       code;
 89   /*
 90   private static AddressCField      fromCompiledCodeEntryPoint;
 91   private static AddressField       interpreterEntry;
 92   */
 93 
 94 
 95   // constant method names - <init>, <clinit>
 96   // Initialized lazily to avoid initialization ordering dependencies between ArrayKlass and String
 97   private static String objectInitializerName;

 98   private static String classInitializerName;
 99   private static String objectInitializerName() {
100     if (objectInitializerName == null) {
101       objectInitializerName = "<init>";
102     }
103     return objectInitializerName;
104   }






105   private static String classInitializerName() {
106     if (classInitializerName == null) {
107       classInitializerName = "<clinit>";
108     }
109     return classInitializerName;
110   }
111 
112 
113   // Accessors for declared fields
114   public ConstMethod  getConstMethod()                {
115     Address addr = constMethod.getValue(getAddress());
116     return VMObjectFactory.newObject(ConstMethod.class, addr);
117   }
118   public ConstantPool getConstants()                  {
119     return getConstMethod().getConstants();
120   }
121   public MethodData   getMethodData()                 {
122     Address addr = methodData.getValue(getAddress());
123     return VMObjectFactory.newObject(MethodData.class, addr);
124   }

228   // Method holder (the Klass holding this method)
229   public InstanceKlass   getMethodHolder()  { return getConstants().getPoolHolder();                   }
230 
231   // Access flags
232   public boolean isPublic()         { return getAccessFlagsObj().isPublic();                           }
233   public boolean isPrivate()        { return getAccessFlagsObj().isPrivate();                          }
234   public boolean isProtected()      { return getAccessFlagsObj().isProtected();                        }
235   public boolean isPackagePrivate() { AccessFlags af = getAccessFlagsObj();
236                                       return (!af.isPublic() && !af.isPrivate() && !af.isProtected()); }
237   public boolean isStatic()         { return getAccessFlagsObj().isStatic();                           }
238   public boolean isFinal()          { return getAccessFlagsObj().isFinal();                            }
239   public boolean isSynchronized()   { return getAccessFlagsObj().isSynchronized();                     }
240   public boolean isBridge()         { return getAccessFlagsObj().isBridge();                           }
241   public boolean isVarArgs()        { return getAccessFlagsObj().isVarArgs();                          }
242   public boolean isNative()         { return getAccessFlagsObj().isNative();                           }
243   public boolean isAbstract()       { return getAccessFlagsObj().isAbstract();                         }
244   public boolean isStrict()         { return getAccessFlagsObj().isStrict();                           }
245   public boolean isSynthetic()      { return getAccessFlagsObj().isSynthetic();                        }
246 
247   public boolean isConstructor() {
248      return (!isStatic()) && getName().equals(objectInitializerName());
249   }
250 
251   public boolean isStaticInitializer() {
252      return isStatic() && getName().equals(classInitializerName());
253   }
254 
255   public boolean isObsolete() {
256      return getAccessFlagsObj().isObsolete();
257   }
258 
259   public OopMapCacheEntry getMaskFor(int bci) {
260     OopMapCacheEntry entry = new OopMapCacheEntry();
261     entry.fill(this, bci);
262     return entry;
263   }
264 
265   public long getSize() {
266     return type.getSize() + (isNative() ? 2: 0);
267   }
268 

 49           initialize(VM.getVM().getTypeDataBase());
 50         }
 51       });
 52   }
 53 
 54   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
 55     type                       = db.lookupType("Method");
 56     constMethod                = type.getAddressField("_constMethod");
 57     methodData                 = type.getAddressField("_method_data");
 58     methodCounters             = type.getAddressField("_method_counters");
 59     accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
 60     code                       = type.getAddressField("_code");
 61     vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
 62 
 63     /*
 64     fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point");
 65     interpreterEntry           = type.getAddressField("_from_interpreted_entry");
 66     */
 67 
 68     objectInitializerName = null;
 69     valueFactoryName = null;
 70     classInitializerName = null;
 71   }
 72 
 73   public Method(Address addr) {
 74     super(addr);
 75   }
 76 
 77   public boolean isMethod()            { return true; }
 78 
 79   // Not a Method field, used to keep type.
 80   private static Type type;
 81 
 82   // Fields
 83   private static AddressField  constMethod;
 84   private static AddressField  methodData;
 85   private static AddressField  methodCounters;
 86   private static CIntField accessFlags;
 87   private static CIntField vtableIndex;
 88 
 89   private static AddressField       code;
 90   /*
 91   private static AddressCField      fromCompiledCodeEntryPoint;
 92   private static AddressField       interpreterEntry;
 93   */
 94 
 95 
 96   // constant method names - <init>, <clinit>
 97   // Initialized lazily to avoid initialization ordering dependencies between ArrayKlass and String
 98   private static String objectInitializerName;
 99   private static String valueFactoryName;
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 valueFactoryName() {
108     if (valueFactoryName == null) {
109       valueFactoryName = "<vnew>";
110     }
111     return classInitializerName;
112   }
113   private static String classInitializerName() {
114     if (classInitializerName == null) {
115       classInitializerName = "<clinit>";
116     }
117     return classInitializerName;
118   }
119 
120 
121   // Accessors for declared fields
122   public ConstMethod  getConstMethod()                {
123     Address addr = constMethod.getValue(getAddress());
124     return VMObjectFactory.newObject(ConstMethod.class, addr);
125   }
126   public ConstantPool getConstants()                  {
127     return getConstMethod().getConstants();
128   }
129   public MethodData   getMethodData()                 {
130     Address addr = methodData.getValue(getAddress());
131     return VMObjectFactory.newObject(MethodData.class, addr);
132   }

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()) || getName().equals(valueFactoryName()));
257   }
258 
259   public boolean isStaticInitializer() {
260      return isStatic() && getName().equals(classInitializerName());
261   }
262 
263   public boolean isObsolete() {
264      return getAccessFlagsObj().isObsolete();
265   }
266 
267   public OopMapCacheEntry getMaskFor(int bci) {
268     OopMapCacheEntry entry = new OopMapCacheEntry();
269     entry.fill(this, bci);
270     return entry;
271   }
272 
273   public long getSize() {
274     return type.getSize() + (isNative() ? 2: 0);
275   }
276 
< prev index next >