8284336: CDS SignedJar.java test fails due to archived Reference object
Reviewed-by: alanb, ccheung
This commit is contained in:
parent
1bd8975caf
commit
662320a0ec
src
hotspot/share
java.base/share/classes
@ -211,6 +211,23 @@ void HeapShared::reset_archived_object_states(TRAPS) {
|
||||
reset_states(SystemDictionary::java_platform_loader(), CHECK);
|
||||
log_debug(cds)("Resetting system loader");
|
||||
reset_states(SystemDictionary::java_system_loader(), CHECK);
|
||||
|
||||
// Clean up jdk.internal.loader.ClassLoaders::bootLoader(), which is not
|
||||
// directly used for class loading, but rather is used by the core library
|
||||
// to keep track of resources, etc, loaded by the null class loader.
|
||||
//
|
||||
// Note, this object is non-null, and is not the same as
|
||||
// ClassLoaderData::the_null_class_loader_data()->class_loader(),
|
||||
// which is null.
|
||||
log_debug(cds)("Resetting boot loader");
|
||||
JavaValue result(T_OBJECT);
|
||||
JavaCalls::call_static(&result,
|
||||
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
|
||||
vmSymbols::bootLoader_name(),
|
||||
vmSymbols::void_BuiltinClassLoader_signature(),
|
||||
CHECK);
|
||||
Handle boot_loader(THREAD, result.get_oop());
|
||||
reset_states(boot_loader(), CHECK);
|
||||
}
|
||||
|
||||
HeapShared::ArchivedObjectCache* HeapShared::_archived_object_cache = NULL;
|
||||
|
@ -4991,7 +4991,10 @@ bool JavaClasses::is_supported_for_archiving(oop obj) {
|
||||
// constant pool entries, so excluding them shouldn't affect the archiving of static fields.
|
||||
klass == vmClasses::ResolvedMethodName_klass() ||
|
||||
klass == vmClasses::MemberName_klass() ||
|
||||
klass == vmClasses::Context_klass()) {
|
||||
klass == vmClasses::Context_klass() ||
|
||||
// It's problematic to archive Reference objects. One of the reasons is that
|
||||
// Reference::discovered may pull in unwanted objects (see JDK-8284336)
|
||||
klass->is_subclass_of(vmClasses::Reference_klass())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -403,6 +403,7 @@
|
||||
template(deadChild_name, "deadChild") \
|
||||
template(getFromClass_name, "getFromClass") \
|
||||
template(dispatch_name, "dispatch") \
|
||||
template(bootLoader_name, "bootLoader") \
|
||||
template(getPlatformClassLoader_name, "getPlatformClassLoader") \
|
||||
template(getSystemClassLoader_name, "getSystemClassLoader") \
|
||||
template(fillInStackTrace_name, "fillInStackTrace") \
|
||||
@ -561,6 +562,7 @@
|
||||
template(long_long_void_signature, "(JJ)V") \
|
||||
template(void_byte_array_signature, "()[B") \
|
||||
template(void_classloader_signature, "()Ljava/lang/ClassLoader;") \
|
||||
template(void_BuiltinClassLoader_signature, "()Ljdk/internal/loader/BuiltinClassLoader;") \
|
||||
template(void_object_signature, "()Ljava/lang/Object;") \
|
||||
template(void_class_signature, "()Ljava/lang/Class;") \
|
||||
template(void_class_array_signature, "()[Ljava/lang/Class;") \
|
||||
|
@ -2716,7 +2716,9 @@ public abstract class ClassLoader {
|
||||
* Called by the VM, during -Xshare:dump
|
||||
*/
|
||||
private void resetArchivedStates() {
|
||||
parallelLockMap.clear();
|
||||
if (parallelLockMap != null) {
|
||||
parallelLockMap.clear();
|
||||
}
|
||||
packages.clear();
|
||||
package2certs.clear();
|
||||
classes.clear();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1083,5 +1083,6 @@ public class BuiltinClassLoader
|
||||
// Called from VM only, during -Xshare:dump
|
||||
private void resetArchivedStates() {
|
||||
ucp = null;
|
||||
resourceCache = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user