< prev index next >

src/hotspot/os/windows/os_windows.cpp

Print this page
rev 56578 : 8232211: Remove dead code from os.hpp|cpp
Reviewed-by: TBD


 809   }
 810 
 811   const DWORD MS_VC_EXCEPTION = 0x406D1388;
 812   struct {
 813     DWORD dwType;     // must be 0x1000
 814     LPCSTR szName;    // pointer to name (in user addr space)
 815     DWORD dwThreadID; // thread ID (-1=caller thread)
 816     DWORD dwFlags;    // reserved for future use, must be zero
 817   } info;
 818 
 819   info.dwType = 0x1000;
 820   info.szName = name;
 821   info.dwThreadID = -1;
 822   info.dwFlags = 0;
 823 
 824   __try {
 825     RaiseException (MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
 826   } __except(EXCEPTION_EXECUTE_HANDLER) {}
 827 }
 828 
 829 bool os::distribute_processes(uint length, uint* distribution) {
 830   // Not yet implemented.
 831   return false;
 832 }
 833 
 834 bool os::bind_to_processor(uint processor_id) {
 835   // Not yet implemented.
 836   return false;
 837 }
 838 
 839 void os::win32::initialize_performance_counter() {
 840   LARGE_INTEGER count;
 841   QueryPerformanceFrequency(&count);
 842   performance_frequency = as_long(count);
 843   QueryPerformanceCounter(&count);
 844   initial_performance_count = as_long(count);
 845 }
 846 
 847 
 848 double os::elapsedTime() {
 849   return (double) elapsed_counter() / (double) elapsed_frequency();
 850 }
 851 
 852 
 853 // Windows format:


 894 jlong windows_to_java_time(FILETIME wt) {
 895   jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
 896   return (a - offset()) / 10000;
 897 }
 898 
 899 // Returns time ticks in (10th of micro seconds)
 900 jlong windows_to_time_ticks(FILETIME wt) {
 901   jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
 902   return (a - offset());
 903 }
 904 
 905 FILETIME java_to_windows_time(jlong l) {
 906   jlong a = (l * 10000) + offset();
 907   FILETIME result;
 908   result.dwHighDateTime = high(a);
 909   result.dwLowDateTime  = low(a);
 910   return result;
 911 }
 912 
 913 bool os::supports_vtime() { return true; }
 914 bool os::enable_vtime() { return false; }
 915 bool os::vtime_enabled() { return false; }
 916 
 917 double os::elapsedVTime() {
 918   FILETIME created;
 919   FILETIME exited;
 920   FILETIME kernel;
 921   FILETIME user;
 922   if (GetThreadTimes(GetCurrentThread(), &created, &exited, &kernel, &user) != 0) {
 923     // the resolution of windows_to_java_time() should be sufficient (ms)
 924     return (double) (windows_to_java_time(kernel) + windows_to_java_time(user)) / MILLIUNITS;
 925   } else {
 926     return elapsedTime();
 927   }
 928 }
 929 
 930 jlong os::javaTimeMillis() {
 931   FILETIME wt;
 932   GetSystemTimeAsFileTime(&wt);
 933   return windows_to_java_time(wt);
 934 }
 935 


