Mercurial > hg > truffle
annotate src/os/solaris/vm/os_solaris.inline.hpp @ 21289:3b5ec1a2b3b5
consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 11 May 2015 17:12:15 +0200 |
parents | 7848fc12602b |
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 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
74 inline DIR* os::opendir(const char* dirname) { |
0 | 75 assert(dirname != NULL, "just checking"); |
76 return ::opendir(dirname); | |
77 } | |
78 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
79 inline int os::readdir_buf_size(const char *path) { |
0 | 80 int size = pathconf(path, _PC_NAME_MAX); |
81 return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1; | |
82 } | |
83 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
84 inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) { |
0 | 85 assert(dirp != NULL, "just checking"); |
11036 | 86 #if defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 87 dirent* p; |
88 int status; | |
89 | |
90 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { | |
91 errno = status; | |
92 return NULL; | |
93 } else | |
94 return p; | |
11036 | 95 #else // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 96 return ::readdir_r(dirp, dbuf); |
11036 | 97 #endif // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 |
0 | 98 } |
99 | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
100 inline int os::closedir(DIR *dirp) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
101 assert(dirp != NULL, "argument is NULL"); |
0 | 102 return ::closedir(dirp); |
103 } | |
104 | |
105 ////////////////////////////////////////////////////////////////////////////// | |
106 //////////////////////////////////////////////////////////////////////////////// | |
107 | |
108 // macros for interruptible io and system calls and system call restarting | |
109 | |
110 #define _INTERRUPTIBLE(_setup, _cmd, _result, _thread, _clear, _before, _after, _int_enable) \ | |
111 do { \ | |
112 _setup; \ | |
113 _before; \ | |
114 OSThread* _osthread = _thread->osthread(); \ | |
115 if (_int_enable && _thread->has_last_Java_frame()) { \ | |
116 /* this is java interruptible io stuff */ \ | |
117 if (os::is_interrupted(_thread, _clear)) { \ | |
118 os::Solaris::bump_interrupted_before_count(); \ | |
119 _result = OS_INTRPT; \ | |
120 } else { \ | |
121 /* _cmd always expands to an assignment to _result */ \ | |
122 if ((_cmd) < 0 && errno == EINTR \ | |
123 && os::is_interrupted(_thread, _clear)) { \ | |
124 os::Solaris::bump_interrupted_during_count(); \ | |
125 _result = OS_INTRPT; \ | |
126 } \ | |
127 } \ | |
128 } else { \ | |
129 /* this is normal blocking io stuff */ \ | |
130 _cmd; \ | |
131 } \ | |
132 _after; \ | |
133 } while(false) | |
134 | |
135 // Interruptible io support + restarting of interrupted system calls | |
136 | |
137 #ifndef ASSERT | |
138 | |
139 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \ | |
140 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO); \ | |
141 } while((_result == OS_ERR) && (errno == EINTR)) | |
142 | |
143 #else | |
144 | |
145 // This adds an assertion that it is only called from thread_in_native | |
146 // The call overhead is skipped for performance in product mode | |
147 #define INTERRUPTIBLE(_cmd, _result, _clear) do { \ | |
148 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ); \ | |
149 } while((_result == OS_ERR) && (errno == EINTR)) | |
150 | |
151 #endif | |
152 | |
153 // Used for calls from _thread_in_vm, not from _thread_in_native | |
154 #define INTERRUPTIBLE_VM(_cmd, _result, _clear) do { \ | |
155 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible(_thread), UseVMInterruptibleIO ); \ | |
156 } while((_result == OS_ERR) && (errno == EINTR)) | |
157 | |
158 /* Use NORESTART when the system call cannot return EINTR, when something other | |
159 than a system call is being invoked, or when the caller must do EINTR | |
160 handling. */ | |
161 | |
162 #ifndef ASSERT | |
163 | |
164 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ | |
165 _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO) | |
166 | |
167 #else | |
168 | |
169 // This adds an assertion that it is only called from thread_in_native | |
170 // The call overhead is skipped for performance in product mode | |
171 #define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \ | |
172 _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ) | |
173 | |
174 #endif | |
175 | |
176 // Don't attend to UseVMInterruptibleIO. Always allow interruption. | |
177 // Also assumes that it is called from the _thread_blocked state. | |
178 // Used by os_sleep(). | |
179 | |
180 #define INTERRUPTIBLE_NORESTART_VM_ALWAYS(_cmd, _result, _thread, _clear) \ | |
181 _INTERRUPTIBLE(os::Solaris::setup_interruptible_already_blocked(_thread), _result = _cmd, _result, _thread, _clear, , , true ) | |
182 | |
183 #define INTERRUPTIBLE_RETURN_INT(_cmd, _clear) do { \ | |
184 int _result; \ | |
185 do { \ | |
186 INTERRUPTIBLE(_cmd, _result, _clear); \ | |
187 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
188 return _result; \ | |
189 } while(false) | |
190 | |
191 #define INTERRUPTIBLE_RETURN_INT_VM(_cmd, _clear) do { \ | |
192 int _result; \ | |
193 do { \ | |
194 INTERRUPTIBLE_VM(_cmd, _result, _clear); \ | |
195 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
196 return _result; \ | |
197 } while(false) | |
198 | |
199 #define INTERRUPTIBLE_RETURN_INT_NORESTART(_cmd, _clear) do { \ | |
200 int _result; \ | |
201 INTERRUPTIBLE_NORESTART(_cmd, _result, _clear); \ | |
202 return _result; \ | |
203 } while(false) | |
204 | |
205 /* Use the RESTARTABLE macros when interruptible io is not needed */ | |
206 | |
207 #define RESTARTABLE(_cmd, _result) do { \ | |
208 do { \ | |
209 _result = _cmd; \ | |
210 } while((_result == OS_ERR) && (errno == EINTR)); \ | |
211 } while(false) | |
212 | |
213 #define RESTARTABLE_RETURN_INT(_cmd) do { \ | |
214 int _result; \ | |
215 RESTARTABLE(_cmd, _result); \ | |
216 return _result; \ | |
217 } while(false) | |
141 | 218 |
219 inline bool os::numa_has_static_binding() { return false; } | |
220 inline bool os::numa_has_group_homing() { return true; } | |
1972 | 221 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
222 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
|
223 return ::socket(domain, type, protocol); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
224 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
225 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
226 inline int os::listen(int fd, int count) { |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
227 if (fd < 0) return OS_ERR; |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
228 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
229 return ::listen(fd, count); |
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::socket_shutdown(int fd, int howto){ |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
233 return ::shutdown(fd, howto); |
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 |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
236 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
|
237 return ::getsockname(fd, him, len); |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
238 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
239 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
240 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
|
241 return ::gethostname(name, namelen); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
242 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
243 |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
244 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
|
245 return ::gethostbyname(name); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
246 } |
4717
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
247 |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
248 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
|
249 char* optval, socklen_t* optlen) { |
11c26bfcf8c7
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
1980
diff
changeset
|
250 return ::getsockopt(fd, level, optname, optval, optlen); |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
251 } |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
252 |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
253 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
|
254 const char *optval, socklen_t optlen) { |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
255 return ::setsockopt(fd, level, optname, optval, optlen); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
256 } |
1972 | 257 #endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP |