annotate src/os/windows/vm/os_windows.hpp @ 2204:63d374c54045

7014918: Improve core/minidump handling in Hotspot Summary: Added Minidump support on Windows, enabled large page core dumps when coredump_filter is present and writing out path/rlimit for core dumps. Reviewed-by: poonam, dsamersoff, sla, coleenp
author ctornqvi
date Wed, 09 Feb 2011 11:08:10 +0100
parents f95d63e2154a
children 5def270bc147
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Win32_OS defines the interface to windows operating systems
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class win32 {
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
33 static int _vm_page_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 static int _vm_allocation_granularity;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 static int _processor_type;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 static int _processor_level;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 static julong _physical_memory;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 static size_t _default_stack_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // Windows-specific interface:
a61af66fc99e Initial load
duke
parents:
diff changeset
45 static void initialize_system_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
46 static void setmode_streams();
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // Processor info as provided by NT
a61af66fc99e Initial load
duke
parents:
diff changeset
49 static int processor_type() { return _processor_type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // Processor level may not be accurate on non-NT systems
a61af66fc99e Initial load
duke
parents:
diff changeset
51 static int processor_level() {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 assert(is_nt(), "use vm_version instead");
a61af66fc99e Initial load
duke
parents:
diff changeset
53 return _processor_level;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55 static julong available_memory();
a61af66fc99e Initial load
duke
parents:
diff changeset
56 static julong physical_memory() { return _physical_memory; }
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // Generic interface:
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // Trace number of created threads
a61af66fc99e Initial load
duke
parents:
diff changeset
62 static intx _os_thread_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 static volatile intx _os_thread_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Tells whether the platform is NT or Windown95
a61af66fc99e Initial load
duke
parents:
diff changeset
66 static bool is_nt() { return _is_nt; }
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Returns the byte size of a virtual memory page
a61af66fc99e Initial load
duke
parents:
diff changeset
75 static int vm_page_size() { return _vm_page_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // Returns the size in bytes of memory blocks which can be allocated.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 static int vm_allocation_granularity() { return _vm_allocation_granularity; }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Read the headers for the executable that started the current process into
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // the structure passed in (see winnt.h).
a61af66fc99e Initial load
duke
parents:
diff changeset
82 static void read_executable_headers(PIMAGE_NT_HEADERS);
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // Default stack size for the current process.
a61af66fc99e Initial load
duke
parents:
diff changeset
85 static size_t default_stack_size() { return _default_stack_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 #ifndef _WIN64
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // A wrapper to install a structured exception handler for fast JNI accesors.
a61af66fc99e Initial load
duke
parents:
diff changeset
89 static address fast_jni_accessor_wrapper(BasicType);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // filter function to ignore faults on serializations page
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 };
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 class PlatformEvent : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
98 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
a61af66fc99e Initial load
duke
parents:
diff changeset
99 volatile int _Event ;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 HANDLE _ParkHandle ;
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 public: // TODO-FIXME: make dtor private
a61af66fc99e Initial load
duke
parents:
diff changeset
103 ~PlatformEvent() { guarantee (0, "invariant") ; }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
106 PlatformEvent() {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 _Event = 0 ;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
109 guarantee (_ParkHandle != NULL, "invariant") ;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // Exercise caution using reset() and fired() - they may require MEMBARs
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void reset() { _Event = 0 ; }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 int fired() { return _Event; }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void park () ;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 void unpark () ;
a61af66fc99e Initial load
duke
parents:
diff changeset
117 int park (jlong millis) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
118 } ;
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 class PlatformParker : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
124 HANDLE _ParkEvent ;
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
127 ~PlatformParker () { guarantee (0, "invariant") ; }
a61af66fc99e Initial load
duke
parents:
diff changeset
128 PlatformParker () {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 _ParkEvent = CreateEvent (NULL, true, false, NULL) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
130 guarantee (_ParkEvent != NULL, "invariant") ;
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 } ;
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
134
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
135 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP