diff src/cpu/zero/vm/stack_zero.inline.hpp @ 7410:acc869dcded3

8064815: Zero+PPC64: Stack overflow when running Maven Reviewed-by: kvn, simonis Contributed-by: sgehwolf@redhat.com
author simonis
date Tue, 18 Nov 2014 19:17:16 +0100
parents f95d63e2154a
children 3125c4a60cc9
line wrap: on
line diff
--- a/src/cpu/zero/vm/stack_zero.inline.hpp	Thu Nov 13 16:58:56 2014 +0100
+++ b/src/cpu/zero/vm/stack_zero.inline.hpp	Tue Nov 18 19:17:16 2014 +0100
@@ -48,9 +48,11 @@
 // 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;
+  guarantee(Thread::current() == thread, "should run in the same thread");
+  int stack_used = thread->stack_base() - (address) &stack_used
+    + (StackYellowPages+StackRedPages+StackShadowPages) * os::vm_page_size();
   int stack_free = thread->stack_size() - stack_used;
-  return stack_free - shadow_pages_size();
+  return stack_free;
 }
 
 #endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP