Mercurial > hg > graal-jvmci-8
diff src/cpu/zero/vm/stack_zero.inline.hpp @ 1511:348346af6676
6950178: Zero stack improvements
Summary: Moves the logic for determining the size of the Zero stack into the ZeroStack class.
Reviewed-by: twisti
Contributed-by: Gary Benson <gbenson@redhat.com>
author | twisti |
---|---|
date | Thu, 06 May 2010 02:09:18 -0700 |
parents | aa9c266de52a |
children | c18cbe5936b8 |
line wrap: on
line diff
--- a/src/cpu/zero/vm/stack_zero.inline.hpp Wed May 05 05:57:21 2010 -0700 +++ b/src/cpu/zero/vm/stack_zero.inline.hpp Thu May 06 02:09:18 2010 -0700 @@ -25,19 +25,24 @@ // 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()) { + if (available_words() < required_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()) { + 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(); +}