Mercurial > hg > truffle
annotate src/os/solaris/vm/os_solaris.inline.hpp @ 17990:00c8a1255912
8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
Reviewed-by: kvn, roland
author | vlivanov |
---|---|
date | Tue, 17 Jun 2014 09:02:30 +0000 |
parents | feae15578b2f |
children | 6c9332549827 ce8f6bb717c9 |
rev | line source |
---|---|
0 | 1 /* |
7623
203f64878aab
7102489: RFE: cleanup jlong typedef on __APPLE__and _LLP64 systems.
hseigel
parents:
7199
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP |
26 #define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP | |
27 | |
7199
cd3d6a6b95d9
8003240: x86: move MacroAssembler into separate file
twisti
parents:
6842
diff
changeset
|
28 #include "runtime/atomic.inline.hpp" |
1972 | 29 #include "runtime/os.hpp" |
7199
cd3d6a6b95d9
8003240: x86: move MacroAssembler into separate file
twisti
parents:
6842
diff
changeset
|
30 |
1972 | 31 #ifdef TARGET_OS_ARCH_solaris_x86 |
32 # include "orderAccess_solaris_x86.inline.hpp" | |
33 #endif | |
34 #ifdef TARGET_OS_ARCH_solaris_sparc | |
35 # include "orderAccess_solaris_sparc.inline.hpp" | |
36 #endif | |
37 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
38 // System includes |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
39 #include <sys/param.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
40 #include <dlfcn.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
41 #include <sys/socket.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
42 #include <sys/poll.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
43 #include <sys/filio.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
44 #include <unistd.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
45 #include <netdb.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
46 #include <setjmp.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
47 |
0 | 48 inline const char* os::file_separator() { return "/"; } |
49 inline const char* os::line_separator() { return "\n"; } | |
50 inline const char* os::path_separator() { return ":"; } | |
51 | |
52 // File names are case-sensitive on windows only | |
53 inline int os::file_name_strcmp(const char* s1, const char* s2) { | |
54 return strcmp(s1, s2); | |
55 } | |
56 | |
57 inline bool os::uses_stack_guard_pages() { | |
58 return true; | |
59 } | |
60 | |
61 inline bool os::allocate_stack_guard_pages() { | |
62 assert(uses_stack_guard_pages(), "sanity check"); | |
63 int r = thr_main() ; | |
64 guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ; | |
65 return r; | |
66 } | |
67 | |
68 | |
69 // On Solaris, reservations are made on a page by page basis, nothing to do. | |
6197 | 70 inline void os::pd_split_reserved_memory(char *base, size_t size, |
0 | 71 size_t split, bool realloc) { |
72 } | |
73 | |
74 | |
75 // Bang the shadow pages if they need to be touched to be mapped. | |
76 inline void os::bang_stack_shadow_pages() { | |
77 } | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
78 inline void os::dll_unload(void *lib) { ::dlclose(lib); } |
0 | 79 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
80 inline DIR* os::opendir(const char* dirname) { |
0 | 81 assert(dirname != NULL, "just checking"); |
82 return ::opendir(dirname); | |
83 } | |
84 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
85 inline int os::readdir_buf_size(const char *path) { |
0 | 86 int size = pathconf(path, _PC_NAME_MAX); |
87 return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1; | |
88 } | |
89 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
90 inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) { |
0 | 91 assert(dirp != NULL, "just checking"); |
11036 | 92 #if defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 93 dirent* p; |
94 int status; | |
95 | |
96 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { | |
97 errno = status; | |
98 return NULL; | |
99 } else | |
100 return p; | |
11036 | 101 #else // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 102 return ::readdir_r(dirp, dbuf); |
11036 | 103 #endif // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 104 } |
105 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
106 inline int os::closedir(DIR *dirp) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
107 assert(dirp != NULL, "argument is NULL"); |
0 | 108 return ::closedir(dirp); |
109 } | |
110 | |
111 ////////////////////////////////////////////////////////////////////////////// | |
112 //////////////////////////////////////////////////////////////////////////////// | |
113 | |
114 // macros for interruptible io and system calls and system call restarting | |
115 | |
116 #define _INTERRUPTIBLE(_setup, _cmd, _result, _thread, _clear, _before, _after, _int_enable) \ | |
117 do { \ | |
118 _setup; \ | |
119 _before; \ | |
120 OSThread* _osthread = _thread->osthread(); \ | |
121 if (_int_enable && _thread->has_last_Java_frame()) { \ | |
122 /* this is java interruptible io stuff */ \ | |
123 if (os::is_interrupted(_thread, _clear)) { \ | |
124 os::Solaris::bump_interrupted_before_count(); \ | |
125 _result = OS_INTRPT; \ | |
126 } else { \ | |
127 /* _cmd always expands to an assignment to _result */ \ | |
128 if ((_cmd) < 0 && errno == EINTR \ | |
129 && os::is_interrupted(_thread, _clear)) { \ | |
130 os::Solaris::bump_interrupted_during_count(); \ | |
131 _result = OS_INTRPT; \ | |
132 } \ | |
133 } \ | |
134 } else { \ | |
135 /* this is normal blocking io stuff */ \ | |
136 _cmd; \ | |
137 } \ | |
138 _after; \ | |
139 } while(false) | |
140 | |
141 // Interruptible io support + restarting of interrupted system calls | |
142 | |
143 #ifndef ASSERT | |
144 | |
145 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \ | |
146 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO); \ | |
147 } while((_result == OS_ERR) && (errno == EINTR)) | |
148 | |
149 #else | |
150 | |
151 // This adds an assertion that it is only called from thread_in_native | |
152 // The call overhead is skipped for performance in product mode | |
153 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \ | |
154 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ); \ | |
155 } while((_result == OS_ERR) && (errno == EINTR)) | |
156 | |
157 #endif | |
158 | |
159 // Used for calls from _thread_in_vm, not from _thread_in_native | |
160 #define INTERRUPTIBLE_VM(_cmd, _result, _clear) do { \ | |
161 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible(_thread), UseVMInterruptibleIO ); \ | |
162 } while((_result == OS_ERR) && (errno == EINTR)) | |
163 | |
164 /* Use NORESTART when the system call cannot return EINTR, when something other | |
165 than a system call is being invoked, or when the caller must do EINTR | |
166 handling. */ | |
167 | |
168 #ifndef ASSERT | |
169 | |
170 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ | |
171 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO) | |
172 | |
173 #else | |
174 | |
175 // This adds an assertion that it is only called from thread_in_native | |
176 // The call overhead is skipped for performance in product mode | |
177 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ | |
178 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ) | |
179 | |
180 #endif | |
181 | |
182 // Don't attend to UseVMInterruptibleIO. Always allow interruption. | |
183 // Also assumes that it is called from the _thread_blocked state. | |
184 // Used by os_sleep(). | |
185 | |
186 #define INTERRUPTIBLE_NORESTART_VM_ALWAYS(_cmd, _result, _thread, _clear) \ | |
187 _INTERRUPTIBLE(os::Solaris::setup_interruptible_already_blocked(_thread), _result = _cmd, _result, _thread, _clear, , , true ) | |
188 | |
189 #define INTERRUPTIBLE_RETURN_INT(_cmd, _clear) do { \ | |
190 int _result; \ | |
191 do { \ | |
192 INTERRUPTIBLE(_cmd, _result, _clear); \ | |
193 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
194 return _result; \ | |
195 } while(false) | |
196 | |
197 #define INTERRUPTIBLE_RETURN_INT_VM(_cmd, _clear) do { \ | |
198 int _result; \ | |
199 do { \ | |
200 INTERRUPTIBLE_VM(_cmd, _result, _clear); \ | |
201 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
202 return _result; \ | |
203 } while(false) | |
204 | |
205 #define INTERRUPTIBLE_RETURN_INT_NORESTART(_cmd, _clear) do { \ | |
206 int _result; \ | |
207 INTERRUPTIBLE_NORESTART(_cmd, _result, _clear); \ | |
208 return _result; \ | |
209 } while(false) | |
210 | |
211 /* Use the RESTARTABLE macros when interruptible io is not needed */ | |
212 | |
213 #define RESTARTABLE(_cmd, _result) do { \ | |
214 do { \ | |
215 _result = _cmd; \ | |
216 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
217 } while(false) | |
218 | |
219 #define RESTARTABLE_RETURN_INT(_cmd) do { \ | |
220 int _result; \ | |
221 RESTARTABLE(_cmd, _result); \ | |
222 return _result; \ | |
223 } while(false) | |
141 | 224 |
225 inline bool os::numa_has_static_binding() { return false; } | |
226 inline bool os::numa_has_group_homing() { return true; } | |
1972 | 227 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
228 inline int os::socket(int domain, int type, int protocol) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
229 return ::socket(domain, type, protocol); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
230 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
231 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
232 inline int os::listen(int fd, int count) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
233 if (fd < 0) return OS_ERR; |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
234 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
235 return ::listen(fd, count); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
236 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
237 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
238 inline int os::socket_shutdown(int fd, int howto){ |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
239 return ::shutdown(fd, howto); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
240 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
241 |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
242 inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len){ |
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
243 return ::getsockname(fd, him, len); |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
244 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
245 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
246 inline int os::get_host_name(char* name, int namelen){ |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
247 return ::gethostname(name, namelen); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
248 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
249 |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
250 inline struct hostent* os::get_host_by_name(char* name) { |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
251 return ::gethostbyname(name); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
252 } |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
253 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
254 inline int os::get_sock_opt(int fd, int level, int optname, |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
255 char* optval, socklen_t* optlen) { |
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
256 return ::getsockopt(fd, level, optname, optval, optlen); |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
257 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
258 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
259 inline int os::set_sock_opt(int fd, int level, int optname, |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
260 const char *optval, socklen_t optlen) { |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
261 return ::setsockopt(fd, level, optname, optval, optlen); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
262 } |
1972 | 263 #endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP |