Mercurial > hg > graal-jvmci-8
annotate src/os/solaris/vm/os_solaris.inline.hpp @ 24234:ea6f94ab283b default tip
Added tag jvmci-0.36 for changeset 8128b98d4736
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 18 Sep 2017 18:49:45 +0200 |
parents | ca8e46278bae |
children |
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" |
20197
ce8f6bb717c9
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
11036
diff
changeset
|
29 #include "runtime/orderAccess.inline.hpp" |
1972 | 30 #include "runtime/os.hpp" |
7199
cd3d6a6b95d9
8003240: x86: move MacroAssembler into separate file
twisti
parents:
6842
diff
changeset
|
31 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
32 // System includes |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
33 #include <sys/param.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
34 #include <dlfcn.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
35 #include <sys/socket.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
36 #include <sys/poll.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
37 #include <sys/filio.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
38 #include <unistd.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
39 #include <netdb.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
40 #include <setjmp.h> |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
41 |
0 | 42 inline const char* os::file_separator() { return "/"; } |
43 inline const char* os::line_separator() { return "\n"; } | |
44 inline const char* os::path_separator() { return ":"; } | |
45 | |
46 // File names are case-sensitive on windows only | |
47 inline int os::file_name_strcmp(const char* s1, const char* s2) { | |
48 return strcmp(s1, s2); | |
49 } | |
50 | |
51 inline bool os::uses_stack_guard_pages() { | |
52 return true; | |
53 } | |
54 | |
55 inline bool os::allocate_stack_guard_pages() { | |
56 assert(uses_stack_guard_pages(), "sanity check"); | |
57 int r = thr_main() ; | |
58 guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ; | |
59 return r; | |
60 } | |
61 | |
62 | |
63 // On Solaris, reservations are made on a page by page basis, nothing to do. | |
6197 | 64 inline void os::pd_split_reserved_memory(char *base, size_t size, |
0 | 65 size_t split, bool realloc) { |
66 } | |
67 | |
68 | |
69 // Bang the shadow pages if they need to be touched to be mapped. | |
70 inline void os::bang_stack_shadow_pages() { | |
71 } | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
72 inline void os::dll_unload(void *lib) { ::dlclose(lib); } |
0 | 73 |
22589
ca8e46278bae
Create default for os::default_file_open_flags on Solaris; JVMCIRuntime::parse_lines: use ::open instead of os::open
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20804
diff
changeset
|
74 inline const int os::default_file_open_flags() { return 0;} |
ca8e46278bae
Create default for os::default_file_open_flags on Solaris; JVMCIRuntime::parse_lines: use ::open instead of os::open
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20804
diff
changeset
|
75 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
76 inline DIR* os::opendir(const char* dirname) { |
0 | 77 assert(dirname != NULL, "just checking"); |
78 return ::opendir(dirname); | |
79 } | |
80 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
81 inline int os::readdir_buf_size(const char *path) { |
0 | 82 int size = pathconf(path, _PC_NAME_MAX); |
83 return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1; | |
84 } | |
85 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
86 inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) { |
0 | 87 assert(dirp != NULL, "just checking"); |
11036 | 88 #if defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 89 dirent* p; |
90 int status; | |
91 | |
92 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { | |
93 errno = status; | |
94 return NULL; | |
95 } else | |
96 return p; | |
11036 | 97 #else // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 98 return ::readdir_r(dirp, dbuf); |
11036 | 99 #endif // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 100 } |
101 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
102 inline int os::closedir(DIR *dirp) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
103 assert(dirp != NULL, "argument is NULL"); |
0 | 104 return ::closedir(dirp); |
105 } | |
106 | |
107 ////////////////////////////////////////////////////////////////////////////// | |
108 //////////////////////////////////////////////////////////////////////////////// | |
109 | |
110 // macros for interruptible io and system calls and system call restarting | |
111 | |
112 #define _INTERRUPTIBLE(_setup, _cmd, _result, _thread, _clear, _before, _after, _int_enable) \ | |
113 do { \ | |
114 _setup; \ | |
115 _before; \ | |
116 OSThread* _osthread = _thread->osthread(); \ | |
117 if (_int_enable && _thread->has_last_Java_frame()) { \ | |
118 /* this is java interruptible io stuff */ \ | |
119 if (os::is_interrupted(_thread, _clear)) { \ | |
120 os::Solaris::bump_interrupted_before_count(); \ | |
121 _result = OS_INTRPT; \ | |
122 } else { \ | |
123 /* _cmd always expands to an assignment to _result */ \ | |
124 if ((_cmd) < 0 && errno == EINTR \ | |
125 && os::is_interrupted(_thread, _clear)) { \ | |
126 os::Solaris::bump_interrupted_during_count(); \ | |
127 _result = OS_INTRPT; \ | |
128 } \ | |
129 } \ | |
130 } else { \ | |
131 /* this is normal blocking io stuff */ \ | |
132 _cmd; \ | |
133 } \ | |
134 _after; \ | |
135 } while(false) | |
136 | |
137 // Interruptible io support + restarting of interrupted system calls | |
138 | |
139 #ifndef ASSERT | |
140 | |
141 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \ | |
142 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO); \ | |
143 } while((_result == OS_ERR) && (errno == EINTR)) | |
144 | |
145 #else | |
146 | |
147 // This adds an assertion that it is only called from thread_in_native | |
148 // The call overhead is skipped for performance in product mode | |
149 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \ | |
150 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ); \ | |
151 } while((_result == OS_ERR) && (errno == EINTR)) | |
152 | |
153 #endif | |
154 | |
155 // Used for calls from _thread_in_vm, not from _thread_in_native | |
156 #define INTERRUPTIBLE_VM(_cmd, _result, _clear) do { \ | |
157 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible(_thread), UseVMInterruptibleIO ); \ | |
158 } while((_result == OS_ERR) && (errno == EINTR)) | |
159 | |
160 /* Use NORESTART when the system call cannot return EINTR, when something other | |
161 than a system call is being invoked, or when the caller must do EINTR | |
162 handling. */ | |
163 | |
164 #ifndef ASSERT | |
165 | |
166 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ | |
167 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO) | |
168 | |
169 #else | |
170 | |
171 // This adds an assertion that it is only called from thread_in_native | |
172 // The call overhead is skipped for performance in product mode | |
173 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ | |
174 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ) | |
175 | |
176 #endif | |
177 | |
178 // Don't attend to UseVMInterruptibleIO. Always allow interruption. | |
179 // Also assumes that it is called from the _thread_blocked state. | |
180 // Used by os_sleep(). | |
181 | |
182 #define INTERRUPTIBLE_NORESTART_VM_ALWAYS(_cmd, _result, _thread, _clear) \ | |
183 _INTERRUPTIBLE(os::Solaris::setup_interruptible_already_blocked(_thread), _result = _cmd, _result, _thread, _clear, , , true ) | |
184 | |
185 #define INTERRUPTIBLE_RETURN_INT(_cmd, _clear) do { \ | |
186 int _result; \ | |
187 do { \ | |
188 INTERRUPTIBLE(_cmd, _result, _clear); \ | |
189 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
190 return _result; \ | |
191 } while(false) | |
192 | |
193 #define INTERRUPTIBLE_RETURN_INT_VM(_cmd, _clear) do { \ | |
194 int _result; \ | |
195 do { \ | |
196 INTERRUPTIBLE_VM(_cmd, _result, _clear); \ | |
197 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
198 return _result; \ | |
199 } while(false) | |
200 | |
201 #define INTERRUPTIBLE_RETURN_INT_NORESTART(_cmd, _clear) do { \ | |
202 int _result; \ | |
203 INTERRUPTIBLE_NORESTART(_cmd, _result, _clear); \ | |
204 return _result; \ | |
205 } while(false) | |
206 | |
207 /* Use the RESTARTABLE macros when interruptible io is not needed */ | |
208 | |
209 #define RESTARTABLE(_cmd, _result) do { \ | |
210 do { \ | |
211 _result = _cmd; \ | |
212 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
213 } while(false) | |
214 | |
215 #define RESTARTABLE_RETURN_INT(_cmd) do { \ | |
216 int _result; \ | |
217 RESTARTABLE(_cmd, _result); \ | |
218 return _result; \ | |
219 } while(false) | |
141 | 220 |
221 inline bool os::numa_has_static_binding() { return false; } | |
222 inline bool os::numa_has_group_homing() { return true; } | |
1972 | 223 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
224 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
|
225 return ::socket(domain, type, protocol); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
226 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
227 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
228 inline int os::listen(int fd, int count) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
229 if (fd < 0) return OS_ERR; |
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 return ::listen(fd, count); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
232 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
233 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
234 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
|
235 return ::shutdown(fd, howto); |
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 |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
238 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
|
239 return ::getsockname(fd, him, len); |
1980
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 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
242 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
|
243 return ::gethostname(name, namelen); |
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 |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
246 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
|
247 return ::gethostbyname(name); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
248 } |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
249 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
250 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
|
251 char* optval, socklen_t* optlen) { |
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
252 return ::getsockopt(fd, level, optname, optval, optlen); |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
253 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
254 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
255 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
|
256 const char *optval, socklen_t optlen) { |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
257 return ::setsockopt(fd, level, optname, optval, optlen); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
258 } |
1972 | 259 #endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP |