7195867: NPG: SAJDI tests fail with sun.jvm.hotspot.types.WrongTypeException: No suitable match for type
Need to restore the vtable in metadata when we restore the type from the shared archive. Reviewed-by: acorn, jcoomes, jmasa, jrose
This commit is contained in:
parent
f3b6368c39
commit
8536f548db
@ -1953,7 +1953,7 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
|
|||||||
// Initialize the constant pool for the Object_class
|
// Initialize the constant pool for the Object_class
|
||||||
InstanceKlass* ik = InstanceKlass::cast(Object_klass());
|
InstanceKlass* ik = InstanceKlass::cast(Object_klass());
|
||||||
ik->constants()->restore_unshareable_info(CHECK);
|
ik->constants()->restore_unshareable_info(CHECK);
|
||||||
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
||||||
} else {
|
} else {
|
||||||
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
|
||||||
}
|
}
|
||||||
|
@ -153,9 +153,9 @@ static void calculate_fingerprints() {
|
|||||||
//
|
//
|
||||||
// Execution time:
|
// Execution time:
|
||||||
// First virtual method call for any object of these metadata types:
|
// First virtual method call for any object of these metadata types:
|
||||||
// 1. object->klass->klass_part
|
// 1. object->klass
|
||||||
// 2. vtable entry for that klass_part points to the jump table entries
|
// 2. vtable entry for that klass points to the jump table entries
|
||||||
// 3. branches to common_code with %O0/klass_part, %L0: Klass index <<8 + method index
|
// 3. branches to common_code with %O0/klass, %L0: Klass index <<8 + method index
|
||||||
// 4. common_code:
|
// 4. common_code:
|
||||||
// Get address of new vtbl pointer for this Klass from updated table
|
// Get address of new vtbl pointer for this Klass from updated table
|
||||||
// Update new vtbl pointer in the Klass: future virtual calls go direct
|
// Update new vtbl pointer in the Klass: future virtual calls go direct
|
||||||
|
@ -152,6 +152,10 @@ void ConstantPool::initialize_resolved_references(ClassLoaderData* loader_data,
|
|||||||
|
|
||||||
// CDS support. Create a new resolved_references array.
|
// CDS support. Create a new resolved_references array.
|
||||||
void ConstantPool::restore_unshareable_info(TRAPS) {
|
void ConstantPool::restore_unshareable_info(TRAPS) {
|
||||||
|
|
||||||
|
// restore the C++ vtable from the shared archive
|
||||||
|
restore_vtable();
|
||||||
|
|
||||||
if (SystemDictionary::Object_klass_loaded()) {
|
if (SystemDictionary::Object_klass_loaded()) {
|
||||||
// Recreate the object array and add to ClassLoaderData.
|
// Recreate the object array and add to ClassLoaderData.
|
||||||
int map_length = resolved_reference_length();
|
int map_length = resolved_reference_length();
|
||||||
|
@ -643,6 +643,11 @@ class ConstantPool : public Metadata {
|
|||||||
void remove_unshareable_info();
|
void remove_unshareable_info();
|
||||||
void restore_unshareable_info(TRAPS);
|
void restore_unshareable_info(TRAPS);
|
||||||
bool resolve_class_constants(TRAPS);
|
bool resolve_class_constants(TRAPS);
|
||||||
|
// The ConstantPool vtable is restored by this call when the ConstantPool is
|
||||||
|
// in the shared archive. See patch_klass_vtables() in metaspaceShared.cpp for
|
||||||
|
// all the gory details. SA, dtrace and pstack helpers distinguish metadata
|
||||||
|
// by their vtable.
|
||||||
|
void restore_vtable() { guarantee(is_constantPool(), "vtable restored by this call"); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { _no_index_sentinel = -1, _possible_index_sentinel = -2 };
|
enum { _no_index_sentinel = -1, _possible_index_sentinel = -2 };
|
||||||
|
@ -2165,6 +2165,8 @@ void InstanceKlass::restore_unshareable_info(TRAPS) {
|
|||||||
for (int index2 = 0; index2 < num_methods; ++index2) {
|
for (int index2 = 0; index2 < num_methods; ++index2) {
|
||||||
methodHandle m(THREAD, methods->at(index2));
|
methodHandle m(THREAD, methods->at(index2));
|
||||||
m()->link_method(m, CHECK);
|
m()->link_method(m, CHECK);
|
||||||
|
// restore method's vtable by calling a virtual function
|
||||||
|
m->restore_vtable();
|
||||||
}
|
}
|
||||||
if (JvmtiExport::has_redefined_a_class()) {
|
if (JvmtiExport::has_redefined_a_class()) {
|
||||||
// Reinitialize vtable because RedefineClasses may have changed some
|
// Reinitialize vtable because RedefineClasses may have changed some
|
||||||
|
@ -168,9 +168,16 @@ class Method : public Metadata {
|
|||||||
TRAPS);
|
TRAPS);
|
||||||
|
|
||||||
Method() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
|
Method() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
|
||||||
|
|
||||||
|
// The Method vtable is restored by this call when the Method is in the
|
||||||
|
// shared archive. See patch_klass_vtables() in metaspaceShared.cpp for
|
||||||
|
// all the gory details. SA, dtrace and pstack helpers distinguish metadata
|
||||||
|
// by their vtable.
|
||||||
|
void restore_vtable() { guarantee(is_method(), "vtable restored by this call"); }
|
||||||
bool is_method() const volatile { return true; }
|
bool is_method() const volatile { return true; }
|
||||||
|
|
||||||
// accessors for instance variables
|
// accessors for instance variables
|
||||||
|
|
||||||
ConstMethod* constMethod() const { return _constMethod; }
|
ConstMethod* constMethod() const { return _constMethod; }
|
||||||
void set_constMethod(ConstMethod* xconst) { _constMethod = xconst; }
|
void set_constMethod(ConstMethod* xconst) { _constMethod = xconst; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user