equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
26 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP |
26 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP |
27 |
27 |
28 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE |
28 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE |
29 |
29 |
30 #include "runtime/atomic.inline.hpp" |
30 #include "runtime/atomic.inline.hpp" |
|
31 #include "runtime/os.inline.hpp" |
31 #include "runtime/thread.hpp" |
32 #include "runtime/thread.hpp" |
32 #ifdef TARGET_OS_FAMILY_linux |
33 #ifdef TARGET_OS_FAMILY_linux |
33 # include "thread_linux.inline.hpp" |
34 # include "thread_linux.inline.hpp" |
34 #endif |
35 #endif |
35 #ifdef TARGET_OS_FAMILY_solaris |
36 #ifdef TARGET_OS_FAMILY_solaris |
134 inline void JavaThread::set_done_attaching_via_jni() { |
135 inline void JavaThread::set_done_attaching_via_jni() { |
135 _jni_attach_state = _attached_via_jni; |
136 _jni_attach_state = _attached_via_jni; |
136 OrderAccess::fence(); |
137 OrderAccess::fence(); |
137 } |
138 } |
138 |
139 |
|
140 inline bool JavaThread::stack_guard_zone_unused() { |
|
141 return _stack_guard_state == stack_guard_unused; |
|
142 } |
|
143 |
|
144 inline bool JavaThread::stack_yellow_zone_disabled() { |
|
145 return _stack_guard_state == stack_guard_yellow_disabled; |
|
146 } |
|
147 |
|
148 inline size_t JavaThread::stack_available(address cur_sp) { |
|
149 // This code assumes java stacks grow down |
|
150 address low_addr; // Limit on the address for deepest stack depth |
|
151 if (_stack_guard_state == stack_guard_unused) { |
|
152 low_addr = stack_base() - stack_size(); |
|
153 } else { |
|
154 low_addr = stack_yellow_zone_base(); |
|
155 } |
|
156 return cur_sp > low_addr ? cur_sp - low_addr : 0; |
|
157 } |
|
158 |
|
159 inline bool JavaThread::stack_yellow_zone_enabled() { |
|
160 #ifdef ASSERT |
|
161 if (os::uses_stack_guard_pages()) { |
|
162 assert(_stack_guard_state != stack_guard_unused, "guard pages must be in use"); |
|
163 } |
|
164 #endif |
|
165 return _stack_guard_state == stack_guard_enabled; |
|
166 } |
|
167 |
139 #endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP |
168 #endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP |