Blame SOURCES/ppc_stack_overflow_fix.patch

9bf359
diff --git a/src/cpu/zero/vm/stack_zero.hpp b/src/cpu/zero/vm/stack_zero.hpp
9bf359
--- jdk8/hotspot/src/cpu/zero/vm/stack_zero.hpp
9bf359
+++ jdk8/hotspot/src/cpu/zero/vm/stack_zero.hpp
9bf359
@@ -99,7 +99,7 @@
9bf359
   int shadow_pages_size() const {
9bf359
     return _shadow_pages_size;
9bf359
   }
9bf359
-  int abi_stack_available(Thread *thread) const;
9bf359
+  ssize_t abi_stack_available(Thread *thread) const;
9bf359
 
9bf359
  public:
9bf359
   void overflow_check(int required_words, TRAPS);
9bf359
diff --git a/src/cpu/zero/vm/stack_zero.inline.hpp b/src/cpu/zero/vm/stack_zero.inline.hpp
9bf359
--- jdk8/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
9bf359
+++ jdk8/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
9bf359
@@ -47,10 +47,11 @@
9bf359
 // This method returns the amount of ABI stack available for us
9bf359
 // to use under normal circumstances.  Note that the returned
9bf359
 // value can be negative.
9bf359
-inline int ZeroStack::abi_stack_available(Thread *thread) const {
9bf359
-  int stack_used = thread->stack_base() - (address) &stack_used;
9bf359
-  int stack_free = thread->stack_size() - stack_used;
9bf359
-  return stack_free - shadow_pages_size();
9bf359
+inline ssize_t ZeroStack::abi_stack_available(Thread *thread) const {
9bf359
+  ssize_t stack_used = thread->stack_base() - (address) &stack_used
9bf359
+    + (StackYellowPages+StackRedPages+StackShadowPages) * os::vm_page_size();
9bf359
+  ssize_t stack_free = thread->stack_size() - stack_used;
9bf359
+  return stack_free;
9bf359
 }
9bf359
 
9bf359
 #endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP
9bf359
diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp
9bf359
--- jdk8/hotspot/src/os/linux/vm/os_linux.cpp
9bf359
+++ jdk8/hotspot/src/os/linux/vm/os_linux.cpp
9bf359
@@ -4700,6 +4700,13 @@
9bf359
   os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
9bf359
             (size_t)(StackYellowPages+StackRedPages+StackShadowPages) * Linux::page_size() +
9bf359
                     (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size());
9bf359
+#ifdef ZERO
9bf359
+  // If this is Zero, allow at the very minimum one page each for the
9bf359
+  // Zero stack and the native stack.  This won't make any difference
9bf359
+  // for 4k pages, but is significant for large pages.
9bf359
+  os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
9bf359
+             (size_t)(StackYellowPages+StackRedPages+StackShadowPages+2) * Linux::page_size());
9bf359
+#endif
9bf359
 
9bf359
   size_t threadStackSizeInBytes = ThreadStackSize * K;
9bf359
   if (threadStackSizeInBytes != 0 &&