< prev index next >

src/os/windows/vm/os_windows.cpp

Print this page

        

*** 417,426 **** --- 417,428 ---- // processors with hyperthreading technology. static int counter = 0; int pid = os::current_process_id(); _alloca(((pid ^ counter++) & 7) * 128); + thread->initialize_thread_current(); + OSThread* osthr = thread->osthread(); assert(osthr->get_state() == RUNNABLE, "invalid os thread state"); if (UseNUMA) { int lgrp_id = os::numa_get_group_id();
*** 2144,2154 **** // Implicit OS exception handling LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, address handler) { ! JavaThread* thread = JavaThread::current(); // Save pc in thread #ifdef _M_IA64 // Do not blow up if no thread info available. if (thread) { // Saving PRECISE pc (with slot information) in thread. --- 2146,2156 ---- // Implicit OS exception handling LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, address handler) { ! JavaThread* thread = (JavaThread*) Thread::current_or_null(); // Save pc in thread #ifdef _M_IA64 // Do not blow up if no thread info available. if (thread) { // Saving PRECISE pc (with slot information) in thread.
*** 2382,2392 **** address pc = (address) exceptionInfo->ContextRecord->Rip; #else address pc = (address) exceptionInfo->ContextRecord->Eip; #endif #endif ! Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady // Handle SafeFetch32 and SafeFetchN exceptions. if (StubRoutines::is_safefetch_fault(pc)) { return Handle_Exception(exceptionInfo, StubRoutines::continuation_for_safefetch_fault(pc)); } --- 2384,2394 ---- address pc = (address) exceptionInfo->ContextRecord->Rip; #else address pc = (address) exceptionInfo->ContextRecord->Eip; #endif #endif ! Thread* t = Thread::current_or_null_safe(); // Handle SafeFetch32 and SafeFetchN exceptions. if (StubRoutines::is_safefetch_fault(pc)) { return Handle_Exception(exceptionInfo, StubRoutines::continuation_for_safefetch_fault(pc)); }
*** 4009,4039 **** int result = MessageBox(NULL, message, title, MB_YESNO | MB_ICONERROR | MB_SYSTEMMODAL | MB_DEFAULT_DESKTOP_ONLY); return result == IDYES; } - int os::allocate_thread_local_storage() { - return TlsAlloc(); - } - - - void os::free_thread_local_storage(int index) { - TlsFree(index); - } - - - void os::thread_local_storage_at_put(int index, void* value) { - TlsSetValue(index, value); - assert(thread_local_storage_at(index) == value, "Just checking"); - } - - - void* os::thread_local_storage_at(int index) { - return TlsGetValue(index); - } - - #ifndef PRODUCT #ifndef _WIN64 // Helpers to check whether NX protection is enabled int nx_exception_filter(_EXCEPTION_POINTERS *pex) { if (pex->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && --- 4011,4020 ----
*** 4077,4086 **** --- 4058,4070 ---- if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, &main_thread, THREAD_ALL_ACCESS, false, 0)) { fatal("DuplicateHandle failed\n"); } main_thread_id = (int) GetCurrentThreadId(); + + // initialize fast thread access - only used for 32-bit + win32::initialize_thread_ptr_offset(); } // To install functions for atexit processing extern "C" { static void perfMemory_exit_helper() {
*** 5175,5204 **** if (time == 0) { // Wait for the minimal time unit if zero time = 1; } } ! JavaThread* thread = (JavaThread*)(Thread::current()); ! assert(thread->is_Java_thread(), "Must be JavaThread"); ! JavaThread *jt = (JavaThread *)thread; // Don't wait if interrupted or already triggered if (Thread::is_interrupted(thread, false) || WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) { ResetEvent(_ParkEvent); return; } else { ! ThreadBlockInVM tbivm(jt); OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */); ! jt->set_suspend_equivalent(); WaitForSingleObject(_ParkEvent, time); ResetEvent(_ParkEvent); // If externally suspended while waiting, re-suspend ! if (jt->handle_special_suspend_equivalent_condition()) { ! jt->java_suspend_self(); } } } void Parker::unpark() { --- 5159,5186 ---- if (time == 0) { // Wait for the minimal time unit if zero time = 1; } } ! JavaThread* thread = JavaThread::current(); // Don't wait if interrupted or already triggered if (Thread::is_interrupted(thread, false) || WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) { ResetEvent(_ParkEvent); return; } else { ! ThreadBlockInVM tbivm(thread); OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */); ! thread->set_suspend_equivalent(); WaitForSingleObject(_ParkEvent, time); ResetEvent(_ParkEvent); // If externally suspended while waiting, re-suspend ! if (thread->handle_special_suspend_equivalent_condition()) { ! thread->java_suspend_self(); } } } void Parker::unpark() {
*** 5289,5299 **** LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) { DWORD exception_code = e->ExceptionRecord->ExceptionCode; if (exception_code == EXCEPTION_ACCESS_VIOLATION) { ! JavaThread* thread = (JavaThread*)ThreadLocalStorage::get_thread_slow(); PEXCEPTION_RECORD exceptionRecord = e->ExceptionRecord; address addr = (address) exceptionRecord->ExceptionInformation[1]; if (os::is_memory_serialize_page(thread, addr)) { return EXCEPTION_CONTINUE_EXECUTION; --- 5271,5281 ---- LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) { DWORD exception_code = e->ExceptionRecord->ExceptionCode; if (exception_code == EXCEPTION_ACCESS_VIOLATION) { ! JavaThread* thread = JavaThread::current(); PEXCEPTION_RECORD exceptionRecord = e->ExceptionRecord; address addr = (address) exceptionRecord->ExceptionInformation[1]; if (os::is_memory_serialize_page(thread, addr)) { return EXCEPTION_CONTINUE_EXECUTION;
*** 5999,6003 **** --- 5981,5998 ---- // restore globals UseLargePagesIndividualAllocation = old_use_large_pages_individual_allocation; UseNUMAInterleaving = old_use_numa_interleaving; } #endif // PRODUCT + + // Fast current thread access + + int os::win32::_thread_ptr_offset = 0; + + static void call_wrapper_dummy() {} + + // We need to call the os_exception_wrapper once so that it sets + // up the offset from FS of the thread pointer. + void os::win32::initialize_thread_ptr_offset() { + os::os_exception_wrapper((java_call_t)call_wrapper_dummy, + NULL, NULL, NULL, NULL); + }
< prev index next >