8306460: Clear JVM_ACC_QUEUED flag on methods when dumping dynamic CDS archive

Reviewed-by: coleenp, iklam
This commit is contained in:
Ashutosh Mehra 2023-05-16 22:36:44 +00:00 committed by Ioi Lam
parent 563152f32d
commit d3e5065284
4 changed files with 31 additions and 0 deletions

View file

@ -2592,6 +2592,18 @@ void InstanceKlass::remove_unshareable_info() {
init_shared_package_entry(); init_shared_package_entry();
_dep_context_last_cleaned = 0; _dep_context_last_cleaned = 0;
_init_monitor = nullptr; _init_monitor = nullptr;
remove_unshareable_flags();
}
void InstanceKlass::remove_unshareable_flags() {
// clear all the flags/stats that shouldn't be in the archived version
assert(!is_scratch_class(), "must be");
assert(!has_been_redefined(), "must be");
#if INCLUDE_JVMTI
set_is_being_redefined(false);
#endif
set_has_resolved_methods(false);
} }
void InstanceKlass::remove_java_mirror() { void InstanceKlass::remove_java_mirror() {

View file

@ -706,6 +706,7 @@ public:
bool has_resolved_methods() const { return _misc_flags.has_resolved_methods(); } bool has_resolved_methods() const { return _misc_flags.has_resolved_methods(); }
void set_has_resolved_methods() { _misc_flags.set_has_resolved_methods(true); } void set_has_resolved_methods() { _misc_flags.set_has_resolved_methods(true); }
void set_has_resolved_methods(bool value) { _misc_flags.set_has_resolved_methods(value); }
public: public:
#if INCLUDE_JVMTI #if INCLUDE_JVMTI
@ -1126,6 +1127,7 @@ public:
#if INCLUDE_CDS #if INCLUDE_CDS
// CDS support - remove and restore oops from metadata. Oops are not shared. // CDS support - remove and restore oops from metadata. Oops are not shared.
virtual void remove_unshareable_info(); virtual void remove_unshareable_info();
void remove_unshareable_flags();
virtual void remove_java_mirror(); virtual void remove_java_mirror();
void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS); void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
void init_shared_package_entry(); void init_shared_package_entry();

View file

@ -408,6 +408,7 @@ void Method::remove_unshareable_info() {
void Method::restore_unshareable_info(TRAPS) { void Method::restore_unshareable_info(TRAPS) {
assert(is_method() && is_valid_method(this), "ensure C++ vtable is restored"); assert(is_method() && is_valid_method(this), "ensure C++ vtable is restored");
assert(!queued_for_compilation(), "method's queued_for_compilation flag should not be set");
} }
#endif #endif
@ -1193,6 +1194,21 @@ void Method::unlink_method() {
set_method_data(nullptr); set_method_data(nullptr);
clear_method_counters(); clear_method_counters();
remove_unshareable_flags();
}
void Method::remove_unshareable_flags() {
// clear all the flags that shouldn't be in the archived version
assert(!is_old(), "must be");
assert(!is_obsolete(), "must be");
assert(!is_deleted(), "must be");
set_is_prefixed_native(false);
set_queued_for_compilation(false);
set_is_not_c2_compilable(false);
set_is_not_c1_compilable(false);
set_is_not_c2_osr_compilable(false);
set_on_stack_flag(false);
} }
#endif #endif

View file

@ -447,6 +447,7 @@ public:
void link_method(const methodHandle& method, TRAPS); void link_method(const methodHandle& method, TRAPS);
// clear entry points. Used by sharing code during dump time // clear entry points. Used by sharing code during dump time
void unlink_method() NOT_CDS_RETURN; void unlink_method() NOT_CDS_RETURN;
void remove_unshareable_flags() NOT_CDS_RETURN;
// the number of argument reg slots that the compiled method uses on the stack. // the number of argument reg slots that the compiled method uses on the stack.
int num_stack_arg_slots() const { return constMethod()->num_stack_arg_slots(); } int num_stack_arg_slots() const { return constMethod()->num_stack_arg_slots(); }