src/os/windows/vm/os_windows.hpp

Wed, 15 Dec 2010 07:11:31 -0800

author
sla
date
Wed, 15 Dec 2010 07:11:31 -0800
changeset 2369
aa6e219afbf1
parent 2314
f95d63e2154a
child 2520
63d374c54045
permissions
-rw-r--r--

7006354: Updates to Visual Studio project creation and development launcher
Summary: Updates to Visual Studio project creation and development launcher
Reviewed-by: stefank, coleenp

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1997, 2010, 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;
duke@435 41
duke@435 42 public:
duke@435 43 // Windows-specific interface:
duke@435 44 static void initialize_system_info();
duke@435 45 static void setmode_streams();
duke@435 46
duke@435 47 // Processor info as provided by NT
duke@435 48 static int processor_type() { return _processor_type; }
duke@435 49 // Processor level may not be accurate on non-NT systems
duke@435 50 static int processor_level() {
duke@435 51 assert(is_nt(), "use vm_version instead");
duke@435 52 return _processor_level;
duke@435 53 }
duke@435 54 static julong available_memory();
duke@435 55 static julong physical_memory() { return _physical_memory; }
duke@435 56
duke@435 57 public:
duke@435 58 // Generic interface:
duke@435 59
duke@435 60 // Trace number of created threads
duke@435 61 static intx _os_thread_limit;
duke@435 62 static volatile intx _os_thread_count;
duke@435 63
duke@435 64 // Tells whether the platform is NT or Windown95
duke@435 65 static bool is_nt() { return _is_nt; }
duke@435 66
jmasa@824 67 // Tells whether the platform is Windows 2003
jmasa@824 68 static bool is_windows_2003() { return _is_windows_2003; }
jmasa@824 69
duke@435 70 // Returns the byte size of a virtual memory page
duke@435 71 static int vm_page_size() { return _vm_page_size; }
duke@435 72
duke@435 73 // Returns the size in bytes of memory blocks which can be allocated.
duke@435 74 static int vm_allocation_granularity() { return _vm_allocation_granularity; }
duke@435 75
duke@435 76 // Read the headers for the executable that started the current process into
duke@435 77 // the structure passed in (see winnt.h).
duke@435 78 static void read_executable_headers(PIMAGE_NT_HEADERS);
duke@435 79
duke@435 80 // Default stack size for the current process.
duke@435 81 static size_t default_stack_size() { return _default_stack_size; }
duke@435 82
duke@435 83 #ifndef _WIN64
duke@435 84 // A wrapper to install a structured exception handler for fast JNI accesors.
duke@435 85 static address fast_jni_accessor_wrapper(BasicType);
duke@435 86 #endif
duke@435 87
duke@435 88 // filter function to ignore faults on serializations page
duke@435 89 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
duke@435 90 };
duke@435 91
duke@435 92 class PlatformEvent : public CHeapObj {
duke@435 93 private:
duke@435 94 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
duke@435 95 volatile int _Event ;
duke@435 96 HANDLE _ParkHandle ;
duke@435 97
duke@435 98 public: // TODO-FIXME: make dtor private
duke@435 99 ~PlatformEvent() { guarantee (0, "invariant") ; }
duke@435 100
duke@435 101 public:
duke@435 102 PlatformEvent() {
duke@435 103 _Event = 0 ;
duke@435 104 _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
duke@435 105 guarantee (_ParkHandle != NULL, "invariant") ;
duke@435 106 }
duke@435 107
duke@435 108 // Exercise caution using reset() and fired() - they may require MEMBARs
duke@435 109 void reset() { _Event = 0 ; }
duke@435 110 int fired() { return _Event; }
duke@435 111 void park () ;
duke@435 112 void unpark () ;
duke@435 113 int park (jlong millis) ;
duke@435 114 } ;
duke@435 115
duke@435 116
duke@435 117
duke@435 118 class PlatformParker : public CHeapObj {
duke@435 119 protected:
duke@435 120 HANDLE _ParkEvent ;
duke@435 121
duke@435 122 public:
duke@435 123 ~PlatformParker () { guarantee (0, "invariant") ; }
duke@435 124 PlatformParker () {
duke@435 125 _ParkEvent = CreateEvent (NULL, true, false, NULL) ;
duke@435 126 guarantee (_ParkEvent != NULL, "invariant") ;
duke@435 127 }
duke@435 128
duke@435 129 } ;
stefank@2314 130
stefank@2314 131 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP

mercurial