-
Bug
-
Resolution: Fixed
-
P4
-
13
-
b20
When running this test case:
==========
$ cat TestExit.java
public class TestExit {
public static void main(String... args) {
System.exit(-1);
}
}
==========
with fastdebug or slowdebug (turns on VerifyBeforeExit), we don't actually execute the code path that perform the verification.
The VM exits inside the this->loop() call:
==========
// Wait for VM_Operations until termination
this->loop();
// Note the intention to exit before safepointing.
// 6295565 This has the effect of waiting for any large tty
// outputs to finish.
if (xtty != NULL) {
ttyLocker ttyl;
xtty->begin_elem("destroy_vm");
xtty->stamp();
xtty->end_elem();
assert(should_terminate(), "termination flag must be set");
}
// 4526887 let VM thread exit at Safepoint
_cur_vm_operation = &halt_op;
SafepointSynchronize::begin();
if (VerifyBeforeExit) {
HandleMark hm(VMThread::vm_thread());
// Among other things, this ensures that Eden top is correct.
Universe::heap()->prepare_for_verify();
// Silent verification so as not to pollute normal output,
// unless we really asked for it.
Universe::verify();
}
==========
this->loop() terminates when we execute:
#0 vm_exit (code=-1) at src/hotspot/share/runtime/java.cpp:532
#1 0x00007ffff69b3dc0 in JVM_Halt (code=-1) at src/hotspot/share/prims/jvm.cpp:478
#2 0x00007ffff5ac6bcd in Java_java_lang_Shutdown_halt0 (env=0x7ffff001eb80, ignored=0x7ffff5bed610, code=-1) at src/java.base/share/native/libjava/Shutdown.c:41
and vm_exit schedules a VM_Exit vm operation, that runs inside this->loop().
VM_Exit::doit calls vm_direct_exit:
==========
void vm_direct_exit(int code) {
notify_vm_shutdown();
os::wait_for_keypress_at_exit();
os::exit(code);
}
==========
==========
$ cat TestExit.java
public class TestExit {
public static void main(String... args) {
System.exit(-1);
}
}
==========
with fastdebug or slowdebug (turns on VerifyBeforeExit), we don't actually execute the code path that perform the verification.
The VM exits inside the this->loop() call:
==========
// Wait for VM_Operations until termination
this->loop();
// Note the intention to exit before safepointing.
// 6295565 This has the effect of waiting for any large tty
// outputs to finish.
if (xtty != NULL) {
ttyLocker ttyl;
xtty->begin_elem("destroy_vm");
xtty->stamp();
xtty->end_elem();
assert(should_terminate(), "termination flag must be set");
}
// 4526887 let VM thread exit at Safepoint
_cur_vm_operation = &halt_op;
SafepointSynchronize::begin();
if (VerifyBeforeExit) {
HandleMark hm(VMThread::vm_thread());
// Among other things, this ensures that Eden top is correct.
Universe::heap()->prepare_for_verify();
// Silent verification so as not to pollute normal output,
// unless we really asked for it.
Universe::verify();
}
==========
this->loop() terminates when we execute:
#0 vm_exit (code=-1) at src/hotspot/share/runtime/java.cpp:532
#1 0x00007ffff69b3dc0 in JVM_Halt (code=-1) at src/hotspot/share/prims/jvm.cpp:478
#2 0x00007ffff5ac6bcd in Java_java_lang_Shutdown_halt0 (env=0x7ffff001eb80, ignored=0x7ffff5bed610, code=-1) at src/java.base/share/native/libjava/Shutdown.c:41
and vm_exit schedules a VM_Exit vm operation, that runs inside this->loop().
VM_Exit::doit calls vm_direct_exit:
==========
void vm_direct_exit(int code) {
notify_vm_shutdown();
os::wait_for_keypress_at_exit();
os::exit(code);
}
==========