thr_main can return -1.
209 address os::current_stack_base() {
210 bool is_primordial_thread = thr_main();
211
212 // Workaround 4352906, avoid calls to thr_stksegment by
213 // thr_main after the first one (it looks like we trash
214 // some data, causing the value for ss_sp to be incorrect).
215 if (!is_primordial_thread || os::Solaris::_main_stack_base == NULL) {
216 stack_t st = get_stack_info();
217 if (is_primordial_thread) {
218 // cache initial value of stack base
219 os::Solaris::_main_stack_base = (address)st.ss_sp;
220 }
221 return (address)st.ss_sp;
222 } else {
223 guarantee(os::Solaris::_main_stack_base != NULL, "Attempt to use null cached stack base");
224 return os::Solaris::_main_stack_base;
225 }