1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
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(int &vtable_length, int &num_miranda_methods,
88 klassOop super, objArrayOop methods,
89 AccessFlags class_flags, Handle classloader,
90 Symbol* classname, objArrayOop local_interfaces,
91 TRAPS);
92
93 // RedefineClasses() API support:
94 // If any entry of this vtable points to any of old_methods,
95 // replace it with the corresponding new_method.
96 // trace_name_printed is set to true if the current call has
97 // printed the klass name so that other routines in the adjust_*
98 // group don't print the klass name.
99 void adjust_method_entries(methodOop* old_methods, methodOop* new_methods,
100 int methods_length, bool * trace_name_printed);
101
102 // Garbage collection
103 void oop_follow_contents();
104 void oop_adjust_pointers();
105
106 #ifndef SERIALGC
107 // Parallel Old
108 void oop_follow_contents(ParCompactionManager* cm);
109 void oop_update_pointers(ParCompactionManager* cm);
110 #endif // SERIALGC
111
112 // Iterators
113 void oop_oop_iterate(OopClosure* blk);
114 void oop_oop_iterate_m(OopClosure* blk, MemRegion mr);
115
116 // Debugging code
117 void print() PRODUCT_RETURN;
118 void verify(outputStream* st, bool force = false);
119 static void print_statistics() PRODUCT_RETURN;
120
121 #ifndef PRODUCT
122 bool check_no_old_entries();
123 void dump_vtable();
124 #endif
125
126 protected:
127 friend class vtableEntry;
128 private:
129 enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ;
130 void copy_vtable_to(vtableEntry* start);
131 int initialize_from_super(KlassHandle super);
132 int index_of(methodOop m, int len) const; // same as index_of, but search only up to len
133 void put_method_at(methodOop m, int index);
134 static bool needs_new_vtable_entry(methodHandle m, klassOop super, Handle classloader, Symbol* classname, AccessFlags access_flags, TRAPS);
135
136 bool update_inherited_vtable(instanceKlass* klass, methodHandle target_method, int super_vtable_len, bool checkconstraints, TRAPS);
137 instanceKlass* find_transitive_override(instanceKlass* initialsuper, methodHandle target_method, int vtable_index,
138 Handle target_loader, Symbol* target_classname, Thread* THREAD);
139
140 // support for miranda methods
141 bool is_miranda_entry_at(int i);
142 void fill_in_mirandas(int& initialized);
143 static bool is_miranda(methodOop m, objArrayOop class_methods, klassOop super);
144 static void add_new_mirandas_to_list(GrowableArray<methodOop>* list_of_current_mirandas, objArrayOop current_interface_methods, objArrayOop class_methods, klassOop super);
145 static void get_mirandas(GrowableArray<methodOop>* mirandas, klassOop super, objArrayOop class_methods, objArrayOop local_interfaces);
275
276 itableMethodEntry* method_entry(int i) { assert(0 <= i && i <= _size_method_table, "index out of bounds");
277 return &((itableMethodEntry*)method_start())[i]; }
278
279 int size_offset_table() { return _size_offset_table; }
280
281 // Initialization
282 void initialize_itable(bool checkconstraints, TRAPS);
283
284 // Updates
285 void initialize_with_method(methodOop m);
286
287 // RedefineClasses() API support:
288 // if any entry of this itable points to any of old_methods,
289 // replace it with the corresponding new_method.
290 // trace_name_printed is set to true if the current call has
291 // printed the klass name so that other routines in the adjust_*
292 // group don't print the klass name.
293 void adjust_method_entries(methodOop* old_methods, methodOop* new_methods,
294 int methods_length, bool * trace_name_printed);
295
296 // Garbage collection
297 void oop_follow_contents();
298 void oop_adjust_pointers();
299
300 #ifndef SERIALGC
301 // Parallel Old
302 void oop_follow_contents(ParCompactionManager* cm);
303 void oop_update_pointers(ParCompactionManager* cm);
304 #endif // SERIALGC
305
306 // Iterators
307 void oop_oop_iterate(OopClosure* blk);
308 void oop_oop_iterate_m(OopClosure* blk, MemRegion mr);
309
310 // Setup of itable
311 static int compute_itable_size(objArrayHandle transitive_interfaces);
312 static void setup_itable_offset_table(instanceKlassHandle klass);
313
314 // Resolving of method to index
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
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(int &vtable_length, int &num_miranda_methods,
88 klassOop super, objArrayOop methods,
89 AccessFlags class_flags, Handle classloader,
90 Symbol* classname, objArrayOop local_interfaces,
91 TRAPS);
92
93 // RedefineClasses() API support:
94 // If any entry of this vtable points to any of old_methods,
95 // replace it with the corresponding new_method.
96 // trace_name_printed is set to true if the current call has
97 // printed the klass name so that other routines in the adjust_*
98 // group don't print the klass name.
99 void adjust_method_entries(methodOop* old_methods, methodOop* new_methods,
100 int methods_length, bool * trace_name_printed);
101 bool check_no_old_or_obsolete_entries();
102 void dump_vtable();
103
104 // Garbage collection
105 void oop_follow_contents();
106 void oop_adjust_pointers();
107
108 #ifndef SERIALGC
109 // Parallel Old
110 void oop_follow_contents(ParCompactionManager* cm);
111 void oop_update_pointers(ParCompactionManager* cm);
112 #endif // SERIALGC
113
114 // Iterators
115 void oop_oop_iterate(OopClosure* blk);
116 void oop_oop_iterate_m(OopClosure* blk, MemRegion mr);
117
118 // Debugging code
119 void print() PRODUCT_RETURN;
120 void verify(outputStream* st, bool force = false);
121 static void print_statistics() PRODUCT_RETURN;
122
123 protected:
124 friend class vtableEntry;
125 private:
126 enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ;
127 void copy_vtable_to(vtableEntry* start);
128 int initialize_from_super(KlassHandle super);
129 int index_of(methodOop m, int len) const; // same as index_of, but search only up to len
130 void put_method_at(methodOop m, int index);
131 static bool needs_new_vtable_entry(methodHandle m, klassOop super, Handle classloader, Symbol* classname, AccessFlags access_flags, TRAPS);
132
133 bool update_inherited_vtable(instanceKlass* klass, methodHandle target_method, int super_vtable_len, bool checkconstraints, TRAPS);
134 instanceKlass* find_transitive_override(instanceKlass* initialsuper, methodHandle target_method, int vtable_index,
135 Handle target_loader, Symbol* target_classname, Thread* THREAD);
136
137 // support for miranda methods
138 bool is_miranda_entry_at(int i);
139 void fill_in_mirandas(int& initialized);
140 static bool is_miranda(methodOop m, objArrayOop class_methods, klassOop super);
141 static void add_new_mirandas_to_list(GrowableArray<methodOop>* list_of_current_mirandas, objArrayOop current_interface_methods, objArrayOop class_methods, klassOop super);
142 static void get_mirandas(GrowableArray<methodOop>* mirandas, klassOop super, objArrayOop class_methods, objArrayOop local_interfaces);
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(methodOop m);
283
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(methodOop* old_methods, methodOop* new_methods,
291 int methods_length, bool * trace_name_printed);
292 bool check_no_old_or_obsolete_entries();
293 void dump_itable();
294
295 // Garbage collection
296 void oop_follow_contents();
297 void oop_adjust_pointers();
298
299 #ifndef SERIALGC
300 // Parallel Old
301 void oop_follow_contents(ParCompactionManager* cm);
302 void oop_update_pointers(ParCompactionManager* cm);
303 #endif // SERIALGC
304
305 // Iterators
306 void oop_oop_iterate(OopClosure* blk);
307 void oop_oop_iterate_m(OopClosure* blk, MemRegion mr);
308
309 // Setup of itable
310 static int compute_itable_size(objArrayHandle transitive_interfaces);
311 static void setup_itable_offset_table(instanceKlassHandle klass);
312
313 // Resolving of method to index
|