43 static int _vm_allocation_granularity; |
43 static int _vm_allocation_granularity; |
44 static int _processor_type; |
44 static int _processor_type; |
45 static int _processor_level; |
45 static int _processor_level; |
46 static julong _physical_memory; |
46 static julong _physical_memory; |
47 static size_t _default_stack_size; |
47 static size_t _default_stack_size; |
48 static bool _is_nt; |
|
49 static bool _is_windows_2003; |
|
50 static bool _is_windows_server; |
48 static bool _is_windows_server; |
51 static bool _has_exit_bug; |
49 static bool _has_exit_bug; |
52 static bool _has_performance_count; |
|
53 |
50 |
54 static void print_windows_version(outputStream* st); |
51 static void print_windows_version(outputStream* st); |
55 |
52 |
56 public: |
53 public: |
57 // Windows-specific interface: |
54 // Windows-specific interface: |
58 static void initialize_system_info(); |
55 static void initialize_system_info(); |
59 static void setmode_streams(); |
56 static void setmode_streams(); |
60 |
57 |
61 // Processor info as provided by NT |
58 // Processor info as provided by NT |
62 static int processor_type() { return _processor_type; } |
59 static int processor_type() { return _processor_type; } |
63 // Processor level may not be accurate on non-NT systems |
|
64 static int processor_level() { |
60 static int processor_level() { |
65 assert(is_nt(), "use vm_version instead"); |
|
66 return _processor_level; |
61 return _processor_level; |
67 } |
62 } |
68 static julong available_memory(); |
63 static julong available_memory(); |
69 static julong physical_memory() { return _physical_memory; } |
64 static julong physical_memory() { return _physical_memory; } |
70 |
65 |
83 |
78 |
84 // Trace number of created threads |
79 // Trace number of created threads |
85 static intx _os_thread_limit; |
80 static intx _os_thread_limit; |
86 static volatile intx _os_thread_count; |
81 static volatile intx _os_thread_count; |
87 |
82 |
88 // Tells whether the platform is NT or Windown95 |
|
89 static bool is_nt() { return _is_nt; } |
|
90 |
|
91 // Tells whether this is a server version of Windows |
83 // Tells whether this is a server version of Windows |
92 static bool is_windows_server() { return _is_windows_server; } |
84 static bool is_windows_server() { return _is_windows_server; } |
93 |
|
94 // Tells whether the platform is Windows 2003 |
|
95 static bool is_windows_2003() { return _is_windows_2003; } |
|
96 |
85 |
97 // Tells whether there can be the race bug during process exit on this platform |
86 // Tells whether there can be the race bug during process exit on this platform |
98 static bool has_exit_bug() { return _has_exit_bug; } |
87 static bool has_exit_bug() { return _has_exit_bug; } |
99 |
88 |
100 // Returns the byte size of a virtual memory page |
89 // Returns the byte size of a virtual memory page |
185 guarantee (_ParkEvent != NULL, "invariant") ; |
174 guarantee (_ParkEvent != NULL, "invariant") ; |
186 } |
175 } |
187 |
176 |
188 } ; |
177 } ; |
189 |
178 |
190 class WinSock2Dll: AllStatic { |
|
191 public: |
|
192 static BOOL WSAStartup(WORD, LPWSADATA); |
|
193 static struct hostent* gethostbyname(const char *name); |
|
194 static BOOL WinSock2Available(); |
|
195 }; |
|
196 |
|
197 class Kernel32Dll: AllStatic { |
|
198 public: |
|
199 static BOOL SwitchToThread(); |
|
200 static SIZE_T GetLargePageMinimum(); |
|
201 |
|
202 static BOOL SwitchToThreadAvailable(); |
|
203 static BOOL GetLargePageMinimumAvailable(); |
|
204 |
|
205 // Help tools |
|
206 static BOOL HelpToolsAvailable(); |
|
207 static HANDLE CreateToolhelp32Snapshot(DWORD,DWORD); |
|
208 static BOOL Module32First(HANDLE,LPMODULEENTRY32); |
|
209 static BOOL Module32Next(HANDLE,LPMODULEENTRY32); |
|
210 |
|
211 static void GetNativeSystemInfo(LPSYSTEM_INFO); |
|
212 |
|
213 // NUMA calls |
|
214 static BOOL NumaCallsAvailable(); |
|
215 static LPVOID VirtualAllocExNuma(HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD); |
|
216 static BOOL GetNumaHighestNodeNumber(PULONG); |
|
217 static BOOL GetNumaNodeProcessorMask(UCHAR, PULONGLONG); |
|
218 |
|
219 // Stack walking |
|
220 static USHORT RtlCaptureStackBackTrace(ULONG, ULONG, PVOID*, PULONG); |
|
221 |
|
222 private: |
|
223 // GetLargePageMinimum available on Windows Vista/Windows Server 2003 |
|
224 // and later |
|
225 // NUMA calls available Windows Vista/WS2008 and later |
|
226 |
|
227 static SIZE_T (WINAPI *_GetLargePageMinimum)(void); |
|
228 static LPVOID (WINAPI *_VirtualAllocExNuma) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD); |
|
229 static BOOL (WINAPI *_GetNumaHighestNodeNumber) (PULONG); |
|
230 static BOOL (WINAPI *_GetNumaNodeProcessorMask) (UCHAR, PULONGLONG); |
|
231 static USHORT (WINAPI *_RtlCaptureStackBackTrace)(ULONG, ULONG, PVOID*, PULONG); |
|
232 static BOOL initialized; |
|
233 |
|
234 static void initialize(); |
|
235 static void initializeCommon(); |
|
236 }; |
|
237 |
|
238 class Advapi32Dll: AllStatic { |
|
239 public: |
|
240 static BOOL AdjustTokenPrivileges(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); |
|
241 static BOOL OpenProcessToken(HANDLE, DWORD, PHANDLE); |
|
242 static BOOL LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID); |
|
243 |
|
244 static BOOL AdvapiAvailable(); |
|
245 }; |
|
246 |
|
247 class PSApiDll: AllStatic { |
|
248 public: |
|
249 static BOOL EnumProcessModules(HANDLE, HMODULE *, DWORD, LPDWORD); |
|
250 static DWORD GetModuleFileNameEx(HANDLE, HMODULE, LPTSTR, DWORD); |
|
251 static BOOL GetModuleInformation(HANDLE, HMODULE, LPMODULEINFO, DWORD); |
|
252 |
|
253 static BOOL PSApiAvailable(); |
|
254 }; |
|
255 |
|
256 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP |
179 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP |