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, bool checkconstraints, TRAPS);
122 InstanceKlass* find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, int vtable_index,
123 Handle target_loader, Symbol* target_classname, Thread* THREAD);
124
125 // support for miranda methods
126 bool is_miranda_entry_at(int i);
127 void fill_in_mirandas(int* initialized);
128 static bool is_miranda(Method* m, Array<Method*>* class_methods, Klass* super);
129 static void add_new_mirandas_to_lists(
130 GrowableArray<Method*>* new_mirandas,
131 GrowableArray<Method*>* all_mirandas,
132 Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
133 Klass* super);
134 static void get_mirandas(
135 GrowableArray<Method*>* new_mirandas,
136 GrowableArray<Method*>* all_mirandas, Klass* super,
137 Array<Method*>* class_methods, Array<Klass*>* local_interfaces);
138
139 void verify_against(outputStream* st, klassVtable* vt, int index);
140 inline InstanceKlass* ik() const;
141 };
142
143
144 // private helper class for klassVtable
145 // description of entry points:
146 // destination is interpreted:
147 // from_compiled_code_entry_point -> c2iadapter
271 // Initialization
272 void initialize_itable(bool checkconstraints, TRAPS);
273
274 // Updates
275 void initialize_with_method(Method* m);
276
277 #if INCLUDE_JVMTI
278 // RedefineClasses() API support:
279 // if any entry of this itable points to any of old_methods,
280 // replace it with the corresponding new_method.
281 // trace_name_printed is set to true if the current call has
282 // printed the klass name so that other routines in the adjust_*
283 // group don't print the klass name.
284 void adjust_method_entries(Method** old_methods, Method** new_methods,
285 int methods_length, bool * trace_name_printed);
286 bool check_no_old_or_obsolete_entries();
287 void dump_itable();
288 #endif // INCLUDE_JVMTI
289
290 // Setup of itable
291 static int compute_itable_size(Array<Klass*>* transitive_interfaces);
292 static void setup_itable_offset_table(instanceKlassHandle klass);
293
294 // Resolving of method to index
295 static int compute_itable_index(Method* m);
296 // ...and back again:
297 static Method* method_for_itable_index(Klass* klass, int itable_index);
298
299 // Debugging/Statistics
300 static void print_statistics() PRODUCT_RETURN;
301 private:
302 intptr_t* vtable_start() const { return ((intptr_t*)_klass()) + _table_offset; }
303 intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
304
305 // Helper methods
306 static int calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }
307
308 // Statistics
309 NOT_PRODUCT(static int _total_classes;) // Total no. of classes with itables
310 NOT_PRODUCT(static long _total_size;) // Total no. of bytes used for itables
311
312 static void update_stats(int size) PRODUCT_RETURN NOT_PRODUCT({ _total_classes++; _total_size += size; })
313 };
314
315 #endif // SHARE_VM_OOPS_KLASSVTABLE_HPP
|
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, bool checkconstraints, TRAPS);
122 InstanceKlass* find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, int vtable_index,
123 Handle target_loader, Symbol* target_classname, Thread* THREAD);
124
125 // support for miranda methods
126 bool is_miranda_entry_at(int i);
127 int fill_in_mirandas(int initialized);
128 static bool is_miranda(Method* m, Array<Method*>* class_methods, Klass* super);
129 static void add_new_mirandas_to_lists(
130 GrowableArray<Method*>* new_mirandas,
131 GrowableArray<Method*>* all_mirandas,
132 Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
133 Klass* super);
134 static void get_mirandas(
135 GrowableArray<Method*>* new_mirandas,
136 GrowableArray<Method*>* all_mirandas, Klass* super,
137 Array<Method*>* class_methods, Array<Klass*>* local_interfaces);
138
139 void verify_against(outputStream* st, klassVtable* vt, int index);
140 inline InstanceKlass* ik() const;
141 };
142
143
144 // private helper class for klassVtable
145 // description of entry points:
146 // destination is interpreted:
147 // from_compiled_code_entry_point -> c2iadapter
271 // Initialization
272 void initialize_itable(bool checkconstraints, TRAPS);
273
274 // Updates
275 void initialize_with_method(Method* m);
276
277 #if INCLUDE_JVMTI
278 // RedefineClasses() API support:
279 // if any entry of this itable points to any of old_methods,
280 // replace it with the corresponding new_method.
281 // trace_name_printed is set to true if the current call has
282 // printed the klass name so that other routines in the adjust_*
283 // group don't print the klass name.
284 void adjust_method_entries(Method** old_methods, Method** new_methods,
285 int methods_length, bool * trace_name_printed);
286 bool check_no_old_or_obsolete_entries();
287 void dump_itable();
288 #endif // INCLUDE_JVMTI
289
290 // Setup of itable
291 static int assign_itable_indexes_for_interface(Klass* klass);
292 static int method_count_for_interface(Klass* klass);
293 static int compute_itable_size(Array<Klass*>* transitive_interfaces);
294 static void setup_itable_offset_table(instanceKlassHandle klass);
295
296 // Resolving of method to index
297 static Method* method_for_itable_index(Klass* klass, int itable_index);
298
299 // Debugging/Statistics
300 static void print_statistics() PRODUCT_RETURN;
301 private:
302 intptr_t* vtable_start() const { return ((intptr_t*)_klass()) + _table_offset; }
303 intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
304
305 // Helper methods
306 static int calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }
307
308 // Statistics
309 NOT_PRODUCT(static int _total_classes;) // Total no. of classes with itables
310 NOT_PRODUCT(static long _total_size;) // Total no. of bytes used for itables
311
312 static void update_stats(int size) PRODUCT_RETURN NOT_PRODUCT({ _total_classes++; _total_size += size; })
313 };
314
315 #endif // SHARE_VM_OOPS_KLASSVTABLE_HPP
|