< prev index next >
src/hotspot/os/solaris/os_solaris.cpp
Print this page
@@ -198,15 +198,19 @@
assert((address)&st < (address)st.ss_sp, "Invalid stack base returned");
assert((address)&st > (address)st.ss_sp-st.ss_size, "Invalid stack size returned");
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).
if (!is_primordial_thread || os::Solaris::_main_stack_base == NULL) {
stack_t st = get_stack_info();
@@ -222,13 +226,11 @@
}
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;
getrlimit(RLIMIT_STACK, &limits);
size = adjust_stack_size(os::Solaris::_main_stack_base, (size_t)limits.rlim_cur);
@@ -1092,13 +1094,11 @@
}
// 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;
address base = jt->stack_base();
if (Arguments::created_by_java_launcher()) {
< prev index next >