< prev index next >
src/hotspot/os/linux/os_linux.cpp
Print this page
rev 49420 : 8199717: Avoid calculating primordial thread stack bounds on VM startup
Reviewed-by: dholmes, rehn, stuefe
*** 150,159 ****
--- 150,166 ----
static jlong initial_time_count=0;
static int clock_tics_per_sec = 100;
+ // If the VM might have been created on the primordial thread, we need to resolve the
+ // primordial thread stack bounds and check if the current thread might be the
+ // primordial thread in places. If we know that the primordial thread is never used,
+ // such as when the VM was created by one of the standard java launchers, we can
+ // avoid this
+ static bool suppress_primordial_thread_resolution = false;
+
// For diagnostics to print a message once. see run_periodic_checks
static sigset_t check_signal_done;
static bool check_signals = true;
// Signal number used to suspend/resume a thread
*** 915,924 ****
--- 922,934 ----
//////////////////////////////////////////////////////////////////////////////
// primordial thread
// Check if current thread is the primordial thread, similar to Solaris thr_main.
bool os::is_primordial_thread(void) {
+ if (suppress_primordial_thread_resolution) {
+ return false;
+ }
char dummy;
// If called before init complete, thread stack bottom will be null.
// Can be called if fatal error occurs before initialization.
if (os::Linux::initial_thread_stack_bottom() == NULL) return false;
assert(os::Linux::initial_thread_stack_bottom() != NULL &&
*** 4934,4944 ****
--- 4944,4958 ----
// Check and sets minimum stack sizes against command line options
if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
return JNI_ERR;
}
+
+ suppress_primordial_thread_resolution = Arguments::created_by_java_launcher();
+ if (!suppress_primordial_thread_resolution) {
Linux::capture_initial_stack(JavaThread::stack_size_at_create());
+ }
#if defined(IA32)
workaround_expand_exec_shield_cs_limit();
#endif
< prev index next >