3886   // - the process-exiting thread has raised the flag and left the critical section.
3887   if (what == EPT_THREAD) {
3888     _endthreadex((unsigned)exit_code);
3889   } else if (what == EPT_PROCESS) {
3890     ::exit(exit_code);
3891   } else {
3892     _exit(exit_code);
3893   }
3894 
3895   // Should not reach here
3896   return exit_code;
3897 }
3898 
3899 #undef EXIT_TIMEOUT
3900 
3901 void os::win32::setmode_streams() {
3902   _setmode(_fileno(stdin), _O_BINARY);
3903   _setmode(_fileno(stdout), _O_BINARY);
3904   _setmode(_fileno(stderr), _O_BINARY);
3905 }
3906 
3907 
3908 bool os::is_debugger_attached() {
3909   return IsDebuggerPresent() ? true : false;
3910 }
3911 
3912 
3913 void os::wait_for_keypress_at_exit(void) {
3914   if (PauseAtExit) {
3915     fprintf(stderr, "Press any key to continue...\n");
3916     fgetc(stdin);
3917   }
3918 }
3919 
3920 
3921 bool os::message_box(const char* title, const char* message) {
3922   int result = MessageBox(NULL, message, title,
3923                           MB_YESNO | MB_ICONERROR | MB_SYSTEMMODAL | MB_DEFAULT_DESKTOP_ONLY);
3924   return result == IDYES;
3925 }
3926 
3927 #ifndef PRODUCT
3928 #ifndef _WIN64
3929 // Helpers to check whether NX protection is enabled
3930 int nx_exception_filter(_EXCEPTION_POINTERS *pex) {
3931   if (pex->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&




 809   }
 810 
 811   const DWORD MS_VC_EXCEPTION = 0x406D1388;
 812   struct {
 813     DWORD dwType;     // must be 0x1000
 814     LPCSTR szName;    // pointer to name (in user addr space)
 815     DWORD dwThreadID; // thread ID (-1=caller thread)
 816     DWORD dwFlags;    // reserved for future use, must be zero
 817   } info;
 818 
 819   info.dwType = 0x1000;
 820   info.szName = name;
 821   info.dwThreadID = -1;
 822   info.dwFlags = 0;
 823 
 824   __try {
 825     RaiseException (MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
 826   } __except(EXCEPTION_EXECUTE_HANDLER) {}
 827 }
 828 





 829 bool os::bind_to_processor(uint processor_id) {
 830   // Not yet implemented.
 831   return false;
 832 }
 833 
 834 void os::win32::initialize_performance_counter() {
 835   LARGE_INTEGER count;
 836   QueryPerformanceFrequency(&count);
 837   performance_frequency = as_long(count);
 838   QueryPerformanceCounter(&count);
 839   initial_performance_count = as_long(count);
 840 }
 841 
 842 
 843 double os::elapsedTime() {
 844   return (double) elapsed_counter() / (double) elapsed_frequency();
 845 }
 846 
 847 
 848 // Windows format:


 889 jlong windows_to_java_time(FILETIME wt) {
 890   jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
 891   return (a - offset()) / 10000;
 892 }
 893 
 894 // Returns time ticks in (10th of micro seconds)
 895 jlong windows_to_time_ticks(FILETIME wt) {
 896   jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
 897   return (a - offset());
 898 }
 899 
 900 FILETIME java_to_windows_time(jlong l) {
 901   jlong a = (l * 10000) + offset();
 902   FILETIME result;
 903   result.dwHighDateTime = high(a);
 904   result.dwLowDateTime  = low(a);
 905   return result;
 906 }
 907 
 908 bool os::supports_vtime() { return true; }


 909 
 910 double os::elapsedVTime() {
 911   FILETIME created;
 912   FILETIME exited;
 913   FILETIME kernel;
 914   FILETIME user;
 915   if (GetThreadTimes(GetCurrentThread(), &created, &exited, &kernel, &user) != 0) {
 916     // the resolution of windows_to_java_time() should be sufficient (ms)
 917     return (double) (windows_to_java_time(kernel) + windows_to_java_time(user)) / MILLIUNITS;
 918   } else {
 919     return elapsedTime();
 920   }
 921 }
 922 
 923 jlong os::javaTimeMillis() {
 924   FILETIME wt;
 925   GetSystemTimeAsFileTime(&wt);
 926   return windows_to_java_time(wt);
 927 }
 928 


3879   // - the process-exiting thread has raised the flag and left the critical section.
3880   if (what == EPT_THREAD) {
3881     _endthreadex((unsigned)exit_code);
3882   } else if (what == EPT_PROCESS) {
3883     ::exit(exit_code);
3884   } else {
3885     _exit(exit_code);
3886   }
3887 
3888   // Should not reach here
3889   return exit_code;
3890 }
3891 
3892 #undef EXIT_TIMEOUT
3893 
3894 void os::win32::setmode_streams() {
3895   _setmode(_fileno(stdin), _O_BINARY);
3896   _setmode(_fileno(stdout), _O_BINARY);
3897   _setmode(_fileno(stderr), _O_BINARY);
3898 }






3899 
3900 void os::wait_for_keypress_at_exit(void) {
3901   if (PauseAtExit) {
3902     fprintf(stderr, "Press any key to continue...\n");
3903     fgetc(stdin);
3904   }
3905 }
3906 
3907 
3908 bool os::message_box(const char* title, const char* message) {
3909   int result = MessageBox(NULL, message, title,
3910                           MB_YESNO | MB_ICONERROR | MB_SYSTEMMODAL | MB_DEFAULT_DESKTOP_ONLY);
3911   return result == IDYES;
3912 }
3913 
3914 #ifndef PRODUCT
3915 #ifndef _WIN64
3916 // Helpers to check whether NX protection is enabled
3917 int nx_exception_filter(_EXCEPTION_POINTERS *pex) {
3918   if (pex->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION &&


< prev index next >