mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8178349: Cache builtin class loader constraints to avoid re-initializing itable/vtable for shared classes
Record loader constraints for built-in class which is loaded by app loader or platform loader in shared archive in dump time. When the class loaded from shared archive at runtime, directly check loader constraints using the saved info so avoid lengthy relayout i/v-table at class link stage. Reviewed-by: iklam, ccheung
This commit is contained in:
parent
eaf3306e44
commit
832272da71
18 changed files with 851 additions and 88 deletions
|
@ -919,20 +919,22 @@ bool InstanceKlass::link_class_impl(TRAPS) {
|
|||
// fabricate new Method*s.
|
||||
// also does loader constraint checking
|
||||
//
|
||||
// initialize_vtable and initialize_itable need to be rerun for
|
||||
// a shared class if the class is not loaded by the NULL classloader.
|
||||
ClassLoaderData * loader_data = class_loader_data();
|
||||
if (!(is_shared() &&
|
||||
loader_data->is_the_null_class_loader_data())) {
|
||||
// initialize_vtable and initialize_itable need to be rerun
|
||||
// for a shared class if
|
||||
// 1) the class is loaded by custom class loader or
|
||||
// 2) the class is loaded by built-in class loader but failed to add archived loader constraints
|
||||
bool need_init_table = true;
|
||||
if (is_shared() && SystemDictionaryShared::check_linking_constraints(this, THREAD)) {
|
||||
need_init_table = false;
|
||||
}
|
||||
if (need_init_table) {
|
||||
vtable().initialize_vtable(true, CHECK_false);
|
||||
itable().initialize_itable(true, CHECK_false);
|
||||
}
|
||||
#ifdef ASSERT
|
||||
else {
|
||||
vtable().verify(tty, true);
|
||||
// In case itable verification is ever added.
|
||||
// itable().verify(tty, true);
|
||||
}
|
||||
vtable().verify(tty, true);
|
||||
// In case itable verification is ever added.
|
||||
// itable().verify(tty, true);
|
||||
#endif
|
||||
set_init_state(linked);
|
||||
if (JvmtiExport::should_post_class_prepare()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue