os_windows.hpp revision 1879
0N/A/*
1879N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
1879N/A#define OS_WINDOWS_VM_OS_WINDOWS_HPP
1879N/A
0N/A// Win32_OS defines the interface to windows operating systems
0N/A
0N/Aclass win32 {
0N/A
0N/A protected:
0N/A static int _vm_page_size;
0N/A static int _vm_allocation_granularity;
0N/A static int _processor_type;
0N/A static int _processor_level;
0N/A static julong _physical_memory;
0N/A static size_t _default_stack_size;
0N/A static bool _is_nt;
389N/A static bool _is_windows_2003;
0N/A
0N/A public:
0N/A // Windows-specific interface:
0N/A static void initialize_system_info();
0N/A static void setmode_streams();
0N/A
0N/A // Processor info as provided by NT
0N/A static int processor_type() { return _processor_type; }
0N/A // Processor level may not be accurate on non-NT systems
0N/A static int processor_level() {
0N/A assert(is_nt(), "use vm_version instead");
0N/A return _processor_level;
0N/A }
0N/A static julong available_memory();
0N/A static julong physical_memory() { return _physical_memory; }
0N/A
0N/A public:
0N/A // Generic interface:
0N/A
0N/A // Trace number of created threads
0N/A static intx _os_thread_limit;
0N/A static volatile intx _os_thread_count;
0N/A
0N/A // Tells whether the platform is NT or Windown95
0N/A static bool is_nt() { return _is_nt; }
0N/A
389N/A // Tells whether the platform is Windows 2003
389N/A static bool is_windows_2003() { return _is_windows_2003; }
389N/A
0N/A // Returns the byte size of a virtual memory page
0N/A static int vm_page_size() { return _vm_page_size; }
0N/A
0N/A // Returns the size in bytes of memory blocks which can be allocated.
0N/A static int vm_allocation_granularity() { return _vm_allocation_granularity; }
0N/A
0N/A // Read the headers for the executable that started the current process into
0N/A // the structure passed in (see winnt.h).
0N/A static void read_executable_headers(PIMAGE_NT_HEADERS);
0N/A
0N/A // Default stack size for the current process.
0N/A static size_t default_stack_size() { return _default_stack_size; }
0N/A
0N/A#ifndef _WIN64
0N/A // A wrapper to install a structured exception handler for fast JNI accesors.
0N/A static address fast_jni_accessor_wrapper(BasicType);
0N/A#endif
0N/A
0N/A // filter function to ignore faults on serializations page
0N/A static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
0N/A};
0N/A
0N/Aclass PlatformEvent : public CHeapObj {
0N/A private:
0N/A double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
0N/A volatile int _Event ;
0N/A HANDLE _ParkHandle ;
0N/A
0N/A public: // TODO-FIXME: make dtor private
0N/A ~PlatformEvent() { guarantee (0, "invariant") ; }
0N/A
0N/A public:
0N/A PlatformEvent() {
0N/A _Event = 0 ;
0N/A _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
0N/A guarantee (_ParkHandle != NULL, "invariant") ;
0N/A }
0N/A
0N/A // Exercise caution using reset() and fired() - they may require MEMBARs
0N/A void reset() { _Event = 0 ; }
0N/A int fired() { return _Event; }
0N/A void park () ;
0N/A void unpark () ;
0N/A int park (jlong millis) ;
0N/A} ;
0N/A
0N/A
0N/A
0N/Aclass PlatformParker : public CHeapObj {
0N/A protected:
0N/A HANDLE _ParkEvent ;
0N/A
0N/A public:
0N/A ~PlatformParker () { guarantee (0, "invariant") ; }
0N/A PlatformParker () {
0N/A _ParkEvent = CreateEvent (NULL, true, false, NULL) ;
0N/A guarantee (_ParkEvent != NULL, "invariant") ;
0N/A }
0N/A
0N/A} ;
1879N/A
1879N/A#endif // OS_WINDOWS_VM_OS_WINDOWS_HPP