mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8078644: CDS needs to support JVMTI CFLH
Support posting CLFH for shared classes. Tests are contributed by Misha Seledtsov. Reviewed-by: iklam, coleenp, acorn, dcubed, sspitsyn
This commit is contained in:
parent
38eb4a4f6f
commit
eb52950704
28 changed files with 1256 additions and 68 deletions
|
@ -1210,16 +1210,12 @@ Klass* SystemDictionary::find_shared_class(Symbol* class_name) {
|
|||
|
||||
instanceKlassHandle SystemDictionary::load_shared_class(
|
||||
Symbol* class_name, Handle class_loader, TRAPS) {
|
||||
// Don't load shared class when JvmtiExport::should_post_class_file_load_hook()
|
||||
// is enabled since posting CFLH is not supported when loading shared class.
|
||||
if (!JvmtiExport::should_post_class_file_load_hook()) {
|
||||
instanceKlassHandle ik (THREAD, find_shared_class(class_name));
|
||||
// Make sure we only return the boot class for the NULL classloader.
|
||||
if (ik.not_null() &&
|
||||
ik->is_shared_boot_class() && class_loader.is_null()) {
|
||||
Handle protection_domain;
|
||||
return load_shared_class(ik, class_loader, protection_domain, THREAD);
|
||||
}
|
||||
instanceKlassHandle ik (THREAD, find_shared_class(class_name));
|
||||
// Make sure we only return the boot class for the NULL classloader.
|
||||
if (ik.not_null() &&
|
||||
ik->is_shared_boot_class() && class_loader.is_null()) {
|
||||
Handle protection_domain;
|
||||
return load_shared_class(ik, class_loader, protection_domain, THREAD);
|
||||
}
|
||||
return instanceKlassHandle();
|
||||
}
|
||||
|
@ -1303,11 +1299,6 @@ instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik,
|
|||
Handle class_loader,
|
||||
Handle protection_domain, TRAPS) {
|
||||
instanceKlassHandle nh = instanceKlassHandle(); // null Handle
|
||||
if (JvmtiExport::should_post_class_file_load_hook()) {
|
||||
// Don't load shared class when JvmtiExport::should_post_class_file_load_hook()
|
||||
// is enabled since posting CFLH is not supported when loading shared class.
|
||||
return nh;
|
||||
}
|
||||
|
||||
if (ik.not_null()) {
|
||||
Symbol* class_name = ik->name();
|
||||
|
@ -1358,6 +1349,14 @@ instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik,
|
|||
}
|
||||
}
|
||||
|
||||
instanceKlassHandle new_ik = KlassFactory::check_shared_class_file_load_hook(
|
||||
ik, class_name, class_loader, protection_domain, CHECK_(nh));
|
||||
if (new_ik.not_null()) {
|
||||
// The class is changed by CFLH. Return the new class. The shared class is
|
||||
// not used.
|
||||
return new_ik;
|
||||
}
|
||||
|
||||
// Adjust methods to recover missing data. They need addresses for
|
||||
// interpreter entry points and their default native method address
|
||||
// must be reset.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue