comparison src/os/windows/vm/os_windows.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 3eed8712d410 364b73402247
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
2436 if ( os::is_memory_serialize_page(thread, addr) ) { 2436 if ( os::is_memory_serialize_page(thread, addr) ) {
2437 // Block current thread until the memory serialize page permission restored. 2437 // Block current thread until the memory serialize page permission restored.
2438 os::block_on_serialize_page_trap(); 2438 os::block_on_serialize_page_trap();
2439 return EXCEPTION_CONTINUE_EXECUTION; 2439 return EXCEPTION_CONTINUE_EXECUTION;
2440 } 2440 }
2441 }
2442
2443 if ((exception_code == EXCEPTION_ACCESS_VIOLATION) &&
2444 VM_Version::is_cpuinfo_segv_addr(pc)) {
2445 // Verify that OS save/restore AVX registers.
2446 return Handle_Exception(exceptionInfo, VM_Version::cpuinfo_cont_addr());
2441 } 2447 }
2442 2448
2443 if (t != NULL && t->is_Java_thread()) { 2449 if (t != NULL && t->is_Java_thread()) {
2444 JavaThread* thread = (JavaThread*) t; 2450 JavaThread* thread = (JavaThread*) t;
2445 bool in_java = thread->thread_state() == _thread_in_Java; 2451 bool in_java = thread->thread_state() == _thread_in_Java;
2711 } 2717 }
2712 return (address)-1; 2718 return (address)-1;
2713 } 2719 }
2714 #endif 2720 #endif
2715 2721
2716 #ifndef PRODUCT
2717 void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) { 2722 void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) {
2718 // Install a win32 structured exception handler around the test 2723 // Install a win32 structured exception handler around the test
2719 // function call so the VM can generate an error dump if needed. 2724 // function call so the VM can generate an error dump if needed.
2720 __try { 2725 __try {
2721 (*funcPtr)(); 2726 (*funcPtr)();
2722 } __except(topLevelExceptionFilter( 2727 } __except(topLevelExceptionFilter(
2723 (_EXCEPTION_POINTERS*)_exception_info())) { 2728 (_EXCEPTION_POINTERS*)_exception_info())) {
2724 // Nothing to do. 2729 // Nothing to do.
2725 } 2730 }
2726 } 2731 }
2727 #endif
2728 2732
2729 // Virtual Memory 2733 // Virtual Memory
2730 2734
2731 int os::vm_page_size() { return os::win32::vm_page_size(); } 2735 int os::vm_page_size() { return os::win32::vm_page_size(); }
2732 int os::vm_allocation_granularity() { 2736 int os::vm_allocation_granularity() {
3497 result = OS_TIMEOUT; 3501 result = OS_TIMEOUT;
3498 } 3502 }
3499 return result; 3503 return result;
3500 } 3504 }
3501 3505
3506 //
3507 // Short sleep, direct OS call.
3508 //
3509 // ms = 0, means allow others (if any) to run.
3510 //
3511 void os::naked_short_sleep(jlong ms) {
3512 assert(ms < 1000, "Un-interruptable sleep, short time use only");
3513 Sleep(ms);
3514 }
3515
3502 // Sleep forever; naked call to OS-specific sleep; use with CAUTION 3516 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
3503 void os::infinite_sleep() { 3517 void os::infinite_sleep() {
3504 while (true) { // sleep forever ... 3518 while (true) { // sleep forever ...
3505 Sleep(100000); // ... 100 seconds at a time 3519 Sleep(100000); // ... 100 seconds at a time
3506 } 3520 }
3624 bool os::is_interrupted(Thread* thread, bool clear_interrupted) { 3638 bool os::is_interrupted(Thread* thread, bool clear_interrupted) {
3625 assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), 3639 assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(),
3626 "possibility of dangling Thread pointer"); 3640 "possibility of dangling Thread pointer");
3627 3641
3628 OSThread* osthread = thread->osthread(); 3642 OSThread* osthread = thread->osthread();
3629 bool interrupted = osthread->interrupted();
3630 // There is no synchronization between the setting of the interrupt 3643 // There is no synchronization between the setting of the interrupt
3631 // and it being cleared here. It is critical - see 6535709 - that 3644 // and it being cleared here. It is critical - see 6535709 - that
3632 // we only clear the interrupt state, and reset the interrupt event, 3645 // we only clear the interrupt state, and reset the interrupt event,
3633 // if we are going to report that we were indeed interrupted - else 3646 // if we are going to report that we were indeed interrupted - else
3634 // an interrupt can be "lost", leading to spurious wakeups or lost wakeups 3647 // an interrupt can be "lost", leading to spurious wakeups or lost wakeups
3635 // depending on the timing 3648 // depending on the timing. By checking thread interrupt event to see
3649 // if the thread gets real interrupt thus prevent spurious wakeup.
3650 bool interrupted = osthread->interrupted() && (WaitForSingleObject(osthread->interrupt_event(), 0) == WAIT_OBJECT_0);
3636 if (interrupted && clear_interrupted) { 3651 if (interrupted && clear_interrupted) {
3637 osthread->set_interrupted(false); 3652 osthread->set_interrupted(false);
3638 ResetEvent(osthread->interrupt_event()); 3653 ResetEvent(osthread->interrupt_event());
3639 } // Otherwise leave the interrupted state alone 3654 } // Otherwise leave the interrupted state alone
3640 3655