Mercurial > hg > graal-compiler
annotate src/os/windows/vm/os_windows.hpp @ 2828:d6f3dbb4e3b5
merge
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 30 May 2011 18:47:33 +0200 |
parents | 63d374c54045 |
children | 5def270bc147 |
rev | line source |
---|---|
0 | 1 /* |
2204
63d374c54045
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
1972
diff
changeset
|
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
470
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
470
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
470
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP |
26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP | |
27 | |
0 | 28 // Win32_OS defines the interface to windows operating systems |
29 | |
30 class win32 { | |
31 | |
32 protected: | |
33 static int _vm_page_size; | |
34 static int _vm_allocation_granularity; | |
35 static int _processor_type; | |
36 static int _processor_level; | |
37 static julong _physical_memory; | |
38 static size_t _default_stack_size; | |
39 static bool _is_nt; | |
389
ee21eaa8ffe1
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
0
diff
changeset
|
40 static bool _is_windows_2003; |
2204
63d374c54045
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
1972
diff
changeset
|
41 static bool _is_windows_server; |
0 | 42 |
43 public: | |
44 // Windows-specific interface: | |
45 static void initialize_system_info(); | |
46 static void setmode_streams(); | |
47 | |
48 // Processor info as provided by NT | |
49 static int processor_type() { return _processor_type; } | |
50 // Processor level may not be accurate on non-NT systems | |
51 static int processor_level() { | |
52 assert(is_nt(), "use vm_version instead"); | |
53 return _processor_level; | |
54 } | |
55 static julong available_memory(); | |
56 static julong physical_memory() { return _physical_memory; } | |
57 | |
58 public: | |
59 // Generic interface: | |
60 | |
61 // Trace number of created threads | |
62 static intx _os_thread_limit; | |
63 static volatile intx _os_thread_count; | |
64 | |
65 // Tells whether the platform is NT or Windown95 | |
66 static bool is_nt() { return _is_nt; } | |
67 | |
2204
63d374c54045
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
1972
diff
changeset
|
68 // Tells whether this is a server version of Windows |
63d374c54045
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
1972
diff
changeset
|
69 static bool is_windows_server() { return _is_windows_server; } |
63d374c54045
7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
1972
diff
changeset
|
70 |
389
ee21eaa8ffe1
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
0
diff
changeset
|
71 // Tells whether the platform is Windows 2003 |
ee21eaa8ffe1
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
0
diff
changeset
|
72 static bool is_windows_2003() { return _is_windows_2003; } |
ee21eaa8ffe1
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
0
diff
changeset
|
73 |
0 | 74 // Returns the byte size of a virtual memory page |
75 static int vm_page_size() { return _vm_page_size; } | |
76 | |
77 // Returns the size in bytes of memory blocks which can be allocated. | |
78 static int vm_allocation_granularity() { return _vm_allocation_granularity; } | |
79 | |
80 // Read the headers for the executable that started the current process into | |
81 // the structure passed in (see winnt.h). | |
82 static void read_executable_headers(PIMAGE_NT_HEADERS); | |
83 | |
84 // Default stack size for the current process. | |
85 static size_t default_stack_size() { return _default_stack_size; } | |
86 | |
87 #ifndef _WIN64 | |
88 // A wrapper to install a structured exception handler for fast JNI accesors. | |
89 static address fast_jni_accessor_wrapper(BasicType); | |
90 #endif | |
91 | |
92 // filter function to ignore faults on serializations page | |
93 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); | |
94 }; | |
95 | |
96 class PlatformEvent : public CHeapObj { | |
97 private: | |
98 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line | |
99 volatile int _Event ; | |
100 HANDLE _ParkHandle ; | |
101 | |
102 public: // TODO-FIXME: make dtor private | |
103 ~PlatformEvent() { guarantee (0, "invariant") ; } | |
104 | |
105 public: | |
106 PlatformEvent() { | |
107 _Event = 0 ; | |
108 _ParkHandle = CreateEvent (NULL, false, false, NULL) ; | |
109 guarantee (_ParkHandle != NULL, "invariant") ; | |
110 } | |
111 | |
112 // Exercise caution using reset() and fired() - they may require MEMBARs | |
113 void reset() { _Event = 0 ; } | |
114 int fired() { return _Event; } | |
115 void park () ; | |
116 void unpark () ; | |
117 int park (jlong millis) ; | |
118 } ; | |
119 | |
120 | |
121 | |
122 class PlatformParker : public CHeapObj { | |
123 protected: | |
124 HANDLE _ParkEvent ; | |
125 | |
126 public: | |
127 ~PlatformParker () { guarantee (0, "invariant") ; } | |
128 PlatformParker () { | |
129 _ParkEvent = CreateEvent (NULL, true, false, NULL) ; | |
130 guarantee (_ParkEvent != NULL, "invariant") ; | |
131 } | |
132 | |
133 } ; | |
1972 | 134 |
135 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP |