Mercurial > hg > truffle
comparison src/share/vm/runtime/thread.cpp @ 1320:3b3d12e645e7
6929067: Stack guard pages should be removed when thread is detached
Summary: Add code to unmap stack guard area when thread is detached.
Reviewed-by: coleenp, kamg
author | coleenp |
---|---|
date | Fri, 12 Mar 2010 10:42:16 -0500 |
parents | c8a467bf56ad |
children | b30a2cd5e3a2 c18cbe5936b8 b96a3e44582f |
comparison
equal
deleted
inserted
replaced
1292:12d91eb0f579 | 1320:3b3d12e645e7 |
---|---|
2135 size_t len = (StackYellowPages + StackRedPages) * os::vm_page_size(); | 2135 size_t len = (StackYellowPages + StackRedPages) * os::vm_page_size(); |
2136 | 2136 |
2137 int allocate = os::allocate_stack_guard_pages(); | 2137 int allocate = os::allocate_stack_guard_pages(); |
2138 // warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len); | 2138 // warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len); |
2139 | 2139 |
2140 if (allocate && !os::commit_memory((char *) low_addr, len)) { | 2140 if (allocate && !os::create_stack_guard_pages((char *) low_addr, len)) { |
2141 warning("Attempt to allocate stack guard pages failed."); | 2141 warning("Attempt to allocate stack guard pages failed."); |
2142 return; | 2142 return; |
2143 } | 2143 } |
2144 | 2144 |
2145 if (os::guard_memory((char *) low_addr, len)) { | 2145 if (os::guard_memory((char *) low_addr, len)) { |
2156 if (_stack_guard_state == stack_guard_unused) return; | 2156 if (_stack_guard_state == stack_guard_unused) return; |
2157 address low_addr = stack_base() - stack_size(); | 2157 address low_addr = stack_base() - stack_size(); |
2158 size_t len = (StackYellowPages + StackRedPages) * os::vm_page_size(); | 2158 size_t len = (StackYellowPages + StackRedPages) * os::vm_page_size(); |
2159 | 2159 |
2160 if (os::allocate_stack_guard_pages()) { | 2160 if (os::allocate_stack_guard_pages()) { |
2161 if (os::uncommit_memory((char *) low_addr, len)) { | 2161 if (os::remove_stack_guard_pages((char *) low_addr, len)) { |
2162 _stack_guard_state = stack_guard_unused; | 2162 _stack_guard_state = stack_guard_unused; |
2163 } else { | 2163 } else { |
2164 warning("Attempt to deallocate stack guard pages failed."); | 2164 warning("Attempt to deallocate stack guard pages failed."); |
2165 } | 2165 } |
2166 } else { | 2166 } else { |