8055338: (process) Add instrumentation to help diagnose JDK-6573254
Reviewed-by: dcubed, ohair, iklam, dholmes, sspitsyn, sla
This commit is contained in:
parent
6515584f58
commit
8d7b009834
@ -409,6 +409,8 @@ struct tm* os::localtime_pd(const time_t* clock, struct tm* res) {
|
||||
|
||||
LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo);
|
||||
|
||||
extern jint volatile vm_getting_terminated;
|
||||
|
||||
// Thread start routine for all new Java threads
|
||||
static unsigned __stdcall java_start(Thread* thread) {
|
||||
// Try to randomize the cache line index of hot stack frames.
|
||||
@ -430,9 +432,17 @@ static unsigned __stdcall java_start(Thread* thread) {
|
||||
}
|
||||
}
|
||||
|
||||
// Diagnostic code to investigate JDK-6573254 (Part I)
|
||||
unsigned res = 90115; // non-java thread
|
||||
if (thread->is_Java_thread()) {
|
||||
JavaThread* java_thread = (JavaThread*)thread;
|
||||
res = java_lang_Thread::is_daemon(java_thread->threadObj())
|
||||
? 70115 // java daemon thread
|
||||
: 80115; // java non-daemon thread
|
||||
}
|
||||
|
||||
// Install a win32 structured exception handler around every thread created
|
||||
// by VM, so VM can genrate error dump when an exception occurred in non-
|
||||
// by VM, so VM can generate error dump when an exception occurred in non-
|
||||
// Java thread (e.g. VM thread).
|
||||
__try {
|
||||
thread->run();
|
||||
@ -448,6 +458,11 @@ static unsigned __stdcall java_start(Thread* thread) {
|
||||
Atomic::dec_ptr((intptr_t*)&os::win32::_os_thread_count);
|
||||
}
|
||||
|
||||
// Diagnostic code to investigate JDK-6573254 (Part II)
|
||||
if (OrderAccess::load_acquire(&vm_getting_terminated)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -430,6 +430,8 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
jint volatile vm_getting_terminated = 0;
|
||||
|
||||
// Note: before_exit() can be executed only once, if more than one threads
|
||||
// are trying to shutdown the VM at the same time, only one thread
|
||||
// can run before_exit() and all other threads must wait.
|
||||
@ -460,6 +462,8 @@ void before_exit(JavaThread * thread) {
|
||||
}
|
||||
}
|
||||
|
||||
OrderAccess::release_store(&vm_getting_terminated, 1);
|
||||
|
||||
// The only difference between this and Win32's _onexit procs is that
|
||||
// this version is invoked before any threads get killed.
|
||||
ExitProc* current = exit_procs;
|
||||
|
Loading…
Reference in New Issue
Block a user