From 384ecfad72e7675637547748cfcee144a30f550d Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 23 Dec 2015 20:07:39 +0000 Subject: [PATCH] 8146011: sun/management/jmxremote/bootstrap/CustomLauncherTest crash at assert(stack_size) We were setting stack_overflow_limit before initialization completed which may change the stack base for some solaris systems with unlimited stack Reviewed-by: goetz, hseigel, gthornbr --- hotspot/src/share/vm/runtime/thread.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 160f61226c1..94b363d774b 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -306,10 +306,6 @@ void Thread::clear_thread_current() { void Thread::record_stack_base_and_size() { set_stack_base(os::current_stack_base()); set_stack_size(os::current_stack_size()); - if (is_Java_thread()) { - ((JavaThread*) this)->set_stack_overflow_limit(); - ((JavaThread*) this)->set_reserved_stack_activation(stack_base()); - } // CR 7190089: on Solaris, primordial thread's stack is adjusted // in initialize_thread(). Without the adjustment, stack size is // incorrect if stack is set to unlimited (ulimit -s unlimited). @@ -318,6 +314,11 @@ void Thread::record_stack_base_and_size() { // set up any platform-specific state. os::initialize_thread(this); + // Set stack limits after thread is initialized. + if (is_Java_thread()) { + ((JavaThread*) this)->set_stack_overflow_limit(); + ((JavaThread*) this)->set_reserved_stack_activation(stack_base()); + } #if INCLUDE_NMT // record thread's native stack, stack grows downward MemTracker::record_thread_stack(stack_end(), stack_size());