src/share/vm/oops/klassVtable.hpp

Print this page




  81   // be initialized at run time by RedefineClasses so dumping the right order
  82   // is necessary.
  83   void clear_vtable();
  84   bool is_initialized();
  85 
  86   // computes vtable length (in words) and the number of miranda methods
  87   static void compute_vtable_size_and_num_mirandas(
  88       int* vtable_length, int* num_new_mirandas,
  89       GrowableArray<Method*>* all_mirandas, Klass* super,
  90       Array<Method*>* methods, AccessFlags class_flags, Handle classloader,
  91       Symbol* classname, Array<Klass*>* local_interfaces, TRAPS);
  92 
  93 #if INCLUDE_JVMTI
  94   // RedefineClasses() API support:
  95   // If any entry of this vtable points to any of old_methods,
  96   // replace it with the corresponding new_method.
  97   // trace_name_printed is set to true if the current call has
  98   // printed the klass name so that other routines in the adjust_*
  99   // group don't print the klass name.
 100   bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
 101   void adjust_method_entries(Method** old_methods, Method** new_methods,
 102                              int methods_length, bool * trace_name_printed);
 103   bool check_no_old_or_obsolete_entries();
 104   void dump_vtable();
 105 #endif // INCLUDE_JVMTI
 106 
 107   // Debugging code
 108   void print()                                              PRODUCT_RETURN;
 109   void verify(outputStream* st, bool force = false);
 110   static void print_statistics()                            PRODUCT_RETURN;
 111 
 112  protected:
 113   friend class vtableEntry;
 114  private:
 115   enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ;
 116   void copy_vtable_to(vtableEntry* start);
 117   int  initialize_from_super(KlassHandle super);
 118   int  index_of(Method* m, int len) const; // same as index_of, but search only up to len
 119   void put_method_at(Method* m, int index);
 120   static bool needs_new_vtable_entry(methodHandle m, Klass* super, Handle classloader, Symbol* classname, AccessFlags access_flags, TRAPS);
 121 
 122   bool update_inherited_vtable(InstanceKlass* klass, methodHandle target_method, int super_vtable_len, int default_index, bool checkconstraints, TRAPS);


 271                                            return &((itableOffsetEntry*)vtable_start())[i]; }
 272 
 273   itableMethodEntry* method_entry(int i) { assert(0 <= i && i <= _size_method_table, "index out of bounds");
 274                                            return &((itableMethodEntry*)method_start())[i]; }
 275 
 276   int size_offset_table()                { return _size_offset_table; }
 277 
 278   // Initialization
 279   void initialize_itable(bool checkconstraints, TRAPS);
 280 
 281   // Updates
 282   void initialize_with_method(Method* m);
 283 
 284 #if INCLUDE_JVMTI
 285   // RedefineClasses() API support:
 286   // if any entry of this itable points to any of old_methods,
 287   // replace it with the corresponding new_method.
 288   // trace_name_printed is set to true if the current call has
 289   // printed the klass name so that other routines in the adjust_*
 290   // group don't print the klass name.
 291   void adjust_method_entries(Method** old_methods, Method** new_methods,
 292                              int methods_length, bool * trace_name_printed);
 293   bool check_no_old_or_obsolete_entries();
 294   void dump_itable();
 295 #endif // INCLUDE_JVMTI
 296 
 297   // Setup of itable
 298   static int assign_itable_indices_for_interface(Klass* klass);
 299   static int method_count_for_interface(Klass* klass);
 300   static int compute_itable_size(Array<Klass*>* transitive_interfaces);
 301   static void setup_itable_offset_table(instanceKlassHandle klass);
 302 
 303   // Resolving of method to index
 304   static Method* method_for_itable_index(Klass* klass, int itable_index);
 305 
 306   // Debugging/Statistics
 307   static void print_statistics() PRODUCT_RETURN;
 308  private:
 309   intptr_t* vtable_start() const { return ((intptr_t*)_klass()) + _table_offset; }
 310   intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
 311 
 312   // Helper methods


  81   // be initialized at run time by RedefineClasses so dumping the right order
  82   // is necessary.
  83   void clear_vtable();
  84   bool is_initialized();
  85 
  86   // computes vtable length (in words) and the number of miranda methods
  87   static void compute_vtable_size_and_num_mirandas(
  88       int* vtable_length, int* num_new_mirandas,
  89       GrowableArray<Method*>* all_mirandas, Klass* super,
  90       Array<Method*>* methods, AccessFlags class_flags, Handle classloader,
  91       Symbol* classname, Array<Klass*>* local_interfaces, TRAPS);
  92 
  93 #if INCLUDE_JVMTI
  94   // RedefineClasses() API support:
  95   // If any entry of this vtable points to any of old_methods,
  96   // replace it with the corresponding new_method.
  97   // trace_name_printed is set to true if the current call has
  98   // printed the klass name so that other routines in the adjust_*
  99   // group don't print the klass name.
 100   bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
 101   void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);

 102   bool check_no_old_or_obsolete_entries();
 103   void dump_vtable();
 104 #endif // INCLUDE_JVMTI
 105 
 106   // Debugging code
 107   void print()                                              PRODUCT_RETURN;
 108   void verify(outputStream* st, bool force = false);
 109   static void print_statistics()                            PRODUCT_RETURN;
 110 
 111  protected:
 112   friend class vtableEntry;
 113  private:
 114   enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ;
 115   void copy_vtable_to(vtableEntry* start);
 116   int  initialize_from_super(KlassHandle super);
 117   int  index_of(Method* m, int len) const; // same as index_of, but search only up to len
 118   void put_method_at(Method* m, int index);
 119   static bool needs_new_vtable_entry(methodHandle m, Klass* super, Handle classloader, Symbol* classname, AccessFlags access_flags, TRAPS);
 120 
 121   bool update_inherited_vtable(InstanceKlass* klass, methodHandle target_method, int super_vtable_len, int default_index, bool checkconstraints, TRAPS);


 270                                            return &((itableOffsetEntry*)vtable_start())[i]; }
 271 
 272   itableMethodEntry* method_entry(int i) { assert(0 <= i && i <= _size_method_table, "index out of bounds");
 273                                            return &((itableMethodEntry*)method_start())[i]; }
 274 
 275   int size_offset_table()                { return _size_offset_table; }
 276 
 277   // Initialization
 278   void initialize_itable(bool checkconstraints, TRAPS);
 279 
 280   // Updates
 281   void initialize_with_method(Method* m);
 282 
 283 #if INCLUDE_JVMTI
 284   // RedefineClasses() API support:
 285   // if any entry of this itable points to any of old_methods,
 286   // replace it with the corresponding new_method.
 287   // trace_name_printed is set to true if the current call has
 288   // printed the klass name so that other routines in the adjust_*
 289   // group don't print the klass name.
 290   void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);

 291   bool check_no_old_or_obsolete_entries();
 292   void dump_itable();
 293 #endif // INCLUDE_JVMTI
 294 
 295   // Setup of itable
 296   static int assign_itable_indices_for_interface(Klass* klass);
 297   static int method_count_for_interface(Klass* klass);
 298   static int compute_itable_size(Array<Klass*>* transitive_interfaces);
 299   static void setup_itable_offset_table(instanceKlassHandle klass);
 300 
 301   // Resolving of method to index
 302   static Method* method_for_itable_index(Klass* klass, int itable_index);
 303 
 304   // Debugging/Statistics
 305   static void print_statistics() PRODUCT_RETURN;
 306  private:
 307   intptr_t* vtable_start() const { return ((intptr_t*)_klass()) + _table_offset; }
 308   intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
 309 
 310   // Helper methods