mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8210926: vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java failed with JVMTI_ERROR_INVALID_CLASS in CDS mode
Reset InstanceKlass _init_state to 'allocated' before writing out shared classes at dump time. Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
0746fffe5c
commit
061c4d7a81
3 changed files with 15 additions and 14 deletions
|
@ -686,15 +686,6 @@ bool InstanceKlass::verify_code(TRAPS) {
|
|||
return Verifier::verify(this, should_verify_class(), THREAD);
|
||||
}
|
||||
|
||||
|
||||
// Used exclusively by the shared spaces dump mechanism to prevent
|
||||
// classes mapped into the shared regions in new VMs from appearing linked.
|
||||
|
||||
void InstanceKlass::unlink_class() {
|
||||
assert(is_linked(), "must be linked");
|
||||
_init_state = loaded;
|
||||
}
|
||||
|
||||
void InstanceKlass::link_class(TRAPS) {
|
||||
assert(is_loaded(), "must be loaded");
|
||||
if (!is_linked()) {
|
||||
|
@ -2300,10 +2291,12 @@ void InstanceKlass::remove_unshareable_info() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Unlink the class
|
||||
if (is_linked()) {
|
||||
unlink_class();
|
||||
}
|
||||
// Reset to the 'allocated' state to prevent any premature accessing to
|
||||
// a shared class at runtime while the class is still being loaded and
|
||||
// restored. A class' init_state is set to 'loaded' at runtime when it's
|
||||
// being added to class hierarchy (see SystemDictionary:::add_to_hierarchy()).
|
||||
_init_state = allocated;
|
||||
|
||||
{
|
||||
MutexLocker ml(Compile_lock);
|
||||
init_implementor();
|
||||
|
@ -2350,6 +2343,10 @@ void InstanceKlass::remove_java_mirror() {
|
|||
}
|
||||
|
||||
void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
|
||||
// SystemDictionary::add_to_hierarchy() sets the init_state to loaded
|
||||
// before the InstanceKlass is added to the SystemDictionary. Make
|
||||
// sure the current state is <loaded.
|
||||
assert(!is_loaded(), "invalid init state");
|
||||
set_package(loader_data, CHECK);
|
||||
Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue