hotspot/src/os/windows/vm/os_windows.hpp

Print this page
rev 611 : Merge
   1 #ifdef USE_PRAGMA_IDENT_HDR
   2 #pragma ident "@(#)os_windows.hpp       1.55 07/05/05 17:04:46 JVM"
   3 #endif
   4 /*
   5  * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  
  26  */
  27 
  28 // Win32_OS defines the interface to windows operating systems
  29 
  30 class win32 {
  31 
  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 
  41  public:
  42   // Windows-specific interface:
  43   static void   initialize_system_info();
  44   static void   setmode_streams();  
  45 
  46   // Processor info as provided by NT
  47   static int processor_type()  { return _processor_type;  }
  48   // Processor level may not be accurate on non-NT systems
  49   static int processor_level() {
  50     assert(is_nt(), "use vm_version instead");
  51     return _processor_level;
  52   }
  53   static julong available_memory();
  54   static julong physical_memory() { return _physical_memory; }
  55 
  56  public:
  57   // Generic interface:
  58 
  59   // Trace number of created threads
  60   static          intx  _os_thread_limit;
  61   static volatile intx  _os_thread_count;
  62 
  63   // Tells whether the platform is NT or Windown95
  64   static bool is_nt() { return _is_nt; }
  65 



  66   // Returns the byte size of a virtual memory page
  67   static int vm_page_size() { return _vm_page_size; }
  68 
  69   // Returns the size in bytes of memory blocks which can be allocated.
  70   static int vm_allocation_granularity() { return _vm_allocation_granularity; }
  71 
  72   // Read the headers for the executable that started the current process into
  73   // the structure passed in (see winnt.h).
  74   static void read_executable_headers(PIMAGE_NT_HEADERS);
  75 
  76   // Default stack size for the current process.
  77   static size_t default_stack_size() { return _default_stack_size; }
  78 
  79 #ifndef _WIN64
  80   // A wrapper to install a structured exception handler for fast JNI accesors.
  81   static address fast_jni_accessor_wrapper(BasicType);
  82 #endif
  83 
  84   // filter function to ignore faults on serializations page
  85   static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);


 106     int  fired() { return _Event; }
 107     void park () ;
 108     void unpark () ;
 109     int  park (jlong millis) ;
 110 } ;
 111 
 112 
 113 
 114 class PlatformParker : public CHeapObj { 
 115   protected:
 116     HANDLE _ParkEvent ; 
 117 
 118   public:
 119     ~PlatformParker () { guarantee (0, "invariant") ; } 
 120     PlatformParker  () { 
 121       _ParkEvent = CreateEvent (NULL, true, false, NULL) ; 
 122       guarantee (_ParkEvent != NULL, "invariant") ; 
 123     }
 124 
 125 } ; 
 126 
 127 
 128 
 129 



   1 /*
   2  * Copyright 1997-2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  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;
  37   static bool   _is_windows_2003;
  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 
  64   // Tells whether the platform is Windows 2003
  65   static bool is_windows_2003() { return _is_windows_2003; }
  66 
  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);


 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 } ;