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);
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,
155 bool is_interface);
156 static void get_mirandas(
157 GrowableArray<Method*>* new_mirandas,
158 GrowableArray<Method*>* all_mirandas,
159 const Klass* super,
160 Array<Method*>* class_methods,
161 Array<Method*>* default_methods,
162 Array<Klass*>* local_interfaces,
163 bool is_interface);
164 void verify_against(outputStream* st, klassVtable* vt, int index);
311 return &((itableMethodEntry*)method_start())[i]; }
312
313 int size_offset_table() { return _size_offset_table; }
314
315 // Initialization
316 void initialize_itable(bool checkconstraints, TRAPS);
317
318 #if INCLUDE_JVMTI
319 // RedefineClasses() API support:
320 // if any entry of this itable points to any of old_methods,
321 // replace it with the corresponding new_method.
322 // trace_name_printed is set to true if the current call has
323 // printed the klass name so that other routines in the adjust_*
324 // group don't print the klass name.
325 void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
326 bool check_no_old_or_obsolete_entries();
327 void dump_itable();
328 #endif // INCLUDE_JVMTI
329
330 // Setup of itable
331 static int assign_itable_indices_for_interface(Klass* klass);
332 static int method_count_for_interface(Klass* klass);
333 static int compute_itable_size(Array<Klass*>* transitive_interfaces);
334 static void setup_itable_offset_table(InstanceKlass* klass);
335
336 // Resolving of method to index
337 static Method* method_for_itable_index(Klass* klass, int itable_index);
338
339 // Debugging/Statistics
340 static void print_statistics() PRODUCT_RETURN;
341 private:
342 intptr_t* vtable_start() const { return ((intptr_t*)_klass) + _table_offset; }
343 intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
344
345 // Helper methods
346 static int calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }
347
348 // Statistics
349 NOT_PRODUCT(static int _total_classes;) // Total no. of classes with itables
350 NOT_PRODUCT(static long _total_size;) // Total no. of bytes used for itables
351
|
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,
155 bool is_interface);
156 static void get_mirandas(
157 GrowableArray<Method*>* new_mirandas,
158 GrowableArray<Method*>* all_mirandas,
159 const Klass* super,
160 Array<Method*>* class_methods,
161 Array<Method*>* default_methods,
162 Array<Klass*>* local_interfaces,
163 bool is_interface);
164 void verify_against(outputStream* st, klassVtable* vt, int index);
311 return &((itableMethodEntry*)method_start())[i]; }
312
313 int size_offset_table() { return _size_offset_table; }
314
315 // Initialization
316 void initialize_itable(bool checkconstraints, TRAPS);
317
318 #if INCLUDE_JVMTI
319 // RedefineClasses() API support:
320 // if any entry of this itable points to any of old_methods,
321 // replace it with the corresponding new_method.
322 // trace_name_printed is set to true if the current call has
323 // printed the klass name so that other routines in the adjust_*
324 // group don't print the klass name.
325 void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
326 bool check_no_old_or_obsolete_entries();
327 void dump_itable();
328 #endif // INCLUDE_JVMTI
329
330 // Setup of itable
331 static int assign_itable_indices_for_interface(Klass* klass, TRAPS);
332 static int method_count_for_interface(Klass* klass);
333 static int compute_itable_size(Array<Klass*>* transitive_interfaces);
334 static void setup_itable_offset_table(InstanceKlass* klass);
335
336 // Resolving of method to index
337 static Method* method_for_itable_index(Klass* klass, int itable_index);
338
339 // Debugging/Statistics
340 static void print_statistics() PRODUCT_RETURN;
341 private:
342 intptr_t* vtable_start() const { return ((intptr_t*)_klass) + _table_offset; }
343 intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
344
345 // Helper methods
346 static int calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }
347
348 // Statistics
349 NOT_PRODUCT(static int _total_classes;) // Total no. of classes with itables
350 NOT_PRODUCT(static long _total_size;) // Total no. of bytes used for itables
351
|