author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 58654 | 562bf1878089 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
25 |
#ifndef OS_WINDOWS_OS_WINDOWS_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
26 |
#define OS_WINDOWS_OS_WINDOWS_INLINE_HPP |
7397 | 27 |
|
28 |
#include "runtime/os.hpp" |
|
35201
996db89f378e
8139864: Improve handling of stack protection zones.
goetz
parents:
30143
diff
changeset
|
29 |
#include "runtime/thread.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
7405
diff
changeset
|
30 |
|
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
31 |
inline const char* os::dll_file_extension() { return ".dll"; } |
1 | 32 |
|
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
33 |
inline void os::dll_unload(void *lib) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
34 |
::FreeLibrary((HMODULE)lib); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
35 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
36 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
37 |
inline void* os::dll_lookup(void *lib, const char *name) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
38 |
return (void*)::GetProcAddress((HMODULE)lib, name); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
39 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
40 |
|
1 | 41 |
inline bool os::uses_stack_guard_pages() { |
35212
7a6d0993a080
8048521: Remove obsolete code from os_windows.cpp/hpp
ctornqvi
parents:
35201
diff
changeset
|
42 |
return true; |
1 | 43 |
} |
44 |
||
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
45 |
inline bool os::must_commit_stack_guard_pages() { |
1 | 46 |
return true; |
47 |
} |
|
48 |
||
49 |
// Bang the shadow pages if they need to be touched to be mapped. |
|
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
50 |
inline void os::map_stack_shadow_pages(address sp) { |
1 | 51 |
// Write to each page of our new frame to force OS mapping. |
52 |
// If we decrement stack pointer more than one page |
|
53 |
// the OS may not map an intervening page into our space |
|
54 |
// and may fault on a memory access to interior of our frame. |
|
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
55 |
const int page_size = os::win32::vm_page_size(); |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
56 |
const size_t n_pages = JavaThread::stack_shadow_zone_size() / page_size; |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
57 |
for (size_t pages = 1; pages <= n_pages; pages++) { |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
58 |
sp -= page_size; |
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
59 |
*sp = 0; |
1 | 60 |
} |
61 |
} |
|
388 | 62 |
|
63 |
inline bool os::numa_has_static_binding() { return true; } |
|
64 |
inline bool os::numa_has_group_homing() { return false; } |
|
7397 | 65 |
|
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
66 |
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
67 |
return ::write(fd, buf, nBytes); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
68 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
69 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
70 |
inline int os::close(int fd) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
71 |
return ::close(fd); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
72 |
} |
18683
a6418e038255
8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents:
15855
diff
changeset
|
73 |
|
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18683
diff
changeset
|
74 |
inline bool os::supports_monotonic_clock() { |
35212
7a6d0993a080
8048521: Remove obsolete code from os_windows.cpp/hpp
ctornqvi
parents:
35201
diff
changeset
|
75 |
return true; |
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18683
diff
changeset
|
76 |
} |
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18683
diff
changeset
|
77 |
|
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
78 |
inline void os::exit(int num) { |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
79 |
win32::exit_process_or_thread(win32::EPT_PROCESS, num); |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
80 |
} |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
81 |
|
57738
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
82 |
// Platform Mutex/Monitor implementation |
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
83 |
|
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
84 |
inline os::PlatformMutex::PlatformMutex() { |
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
85 |
InitializeCriticalSection(&_mutex); |
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
86 |
} |
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
87 |
|
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
88 |
inline os::PlatformMutex::~PlatformMutex() { |
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
89 |
DeleteCriticalSection(&_mutex); |
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
90 |
} |
53886
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
91 |
|
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
92 |
inline os::PlatformMonitor::PlatformMonitor() { |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
93 |
InitializeConditionVariable(&_cond); |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
94 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
95 |
|
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
96 |
inline os::PlatformMonitor::~PlatformMonitor() { |
57738
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
97 |
// There is no DeleteConditionVariable API |
53886
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
98 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
99 |
|
57738
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
100 |
inline void os::PlatformMutex::lock() { |
53886
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
101 |
EnterCriticalSection(&_mutex); |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
102 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
103 |
|
57738
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
104 |
inline void os::PlatformMutex::unlock() { |
53886
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
105 |
LeaveCriticalSection(&_mutex); |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
106 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
107 |
|
57738
807d192fb7dd
8228857: Refactor PlatformMonitor into PlatformMutex and PlatformMonitor
dholmes
parents:
55524
diff
changeset
|
108 |
inline bool os::PlatformMutex::try_lock() { |
53886
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
109 |
return TryEnterCriticalSection(&_mutex); |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
110 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
111 |
|
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
112 |
inline void os::PlatformMonitor::notify() { |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
113 |
WakeConditionVariable(&_cond); |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
114 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
115 |
|
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
116 |
inline void os::PlatformMonitor::notify_all() { |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
117 |
WakeAllConditionVariable(&_cond); |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
118 |
} |
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
119 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
120 |
#endif // OS_WINDOWS_OS_WINDOWS_INLINE_HPP |