hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
Print this page
*** 23,43 ****
*
*/
// This function should match SharkStack::CreateStackOverflowCheck
inline void ZeroStack::overflow_check(int required_words, TRAPS) {
- JavaThread *thread = (JavaThread *) THREAD;
-
// Check the Zero stack
! if (required_words > available_words()) {
handle_overflow(THREAD);
return;
}
// Check the ABI stack
! address stack_top = thread->stack_base() - thread->stack_size();
! int free_stack = ((address) &stack_top) - stack_top;
! if (free_stack < shadow_pages_size()) {
handle_overflow(THREAD);
return;
}
}
--- 23,48 ----
*
*/
// This function should match SharkStack::CreateStackOverflowCheck
inline void ZeroStack::overflow_check(int required_words, TRAPS) {
// Check the Zero stack
! if (available_words() < required_words) {
handle_overflow(THREAD);
return;
}
// Check the ABI stack
! if (abi_stack_available(THREAD) < 0) {
handle_overflow(THREAD);
return;
}
}
+
+ // This method returns the amount of ABI stack available for us
+ // to use under normal circumstances. Note that the returned
+ // value can be negative.
+ inline int ZeroStack::abi_stack_available(Thread *thread) const {
+ int stack_used = thread->stack_base() - (address) &stack_used;
+ int stack_free = thread->stack_size() - stack_used;
+ return stack_free - shadow_pages_size();
+ }