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

     1 /*
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     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  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
    26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP
    28 // Win32_OS defines the interface to windows operating systems
    30 class win32 {
    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;
    40   static bool   _is_windows_2003;
    41   static bool   _is_windows_server;
    43  public:
    44   // Windows-specific interface:
    45   static void   initialize_system_info();
    46   static void   setmode_streams();
    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; }
    58  public:
    59   // Generic interface:
    61   // Trace number of created threads
    62   static          intx  _os_thread_limit;
    63   static volatile intx  _os_thread_count;
    65   // Tells whether the platform is NT or Windown95
    66   static bool is_nt() { return _is_nt; }
    68   // Tells whether this is a server version of Windows
    69   static bool is_windows_server() { return _is_windows_server; }
    71   // Tells whether the platform is Windows 2003
    72   static bool is_windows_2003() { return _is_windows_2003; }
    74   // Returns the byte size of a virtual memory page
    75   static int vm_page_size() { return _vm_page_size; }
    77   // Returns the size in bytes of memory blocks which can be allocated.
    78   static int vm_allocation_granularity() { return _vm_allocation_granularity; }
    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);
    84   // Default stack size for the current process.
    85   static size_t default_stack_size() { return _default_stack_size; }
    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
    92   // filter function to ignore faults on serializations page
    93   static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
    94 };
    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 ;
   102   public:       // TODO-FIXME: make dtor private
   103     ~PlatformEvent() { guarantee (0, "invariant") ; }
   105   public:
   106     PlatformEvent() {
   107       _Event   = 0 ;
   108       _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
   109       guarantee (_ParkHandle != NULL, "invariant") ;
   110     }
   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 } ;
   122 class PlatformParker : public CHeapObj {
   123   protected:
   124     HANDLE _ParkEvent ;
   126   public:
   127     ~PlatformParker () { guarantee (0, "invariant") ; }
   128     PlatformParker  () {
   129       _ParkEvent = CreateEvent (NULL, true, false, NULL) ;
   130       guarantee (_ParkEvent != NULL, "invariant") ;
   131     }
   133 } ;
   135 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP

mercurial