--- old/src/hotspot/os/solaris/os_solaris.cpp Tue Nov 14 05:34:29 2017 +++ new/src/hotspot/os/solaris/os_solaris.cpp Tue Nov 14 05:34:27 2017 @@ -200,11 +200,15 @@ return st; } -address os::current_stack_base() { +bool os::is_primordial_thread(void) { int r = thr_main(); guarantee(r == 0 || r == 1, "CR6501650 or CR6493689"); - bool is_primordial_thread = r; + return r == 1; +} +address os::current_stack_base() { + bool is_primordial_thread = is_primordial_thread(); + // Workaround 4352906, avoid calls to thr_stksegment by // thr_main after the first one (it looks like we trash // some data, causing the value for ss_sp to be incorrect). @@ -224,9 +228,7 @@ size_t os::current_stack_size() { size_t size; - int r = thr_main(); - guarantee(r == 0 || r == 1, "CR6501650 or CR6493689"); - if (!r) { + if (!is_primordial_thread()) { size = get_stack_info().ss_size; } else { struct rlimit limits; @@ -1094,9 +1096,7 @@ // First crack at OS-specific initialization, from inside the new thread. void os::initialize_thread(Thread* thr) { - int r = thr_main(); - guarantee(r == 0 || r == 1, "CR6501650 or CR6493689"); - if (r) { + if (is_primordial_thread()) { JavaThread* jt = (JavaThread *)thr; assert(jt != NULL, "Sanity check"); size_t stack_size;