Skip to content

Commit ac0287f

Browse files
committedMay 11, 2021
8266770: Clean pending exception before running dynamic CDS dump
Reviewed-by: ccheung, iklam
1 parent 7a0a57c commit ac0287f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎src/hotspot/share/runtime/thread.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -3294,18 +3294,20 @@ void Threads::create_vm_init_libraries() {
32943294
void JavaThread::invoke_shutdown_hooks() {
32953295
HandleMark hm(this);
32963296

3297+
// We could get here with a pending exception, if so clear it now or
3298+
// it will cause MetaspaceShared::link_and_cleanup_shared_classes to
3299+
// fail for dynamic dump.
3300+
if (this->has_pending_exception()) {
3301+
this->clear_pending_exception();
3302+
}
3303+
32973304
// Link all classes for dynamic CDS dumping before vm exit.
32983305
// Same operation is being done in JVM_BeforeHalt for handling the
32993306
// case where the application calls System.exit().
33003307
if (DynamicDumpSharedSpaces) {
33013308
MetaspaceShared::link_and_cleanup_shared_classes(this);
33023309
}
33033310

3304-
// We could get here with a pending exception, if so clear it now.
3305-
if (this->has_pending_exception()) {
3306-
this->clear_pending_exception();
3307-
}
3308-
33093311
EXCEPTION_MARK;
33103312
Klass* shutdown_klass =
33113313
SystemDictionary::resolve_or_null(vmSymbols::java_lang_Shutdown(),

0 commit comments

Comments
 (0)