408 // Initialize dependency array for null class loader |
408 // Initialize dependency array for null class loader |
409 ClassLoaderData::the_null_class_loader_data()->init_dependencies(CHECK); |
409 ClassLoaderData::the_null_class_loader_data()->init_dependencies(CHECK); |
410 |
410 |
411 } |
411 } |
412 |
412 |
413 // CDS support for patching vtables in metadata in the shared archive. |
|
414 // All types inherited from Metadata have vtables, but not types inherited |
|
415 // from MetaspaceObj, because the latter does not have virtual functions. |
|
416 // If the metadata type has a vtable, it cannot be shared in the read-only |
|
417 // section of the CDS archive, because the vtable pointer is patched. |
|
418 static inline void add_vtable(void** list, int* n, void* o, int count) { |
|
419 guarantee((*n) < count, "vtable list too small"); |
|
420 void* vtable = dereference_vptr(o); |
|
421 assert(*(void**)(vtable) != NULL, "invalid vtable"); |
|
422 list[(*n)++] = vtable; |
|
423 } |
|
424 |
|
425 void Universe::init_self_patching_vtbl_list(void** list, int count) { |
|
426 int n = 0; |
|
427 { InstanceKlass o; add_vtable(list, &n, &o, count); } |
|
428 { InstanceClassLoaderKlass o; add_vtable(list, &n, &o, count); } |
|
429 { InstanceMirrorKlass o; add_vtable(list, &n, &o, count); } |
|
430 { InstanceRefKlass o; add_vtable(list, &n, &o, count); } |
|
431 { TypeArrayKlass o; add_vtable(list, &n, &o, count); } |
|
432 { ObjArrayKlass o; add_vtable(list, &n, &o, count); } |
|
433 { Method o; add_vtable(list, &n, &o, count); } |
|
434 { ConstantPool o; add_vtable(list, &n, &o, count); } |
|
435 } |
|
436 |
|
437 void Universe::initialize_basic_type_mirrors(TRAPS) { |
413 void Universe::initialize_basic_type_mirrors(TRAPS) { |
438 assert(_int_mirror==NULL, "basic type mirrors already initialized"); |
414 assert(_int_mirror==NULL, "basic type mirrors already initialized"); |
439 _int_mirror = |
415 _int_mirror = |
440 java_lang_Class::create_basic_type_mirror("int", T_INT, CHECK); |
416 java_lang_Class::create_basic_type_mirror("int", T_INT, CHECK); |
441 _float_mirror = |
417 _float_mirror = |