8266770: Clean pending exception before running dynamic CDS dump

Reviewed-by: ccheung, iklam
This commit is contained in:
Yumin Qi 2021-05-11 16:57:40 +00:00
parent 7a0a57cd56
commit ac0287fd73

View File

@ -3294,6 +3294,13 @@ void Threads::create_vm_init_libraries() {
void JavaThread::invoke_shutdown_hooks() {
HandleMark hm(this);
// We could get here with a pending exception, if so clear it now or
// it will cause MetaspaceShared::link_and_cleanup_shared_classes to
// fail for dynamic dump.
if (this->has_pending_exception()) {
this->clear_pending_exception();
}
// Link all classes for dynamic CDS dumping before vm exit.
// Same operation is being done in JVM_BeforeHalt for handling the
// case where the application calls System.exit().
@ -3301,11 +3308,6 @@ void JavaThread::invoke_shutdown_hooks() {
MetaspaceShared::link_and_cleanup_shared_classes(this);
}
// We could get here with a pending exception, if so clear it now.
if (this->has_pending_exception()) {
this->clear_pending_exception();
}
EXCEPTION_MARK;
Klass* shutdown_klass =
SystemDictionary::resolve_or_null(vmSymbols::java_lang_Shutdown(),