author | trims |
Thu, 27 May 2010 19:08:38 -0700 | |
changeset 5547 | f4b087cbb361 |
parent 1623 | a0dd9009e992 |
child 7397 | 5b173b4ca846 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
2 |
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1623
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
// Win32_OS defines the interface to windows operating systems |
|
26 |
||
27 |
class win32 { |
|
28 |
||
29 |
protected: |
|
30 |
static int _vm_page_size; |
|
31 |
static int _vm_allocation_granularity; |
|
32 |
static int _processor_type; |
|
33 |
static int _processor_level; |
|
34 |
static julong _physical_memory; |
|
35 |
static size_t _default_stack_size; |
|
36 |
static bool _is_nt; |
|
1421
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
37 |
static bool _is_windows_2003; |
1 | 38 |
|
39 |
public: |
|
40 |
// Windows-specific interface: |
|
41 |
static void initialize_system_info(); |
|
42 |
static void setmode_streams(); |
|
43 |
||
44 |
// Processor info as provided by NT |
|
45 |
static int processor_type() { return _processor_type; } |
|
46 |
// Processor level may not be accurate on non-NT systems |
|
47 |
static int processor_level() { |
|
48 |
assert(is_nt(), "use vm_version instead"); |
|
49 |
return _processor_level; |
|
50 |
} |
|
51 |
static julong available_memory(); |
|
52 |
static julong physical_memory() { return _physical_memory; } |
|
53 |
||
54 |
public: |
|
55 |
// Generic interface: |
|
56 |
||
57 |
// Trace number of created threads |
|
58 |
static intx _os_thread_limit; |
|
59 |
static volatile intx _os_thread_count; |
|
60 |
||
61 |
// Tells whether the platform is NT or Windown95 |
|
62 |
static bool is_nt() { return _is_nt; } |
|
63 |
||
1421
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
64 |
// Tells whether the platform is Windows 2003 |
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
65 |
static bool is_windows_2003() { return _is_windows_2003; } |
a7ef1a3b2644
6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents:
1
diff
changeset
|
66 |
|
1 | 67 |
// Returns the byte size of a virtual memory page |
68 |
static int vm_page_size() { return _vm_page_size; } |
|
69 |
||
70 |
// Returns the size in bytes of memory blocks which can be allocated. |
|
71 |
static int vm_allocation_granularity() { return _vm_allocation_granularity; } |
|
72 |
||
73 |
// Read the headers for the executable that started the current process into |
|
74 |
// the structure passed in (see winnt.h). |
|
75 |
static void read_executable_headers(PIMAGE_NT_HEADERS); |
|
76 |
||
77 |
// Default stack size for the current process. |
|
78 |
static size_t default_stack_size() { return _default_stack_size; } |
|
79 |
||
80 |
#ifndef _WIN64 |
|
81 |
// A wrapper to install a structured exception handler for fast JNI accesors. |
|
82 |
static address fast_jni_accessor_wrapper(BasicType); |
|
83 |
#endif |
|
84 |
||
85 |
// filter function to ignore faults on serializations page |
|
86 |
static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); |
|
87 |
}; |
|
88 |
||
89 |
class PlatformEvent : public CHeapObj { |
|
90 |
private: |
|
91 |
double CachePad [4] ; // increase odds that _Event is sole occupant of cache line |
|
92 |
volatile int _Event ; |
|
93 |
HANDLE _ParkHandle ; |
|
94 |
||
95 |
public: // TODO-FIXME: make dtor private |
|
96 |
~PlatformEvent() { guarantee (0, "invariant") ; } |
|
97 |
||
98 |
public: |
|
99 |
PlatformEvent() { |
|
100 |
_Event = 0 ; |
|
101 |
_ParkHandle = CreateEvent (NULL, false, false, NULL) ; |
|
102 |
guarantee (_ParkHandle != NULL, "invariant") ; |
|
103 |
} |
|
104 |
||
105 |
// Exercise caution using reset() and fired() - they may require MEMBARs |
|
106 |
void reset() { _Event = 0 ; } |
|
107 |
int fired() { return _Event; } |
|
108 |
void park () ; |
|
109 |
void unpark () ; |
|
110 |
int park (jlong millis) ; |
|
111 |
} ; |
|
112 |
||
113 |
||
114 |
||
115 |
class PlatformParker : public CHeapObj { |
|
116 |
protected: |
|
117 |
HANDLE _ParkEvent ; |
|
118 |
||
119 |
public: |
|
120 |
~PlatformParker () { guarantee (0, "invariant") ; } |
|
121 |
PlatformParker () { |
|
122 |
_ParkEvent = CreateEvent (NULL, true, false, NULL) ; |
|
123 |
guarantee (_ParkEvent != NULL, "invariant") ; |
|
124 |
} |
|
125 |
||
126 |
} ; |