src/os/windows/vm/os_windows.hpp

Wed, 09 Feb 2011 11:08:10 +0100

author
ctornqvi
date
Wed, 09 Feb 2011 11:08:10 +0100
changeset 2520
63d374c54045
parent 2314
f95d63e2154a
child 3031
b1cbb0907b36
permissions
-rw-r--r--

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

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

mercurial