src/os/solaris/vm/os_solaris.inline.hpp

Tue, 23 Nov 2010 13:22:55 -0800

author
stefank
date
Tue, 23 Nov 2010 13:22:55 -0800
changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
child 2322
828eafbd85cc
permissions
-rw-r--r--

6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
stefank@2314 26 #define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
stefank@2314 27
stefank@2314 28 #include "runtime/atomic.hpp"
stefank@2314 29 #include "runtime/os.hpp"
stefank@2314 30 #ifdef TARGET_OS_ARCH_solaris_x86
stefank@2314 31 # include "atomic_solaris_x86.inline.hpp"
stefank@2314 32 # include "orderAccess_solaris_x86.inline.hpp"
stefank@2314 33 #endif
stefank@2314 34 #ifdef TARGET_OS_ARCH_solaris_sparc
stefank@2314 35 # include "atomic_solaris_sparc.inline.hpp"
stefank@2314 36 # include "orderAccess_solaris_sparc.inline.hpp"
stefank@2314 37 #endif
stefank@2314 38
duke@435 39 inline const char* os::file_separator() { return "/"; }
duke@435 40 inline const char* os::line_separator() { return "\n"; }
duke@435 41 inline const char* os::path_separator() { return ":"; }
duke@435 42
duke@435 43 inline const char* os::jlong_format_specifier() { return "%lld"; }
duke@435 44 inline const char* os::julong_format_specifier() { return "%llu"; }
duke@435 45
duke@435 46 // File names are case-sensitive on windows only
duke@435 47 inline int os::file_name_strcmp(const char* s1, const char* s2) {
duke@435 48 return strcmp(s1, s2);
duke@435 49 }
duke@435 50
duke@435 51 inline bool os::uses_stack_guard_pages() {
duke@435 52 return true;
duke@435 53 }
duke@435 54
duke@435 55 inline bool os::allocate_stack_guard_pages() {
duke@435 56 assert(uses_stack_guard_pages(), "sanity check");
duke@435 57 int r = thr_main() ;
duke@435 58 guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
duke@435 59 return r;
duke@435 60 }
duke@435 61
duke@435 62
duke@435 63 // On Solaris, reservations are made on a page by page basis, nothing to do.
duke@435 64 inline void os::split_reserved_memory(char *base, size_t size,
duke@435 65 size_t split, bool realloc) {
duke@435 66 }
duke@435 67
duke@435 68
duke@435 69 // Bang the shadow pages if they need to be touched to be mapped.
duke@435 70 inline void os::bang_stack_shadow_pages() {
duke@435 71 }
duke@435 72
duke@435 73 inline DIR* os::opendir(const char* dirname)
duke@435 74 {
duke@435 75 assert(dirname != NULL, "just checking");
duke@435 76 return ::opendir(dirname);
duke@435 77 }
duke@435 78
duke@435 79 inline int os::readdir_buf_size(const char *path)
duke@435 80 {
duke@435 81 int size = pathconf(path, _PC_NAME_MAX);
duke@435 82 return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1;
duke@435 83 }
duke@435 84
duke@435 85 inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf)
duke@435 86 {
duke@435 87 assert(dirp != NULL, "just checking");
duke@435 88 #if defined(_LP64) || defined(_GNU_SOURCE)
duke@435 89 dirent* p;
duke@435 90 int status;
duke@435 91
duke@435 92 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
duke@435 93 errno = status;
duke@435 94 return NULL;
duke@435 95 } else
duke@435 96 return p;
duke@435 97 #else // defined(_LP64) || defined(_GNU_SOURCE)
duke@435 98 return ::readdir_r(dirp, dbuf);
duke@435 99 #endif // defined(_LP64) || defined(_GNU_SOURCE)
duke@435 100 }
duke@435 101
duke@435 102 inline int os::closedir(DIR *dirp)
duke@435 103 {
duke@435 104 assert(dirp != NULL, "just checking");
duke@435 105 return ::closedir(dirp);
duke@435 106 }
duke@435 107
duke@435 108 //////////////////////////////////////////////////////////////////////////////
duke@435 109 ////////////////////////////////////////////////////////////////////////////////
duke@435 110
duke@435 111 // macros for interruptible io and system calls and system call restarting
duke@435 112
duke@435 113 #define _INTERRUPTIBLE(_setup, _cmd, _result, _thread, _clear, _before, _after, _int_enable) \
duke@435 114 do { \
duke@435 115 _setup; \
duke@435 116 _before; \
duke@435 117 OSThread* _osthread = _thread->osthread(); \
duke@435 118 if (_int_enable && _thread->has_last_Java_frame()) { \
duke@435 119 /* this is java interruptible io stuff */ \
duke@435 120 if (os::is_interrupted(_thread, _clear)) { \
duke@435 121 os::Solaris::bump_interrupted_before_count(); \
duke@435 122 _result = OS_INTRPT; \
duke@435 123 } else { \
duke@435 124 /* _cmd always expands to an assignment to _result */ \
duke@435 125 if ((_cmd) < 0 && errno == EINTR \
duke@435 126 && os::is_interrupted(_thread, _clear)) { \
duke@435 127 os::Solaris::bump_interrupted_during_count(); \
duke@435 128 _result = OS_INTRPT; \
duke@435 129 } \
duke@435 130 } \
duke@435 131 } else { \
duke@435 132 /* this is normal blocking io stuff */ \
duke@435 133 _cmd; \
duke@435 134 } \
duke@435 135 _after; \
duke@435 136 } while(false)
duke@435 137
duke@435 138 // Interruptible io support + restarting of interrupted system calls
duke@435 139
duke@435 140 #ifndef ASSERT
duke@435 141
duke@435 142 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \
duke@435 143 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO); \
duke@435 144 } while((_result == OS_ERR) && (errno == EINTR))
duke@435 145
duke@435 146 #else
duke@435 147
duke@435 148 // This adds an assertion that it is only called from thread_in_native
duke@435 149 // The call overhead is skipped for performance in product mode
duke@435 150 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \
duke@435 151 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ); \
duke@435 152 } while((_result == OS_ERR) && (errno == EINTR))
duke@435 153
duke@435 154 #endif
duke@435 155
duke@435 156 // Used for calls from _thread_in_vm, not from _thread_in_native
duke@435 157 #define INTERRUPTIBLE_VM(_cmd, _result, _clear) do { \
duke@435 158 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible(_thread), UseVMInterruptibleIO ); \
duke@435 159 } while((_result == OS_ERR) && (errno == EINTR))
duke@435 160
duke@435 161 /* Use NORESTART when the system call cannot return EINTR, when something other
duke@435 162 than a system call is being invoked, or when the caller must do EINTR
duke@435 163 handling. */
duke@435 164
duke@435 165 #ifndef ASSERT
duke@435 166
duke@435 167 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \
duke@435 168 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO)
duke@435 169
duke@435 170 #else
duke@435 171
duke@435 172 // This adds an assertion that it is only called from thread_in_native
duke@435 173 // The call overhead is skipped for performance in product mode
duke@435 174 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \
duke@435 175 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO )
duke@435 176
duke@435 177 #endif
duke@435 178
duke@435 179 // Don't attend to UseVMInterruptibleIO. Always allow interruption.
duke@435 180 // Also assumes that it is called from the _thread_blocked state.
duke@435 181 // Used by os_sleep().
duke@435 182
duke@435 183 #define INTERRUPTIBLE_NORESTART_VM_ALWAYS(_cmd, _result, _thread, _clear) \
duke@435 184 _INTERRUPTIBLE(os::Solaris::setup_interruptible_already_blocked(_thread), _result = _cmd, _result, _thread, _clear, , , true )
duke@435 185
duke@435 186 #define INTERRUPTIBLE_RETURN_INT(_cmd, _clear) do { \
duke@435 187 int _result; \
duke@435 188 do { \
duke@435 189 INTERRUPTIBLE(_cmd, _result, _clear); \
duke@435 190 } while((_result == OS_ERR) && (errno == EINTR)); \
duke@435 191 return _result; \
duke@435 192 } while(false)
duke@435 193
duke@435 194 #define INTERRUPTIBLE_RETURN_INT_VM(_cmd, _clear) do { \
duke@435 195 int _result; \
duke@435 196 do { \
duke@435 197 INTERRUPTIBLE_VM(_cmd, _result, _clear); \
duke@435 198 } while((_result == OS_ERR) && (errno == EINTR)); \
duke@435 199 return _result; \
duke@435 200 } while(false)
duke@435 201
duke@435 202 #define INTERRUPTIBLE_RETURN_INT_NORESTART(_cmd, _clear) do { \
duke@435 203 int _result; \
duke@435 204 INTERRUPTIBLE_NORESTART(_cmd, _result, _clear); \
duke@435 205 return _result; \
duke@435 206 } while(false)
duke@435 207
duke@435 208 /* Use the RESTARTABLE macros when interruptible io is not needed */
duke@435 209
duke@435 210 #define RESTARTABLE(_cmd, _result) do { \
duke@435 211 do { \
duke@435 212 _result = _cmd; \
duke@435 213 } while((_result == OS_ERR) && (errno == EINTR)); \
duke@435 214 } while(false)
duke@435 215
duke@435 216 #define RESTARTABLE_RETURN_INT(_cmd) do { \
duke@435 217 int _result; \
duke@435 218 RESTARTABLE(_cmd, _result); \
duke@435 219 return _result; \
duke@435 220 } while(false)
iveresov@576 221
iveresov@576 222 inline bool os::numa_has_static_binding() { return false; }
iveresov@576 223 inline bool os::numa_has_group_homing() { return true; }
stefank@2314 224
stefank@2314 225 #endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP

mercurial