< prev index next >

src/share/vm/oops/klassVtable.hpp

Print this page




 153       Array<Klass*>* local_interfaces);
 154   void verify_against(outputStream* st, klassVtable* vt, int index);
 155   inline InstanceKlass* ik() const;
 156 };
 157 
 158 
 159 // private helper class for klassVtable
 160 // description of entry points:
 161 //    destination is interpreted:
 162 //      from_compiled_code_entry_point -> c2iadapter
 163 //      from_interpreter_entry_point   -> interpreter entry point
 164 //    destination is compiled:
 165 //      from_compiled_code_entry_point -> nmethod entry point
 166 //      from_interpreter_entry_point   -> i2cadapter
 167 class vtableEntry VALUE_OBJ_CLASS_SPEC {
 168   friend class VMStructs;
 169   friend class JVMCIVMStructs;
 170 
 171  public:
 172   // size in words
 173   static int size() {
 174     return sizeof(vtableEntry) / sizeof(HeapWord);
 175   }
 176   static int size_in_bytes() {
 177     return sizeof(vtableEntry);
 178   }
 179   static int method_offset_in_bytes() { return offset_of(vtableEntry, _method); }
 180   Method* method() const    { return _method; }
 181 
 182  private:
 183   Method* _method;
 184   void set(Method* method)  { assert(method != NULL, "use clear"); _method = method; }
 185   void clear()                { _method = NULL; }
 186   void print()                                        PRODUCT_RETURN;
 187   void verify(klassVtable* vt, outputStream* st);
 188 
 189   friend class klassVtable;
 190 };
 191 
 192 
 193 inline Method* klassVtable::method_at(int i) const {
 194   assert(i >= 0 && i < _length, "index out of bounds");
 195   assert(table()[i].method() != NULL, "should not be null");
 196   assert(((Metadata*)table()[i].method())->is_method(), "should be method");
 197   return table()[i].method();
 198 }


 209 }
 210 
 211 // --------------------------------------------------------------------------------
 212 class klassItable;
 213 class itableMethodEntry;
 214 
 215 class itableOffsetEntry VALUE_OBJ_CLASS_SPEC {
 216  private:
 217   Klass* _interface;
 218   int      _offset;
 219  public:
 220   Klass* interface_klass() const { return _interface; }
 221   int      offset() const          { return _offset; }
 222 
 223   static itableMethodEntry* method_entry(Klass* k, int offset) { return (itableMethodEntry*)(((address)k) + offset); }
 224   itableMethodEntry* first_method_entry(Klass* k)              { return method_entry(k, _offset); }
 225 
 226   void initialize(Klass* interf, int offset) { _interface = interf; _offset = offset; }
 227 
 228   // Static size and offset accessors
 229   static int size()                       { return sizeof(itableOffsetEntry) / HeapWordSize; }    // size in words
 230   static int interface_offset_in_bytes()  { return offset_of(itableOffsetEntry, _interface); }
 231   static int offset_offset_in_bytes()     { return offset_of(itableOffsetEntry, _offset); }
 232 
 233   friend class klassItable;
 234 };
 235 
 236 
 237 class itableMethodEntry VALUE_OBJ_CLASS_SPEC {
 238  private:
 239   Method* _method;
 240 
 241  public:
 242   Method* method() const { return _method; }
 243 
 244   void clear()             { _method = NULL; }
 245 
 246   void initialize(Method* method);
 247 
 248   // Static size and offset accessors
 249   static int size()                         { return sizeof(itableMethodEntry) / HeapWordSize; }  // size in words
 250   static int method_offset_in_bytes()       { return offset_of(itableMethodEntry, _method); }
 251 
 252   friend class klassItable;
 253 };
 254 
 255 //
 256 // Format of an itable
 257 //
 258 //    ---- offset table ---
 259 //    Klass* of interface 1             \
 260 //    offset to vtable from start of oop  / offset table entry
 261 //    ...
 262 //    Klass* of interface n             \
 263 //    offset to vtable from start of oop  / offset table entry
 264 //    --- vtable for interface 1 ---
 265 //    Method*                             \
 266 //    compiler entry point                / method table entry
 267 //    ...
 268 //    Method*                             \
 269 //    compiler entry point                / method table entry




 153       Array<Klass*>* local_interfaces);
 154   void verify_against(outputStream* st, klassVtable* vt, int index);
 155   inline InstanceKlass* ik() const;
 156 };
 157 
 158 
 159 // private helper class for klassVtable
 160 // description of entry points:
 161 //    destination is interpreted:
 162 //      from_compiled_code_entry_point -> c2iadapter
 163 //      from_interpreter_entry_point   -> interpreter entry point
 164 //    destination is compiled:
 165 //      from_compiled_code_entry_point -> nmethod entry point
 166 //      from_interpreter_entry_point   -> i2cadapter
 167 class vtableEntry VALUE_OBJ_CLASS_SPEC {
 168   friend class VMStructs;
 169   friend class JVMCIVMStructs;
 170 
 171  public:
 172   // size in words
 173   static int size()          { return sizeof(vtableEntry) / wordSize; }
 174   static int size_in_bytes() { return sizeof(vtableEntry); }
 175 



 176   static int method_offset_in_bytes() { return offset_of(vtableEntry, _method); }
 177   Method* method() const    { return _method; }
 178 
 179  private:
 180   Method* _method;
 181   void set(Method* method)  { assert(method != NULL, "use clear"); _method = method; }
 182   void clear()                { _method = NULL; }
 183   void print()                                        PRODUCT_RETURN;
 184   void verify(klassVtable* vt, outputStream* st);
 185 
 186   friend class klassVtable;
 187 };
 188 
 189 
 190 inline Method* klassVtable::method_at(int i) const {
 191   assert(i >= 0 && i < _length, "index out of bounds");
 192   assert(table()[i].method() != NULL, "should not be null");
 193   assert(((Metadata*)table()[i].method())->is_method(), "should be method");
 194   return table()[i].method();
 195 }


 206 }
 207 
 208 // --------------------------------------------------------------------------------
 209 class klassItable;
 210 class itableMethodEntry;
 211 
 212 class itableOffsetEntry VALUE_OBJ_CLASS_SPEC {
 213  private:
 214   Klass* _interface;
 215   int      _offset;
 216  public:
 217   Klass* interface_klass() const { return _interface; }
 218   int      offset() const          { return _offset; }
 219 
 220   static itableMethodEntry* method_entry(Klass* k, int offset) { return (itableMethodEntry*)(((address)k) + offset); }
 221   itableMethodEntry* first_method_entry(Klass* k)              { return method_entry(k, _offset); }
 222 
 223   void initialize(Klass* interf, int offset) { _interface = interf; _offset = offset; }
 224 
 225   // Static size and offset accessors
 226   static int size()                       { return sizeof(itableOffsetEntry) / wordSize; }    // size in words
 227   static int interface_offset_in_bytes()  { return offset_of(itableOffsetEntry, _interface); }
 228   static int offset_offset_in_bytes()     { return offset_of(itableOffsetEntry, _offset); }
 229 
 230   friend class klassItable;
 231 };
 232 
 233 
 234 class itableMethodEntry VALUE_OBJ_CLASS_SPEC {
 235  private:
 236   Method* _method;
 237 
 238  public:
 239   Method* method() const { return _method; }
 240 
 241   void clear()             { _method = NULL; }
 242 
 243   void initialize(Method* method);
 244 
 245   // Static size and offset accessors
 246   static int size()                         { return sizeof(itableMethodEntry) / wordSize; }  // size in words
 247   static int method_offset_in_bytes()       { return offset_of(itableMethodEntry, _method); }
 248 
 249   friend class klassItable;
 250 };
 251 
 252 //
 253 // Format of an itable
 254 //
 255 //    ---- offset table ---
 256 //    Klass* of interface 1             \
 257 //    offset to vtable from start of oop  / offset table entry
 258 //    ...
 259 //    Klass* of interface n             \
 260 //    offset to vtable from start of oop  / offset table entry
 261 //    --- vtable for interface 1 ---
 262 //    Method*                             \
 263 //    compiler entry point                / method table entry
 264 //    ...
 265 //    Method*                             \
 266 //    compiler entry point                / method table entry


< prev index next >