8305757: Call Method::compute_has_loops_flag() when creating CDS archive

Reviewed-by: coleenp, ccheung
This commit is contained in:
Ioi Lam 2023-04-19 02:53:02 +00:00
parent eb8d8cdddd
commit c7faf60201
3 changed files with 12 additions and 0 deletions

View File

@ -838,6 +838,7 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
SystemDictionaryShared::set_class_has_failed_verification(ik);
_has_error_classes = true;
}
ik->compute_has_loops_flag_for_methods();
BytecodeVerificationLocal = saved;
return true;
} else {

View File

@ -2624,6 +2624,16 @@ void InstanceKlass::init_shared_package_entry() {
#endif
}
void InstanceKlass::compute_has_loops_flag_for_methods() {
Array<Method*>* methods = this->methods();
for (int index = 0; index < methods->length(); ++index) {
Method* m = methods->at(index);
if (!m->is_overpass()) { // work around JDK-8305771
m->compute_has_loops_flag();
}
}
}
void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain,
PackageEntry* pkg_entry, TRAPS) {
// InstanceKlass::add_to_hierarchy() sets the init_state to loaded

View File

@ -1141,6 +1141,7 @@ public:
void init_shared_package_entry();
bool can_be_verified_at_dumptime() const;
bool methods_contain_jsr_bytecode() const;
void compute_has_loops_flag_for_methods();
#endif
jint compute_modifier_flags() const;