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

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/os/windows/vm/os_windows.inline.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,113 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
    1.29 +#define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
    1.30 +
    1.31 +#include "runtime/atomic.inline.hpp"
    1.32 +#include "runtime/os.hpp"
    1.33 +
    1.34 +#ifdef TARGET_OS_ARCH_windows_x86
    1.35 +# include "orderAccess_windows_x86.inline.hpp"
    1.36 +#endif
    1.37 +
    1.38 +inline const char* os::file_separator()                { return "\\"; }
    1.39 +inline const char* os::line_separator()                { return "\r\n"; }
    1.40 +inline const char* os::path_separator()                { return ";"; }
    1.41 +inline const char* os::dll_file_extension()            { return ".dll"; }
    1.42 +
    1.43 +inline const int os::default_file_open_flags() { return O_BINARY | O_NOINHERIT;}
    1.44 +
    1.45 +// File names are case-insensitive on windows only
    1.46 +inline int os::file_name_strcmp(const char* s, const char* t) {
    1.47 +  return _stricmp(s, t);
    1.48 +}
    1.49 +
    1.50 +inline void  os::dll_unload(void *lib) {
    1.51 +  ::FreeLibrary((HMODULE)lib);
    1.52 +}
    1.53 +
    1.54 +inline void* os::dll_lookup(void *lib, const char *name) {
    1.55 +  return (void*)::GetProcAddress((HMODULE)lib, name);
    1.56 +}
    1.57 +
    1.58 +// Used to improve time-sharing on some systems
    1.59 +inline void os::loop_breaker(int attempts) {}
    1.60 +
    1.61 +inline bool os::obsolete_option(const JavaVMOption *option) {
    1.62 +  return false;
    1.63 +}
    1.64 +
    1.65 +inline bool os::uses_stack_guard_pages() {
    1.66 +  return os::win32::is_nt();
    1.67 +}
    1.68 +
    1.69 +inline bool os::allocate_stack_guard_pages() {
    1.70 +  assert(uses_stack_guard_pages(), "sanity check");
    1.71 +  return true;
    1.72 +}
    1.73 +
    1.74 +inline int os::readdir_buf_size(const char *path)
    1.75 +{
    1.76 +  /* As Windows doesn't use the directory entry buffer passed to
    1.77 +     os::readdir() this can be as short as possible */
    1.78 +
    1.79 +  return 1;
    1.80 +}
    1.81 +
    1.82 +// Bang the shadow pages if they need to be touched to be mapped.
    1.83 +inline void os::bang_stack_shadow_pages() {
    1.84 +  // Write to each page of our new frame to force OS mapping.
    1.85 +  // If we decrement stack pointer more than one page
    1.86 +  // the OS may not map an intervening page into our space
    1.87 +  // and may fault on a memory access to interior of our frame.
    1.88 +  address sp = current_stack_pointer();
    1.89 +  for (int pages = 1; pages <= StackShadowPages; pages++) {
    1.90 +    *((int *)(sp - (pages * vm_page_size()))) = 0;
    1.91 +  }
    1.92 +}
    1.93 +
    1.94 +inline bool os::numa_has_static_binding()   { return true;   }
    1.95 +inline bool os::numa_has_group_homing()     { return false;  }
    1.96 +
    1.97 +inline size_t os::read(int fd, void *buf, unsigned int nBytes) {
    1.98 +  return ::read(fd, buf, nBytes);
    1.99 +}
   1.100 +
   1.101 +inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
   1.102 +  return ::read(fd, buf, nBytes);
   1.103 +}
   1.104 +
   1.105 +inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
   1.106 +  return ::write(fd, buf, nBytes);
   1.107 +}
   1.108 +
   1.109 +inline int os::close(int fd) {
   1.110 +  return ::close(fd);
   1.111 +}
   1.112 +
   1.113 +#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \
   1.114 +        os::win32::call_test_func_with_wrapper(f)
   1.115 +
   1.116 +#endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP

mercurial