< prev index next >

src/hotspot/share/oops/klassVtable.hpp

Print this page




  72   int index_of(Method* m) const                         { return index_of(m, _length); }
  73   int index_of_miranda(Symbol* name, Symbol* signature);
  74 
  75   void initialize_vtable(bool checkconstraints, TRAPS);   // initialize vtable of a new klass
  76 
  77   // CDS/RedefineClasses support - clear vtables so they can be reinitialized
  78   // at dump time.  Clearing gives us an easy way to tell if the vtable has
  79   // already been reinitialized at dump time (see dump.cpp).  Vtables can
  80   // be initialized at run time by RedefineClasses so dumping the right order
  81   // is necessary.
  82   void clear_vtable();
  83   bool is_initialized();
  84 
  85   // computes vtable length (in words) and the number of miranda methods
  86   static void compute_vtable_size_and_num_mirandas(int* vtable_length,
  87                                                    int* num_new_mirandas,
  88                                                    GrowableArray<Method*>* all_mirandas,
  89                                                    const Klass* super,
  90                                                    Array<Method*>* methods,
  91                                                    AccessFlags class_flags,

  92                                                    u2 major_version,
  93                                                    Handle classloader,
  94                                                    Symbol* classname,
  95                                                    Array<InstanceKlass*>* local_interfaces,
  96                                                    TRAPS);
  97 
  98 #if INCLUDE_JVMTI
  99   // RedefineClasses() API support:
 100   // If any entry of this vtable points to any of old_methods,
 101   // replace it with the corresponding new_method.
 102   // trace_name_printed is set to true if the current call has
 103   // printed the klass name so that other routines in the adjust_*
 104   // group don't print the klass name.
 105   bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
 106   void adjust_method_entries(bool* trace_name_printed);
 107   bool check_no_old_or_obsolete_entries();
 108   void dump_vtable();
 109 #endif // INCLUDE_JVMTI
 110 
 111   // Debugging code


 115 
 116  protected:
 117   friend class vtableEntry;
 118 
 119  public:
 120   // Transitive overridng rules for class files < JDK1_7 use the older JVMS rules.
 121   // Overriding is determined as we create the vtable, so we use the class file version
 122   // of the class whose vtable we are calculating.
 123   enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ;
 124 
 125  private:
 126   void copy_vtable_to(vtableEntry* start);
 127   int  initialize_from_super(Klass* super);
 128   int  index_of(Method* m, int len) const; // same as index_of, but search only up to len
 129   void put_method_at(Method* m, int index);
 130   static bool needs_new_vtable_entry(const methodHandle& m,
 131                                      const Klass* super,
 132                                      Handle classloader,
 133                                      Symbol* classname,
 134                                      AccessFlags access_flags,

 135                                      u2 major_version,
 136                                      TRAPS);
 137 
 138   bool update_inherited_vtable(InstanceKlass* klass, const methodHandle& target_method, int super_vtable_len, int default_index, bool checkconstraints, TRAPS);
 139  InstanceKlass* find_transitive_override(InstanceKlass* initialsuper, const methodHandle& target_method, int vtable_index,
 140                                          Handle target_loader, Symbol* target_classname, Thread* THREAD);
 141 
 142   // support for miranda methods
 143   bool is_miranda_entry_at(int i);
 144   int fill_in_mirandas(int initialized, TRAPS);
 145   static bool is_miranda(Method* m, Array<Method*>* class_methods,
 146                          Array<Method*>* default_methods, const Klass* super,
 147                          bool is_interface);
 148   static void add_new_mirandas_to_lists(
 149       GrowableArray<Method*>* new_mirandas,
 150       GrowableArray<Method*>* all_mirandas,
 151       Array<Method*>* current_interface_methods,
 152       Array<Method*>* class_methods,
 153       Array<Method*>* default_methods,
 154       const Klass* super,




  72   int index_of(Method* m) const                         { return index_of(m, _length); }
  73   int index_of_miranda(Symbol* name, Symbol* signature);
  74 
  75   void initialize_vtable(bool checkconstraints, TRAPS);   // initialize vtable of a new klass
  76 
  77   // CDS/RedefineClasses support - clear vtables so they can be reinitialized
  78   // at dump time.  Clearing gives us an easy way to tell if the vtable has
  79   // already been reinitialized at dump time (see dump.cpp).  Vtables can
  80   // be initialized at run time by RedefineClasses so dumping the right order
  81   // is necessary.
  82   void clear_vtable();
  83   bool is_initialized();
  84 
  85   // computes vtable length (in words) and the number of miranda methods
  86   static void compute_vtable_size_and_num_mirandas(int* vtable_length,
  87                                                    int* num_new_mirandas,
  88                                                    GrowableArray<Method*>* all_mirandas,
  89                                                    const Klass* super,
  90                                                    Array<Method*>* methods,
  91                                                    AccessFlags class_flags,
  92                                                    bool is_class_sealed,
  93                                                    u2 major_version,
  94                                                    Handle classloader,
  95                                                    Symbol* classname,
  96                                                    Array<InstanceKlass*>* local_interfaces,
  97                                                    TRAPS);
  98 
  99 #if INCLUDE_JVMTI
 100   // RedefineClasses() API support:
 101   // If any entry of this vtable points to any of old_methods,
 102   // replace it with the corresponding new_method.
 103   // trace_name_printed is set to true if the current call has
 104   // printed the klass name so that other routines in the adjust_*
 105   // group don't print the klass name.
 106   bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
 107   void adjust_method_entries(bool* trace_name_printed);
 108   bool check_no_old_or_obsolete_entries();
 109   void dump_vtable();
 110 #endif // INCLUDE_JVMTI
 111 
 112   // Debugging code


 116 
 117  protected:
 118   friend class vtableEntry;
 119 
 120  public:
 121   // Transitive overridng rules for class files < JDK1_7 use the older JVMS rules.
 122   // Overriding is determined as we create the vtable, so we use the class file version
 123   // of the class whose vtable we are calculating.
 124   enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ;
 125 
 126  private:
 127   void copy_vtable_to(vtableEntry* start);
 128   int  initialize_from_super(Klass* super);
 129   int  index_of(Method* m, int len) const; // same as index_of, but search only up to len
 130   void put_method_at(Method* m, int index);
 131   static bool needs_new_vtable_entry(const methodHandle& m,
 132                                      const Klass* super,
 133                                      Handle classloader,
 134                                      Symbol* classname,
 135                                      AccessFlags access_flags,
 136                                      bool is_sealed,
 137                                      u2 major_version,
 138                                      TRAPS);
 139 
 140   bool update_inherited_vtable(InstanceKlass* klass, const methodHandle& target_method, int super_vtable_len, int default_index, bool checkconstraints, TRAPS);
 141  InstanceKlass* find_transitive_override(InstanceKlass* initialsuper, const methodHandle& target_method, int vtable_index,
 142                                          Handle target_loader, Symbol* target_classname, Thread* THREAD);
 143 
 144   // support for miranda methods
 145   bool is_miranda_entry_at(int i);
 146   int fill_in_mirandas(int initialized, TRAPS);
 147   static bool is_miranda(Method* m, Array<Method*>* class_methods,
 148                          Array<Method*>* default_methods, const Klass* super,
 149                          bool is_interface);
 150   static void add_new_mirandas_to_lists(
 151       GrowableArray<Method*>* new_mirandas,
 152       GrowableArray<Method*>* all_mirandas,
 153       Array<Method*>* current_interface_methods,
 154       Array<Method*>* class_methods,
 155       Array<Method*>* default_methods,
 156       const Klass* super,


< prev index next >