8276126: Dump time class transformation causes heap objects of non-boot classes to be archived

Reviewed-by: iklam, minqi
This commit is contained in:
Calvin Cheung 2021-12-02 14:39:27 +00:00
parent 7696897932
commit d2b16c8985
11 changed files with 201 additions and 10 deletions

View file

@ -1253,7 +1253,8 @@ char* ClassLoader::skip_uri_protocol(char* source) {
// Record the shared classpath index and loader type for classes loaded
// by the builtin loaders at dump time.
void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik, const ClassFileStream* stream) {
void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
const ClassFileStream* stream, bool redefined) {
Arguments::assert_is_dumping_archive();
assert(stream != NULL, "sanity");
@ -1337,10 +1338,10 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik, const Cl
}
}
// No path entry found for this class. Must be a shared class loaded by the
// No path entry found for this class: most likely a shared class loaded by the
// user defined classloader.
if (classpath_index < 0) {
assert(ik->shared_classpath_index() < 0, "Sanity");
if (classpath_index < 0 && !SystemDictionaryShared::is_builtin_loader(ik->class_loader_data())) {
assert(ik->shared_classpath_index() < 0, "not assigned yet");
ik->set_shared_classpath_index(UNREGISTERED_INDEX);
SystemDictionaryShared::set_shared_class_misc_info(ik, (ClassFileStream*)stream);
return;
@ -1359,7 +1360,7 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik, const Cl
ik->name()->utf8_length());
assert(file_name != NULL, "invariant");
ClassLoaderExt::record_result(classpath_index, ik);
ClassLoaderExt::record_result(classpath_index, ik, redefined);
}
#endif // INCLUDE_CDS