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

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
aoqi@0 26 #define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
aoqi@0 27
aoqi@0 28 #include "runtime/atomic.inline.hpp"
aoqi@0 29 #include "runtime/os.hpp"
aoqi@0 30
aoqi@0 31 #ifdef TARGET_OS_ARCH_windows_x86
aoqi@0 32 # include "orderAccess_windows_x86.inline.hpp"
aoqi@0 33 #endif
aoqi@0 34
aoqi@0 35 inline const char* os::file_separator() { return "\\"; }
aoqi@0 36 inline const char* os::line_separator() { return "\r\n"; }
aoqi@0 37 inline const char* os::path_separator() { return ";"; }
aoqi@0 38 inline const char* os::dll_file_extension() { return ".dll"; }
aoqi@0 39
aoqi@0 40 inline const int os::default_file_open_flags() { return O_BINARY | O_NOINHERIT;}
aoqi@0 41
aoqi@0 42 // File names are case-insensitive on windows only
aoqi@0 43 inline int os::file_name_strcmp(const char* s, const char* t) {
aoqi@0 44 return _stricmp(s, t);
aoqi@0 45 }
aoqi@0 46
aoqi@0 47 inline void os::dll_unload(void *lib) {
aoqi@0 48 ::FreeLibrary((HMODULE)lib);
aoqi@0 49 }
aoqi@0 50
aoqi@0 51 inline void* os::dll_lookup(void *lib, const char *name) {
aoqi@0 52 return (void*)::GetProcAddress((HMODULE)lib, name);
aoqi@0 53 }
aoqi@0 54
aoqi@0 55 // Used to improve time-sharing on some systems
aoqi@0 56 inline void os::loop_breaker(int attempts) {}
aoqi@0 57
aoqi@0 58 inline bool os::obsolete_option(const JavaVMOption *option) {
aoqi@0 59 return false;
aoqi@0 60 }
aoqi@0 61
aoqi@0 62 inline bool os::uses_stack_guard_pages() {
aoqi@0 63 return os::win32::is_nt();
aoqi@0 64 }
aoqi@0 65
aoqi@0 66 inline bool os::allocate_stack_guard_pages() {
aoqi@0 67 assert(uses_stack_guard_pages(), "sanity check");
aoqi@0 68 return true;
aoqi@0 69 }
aoqi@0 70
aoqi@0 71 inline int os::readdir_buf_size(const char *path)
aoqi@0 72 {
aoqi@0 73 /* As Windows doesn't use the directory entry buffer passed to
aoqi@0 74 os::readdir() this can be as short as possible */
aoqi@0 75
aoqi@0 76 return 1;
aoqi@0 77 }
aoqi@0 78
aoqi@0 79 // Bang the shadow pages if they need to be touched to be mapped.
aoqi@0 80 inline void os::bang_stack_shadow_pages() {
aoqi@0 81 // Write to each page of our new frame to force OS mapping.
aoqi@0 82 // If we decrement stack pointer more than one page
aoqi@0 83 // the OS may not map an intervening page into our space
aoqi@0 84 // and may fault on a memory access to interior of our frame.
aoqi@0 85 address sp = current_stack_pointer();
aoqi@0 86 for (int pages = 1; pages <= StackShadowPages; pages++) {
aoqi@0 87 *((int *)(sp - (pages * vm_page_size()))) = 0;
aoqi@0 88 }
aoqi@0 89 }
aoqi@0 90
aoqi@0 91 inline bool os::numa_has_static_binding() { return true; }
aoqi@0 92 inline bool os::numa_has_group_homing() { return false; }
aoqi@0 93
aoqi@0 94 inline size_t os::read(int fd, void *buf, unsigned int nBytes) {
aoqi@0 95 return ::read(fd, buf, nBytes);
aoqi@0 96 }
aoqi@0 97
aoqi@0 98 inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
aoqi@0 99 return ::read(fd, buf, nBytes);
aoqi@0 100 }
aoqi@0 101
aoqi@0 102 inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
aoqi@0 103 return ::write(fd, buf, nBytes);
aoqi@0 104 }
aoqi@0 105
aoqi@0 106 inline int os::close(int fd) {
aoqi@0 107 return ::close(fd);
aoqi@0 108 }
aoqi@0 109
aoqi@0 110 #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \
aoqi@0 111 os::win32::call_test_func_with_wrapper(f)
aoqi@0 112
aoqi@0 113 #endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP

mercurial