Merge
This commit is contained in:
commit
ddb3cd1998
@ -57,10 +57,12 @@ define_pd_global(intx, InlineSmallCode, 1500);
|
|||||||
|
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
// Stack slots are 2X larger in LP64 than in the 32 bit VM.
|
// Stack slots are 2X larger in LP64 than in the 32 bit VM.
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 1024);
|
||||||
define_pd_global(intx, ThreadStackSize, 1024);
|
define_pd_global(intx, ThreadStackSize, 1024);
|
||||||
define_pd_global(intx, VMThreadStackSize, 1024);
|
define_pd_global(intx, VMThreadStackSize, 1024);
|
||||||
#define DEFAULT_STACK_SHADOW_PAGES (20 DEBUG_ONLY(+2))
|
#define DEFAULT_STACK_SHADOW_PAGES (20 DEBUG_ONLY(+2))
|
||||||
#else
|
#else
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 512);
|
||||||
define_pd_global(intx, ThreadStackSize, 512);
|
define_pd_global(intx, ThreadStackSize, 512);
|
||||||
define_pd_global(intx, VMThreadStackSize, 512);
|
define_pd_global(intx, VMThreadStackSize, 512);
|
||||||
#define DEFAULT_STACK_SHADOW_PAGES (6 DEBUG_ONLY(+2))
|
#define DEFAULT_STACK_SHADOW_PAGES (6 DEBUG_ONLY(+2))
|
||||||
|
@ -847,7 +847,8 @@ static void *thread_native_entry(Thread *thread) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
|
bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||||
|
size_t req_stack_size) {
|
||||||
|
|
||||||
assert(thread->osthread() == NULL, "caller responsible");
|
assert(thread->osthread() == NULL, "caller responsible");
|
||||||
|
|
||||||
@ -880,37 +881,12 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
|
|||||||
guarantee(pthread_attr_setsuspendstate_np(&attr, PTHREAD_CREATE_SUSPENDED_NP) == 0, "???");
|
guarantee(pthread_attr_setsuspendstate_np(&attr, PTHREAD_CREATE_SUSPENDED_NP) == 0, "???");
|
||||||
|
|
||||||
// calculate stack size if it's not specified by caller
|
// calculate stack size if it's not specified by caller
|
||||||
if (stack_size == 0) {
|
size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size);
|
||||||
stack_size = os::Aix::default_stack_size(thr_type);
|
|
||||||
|
|
||||||
switch (thr_type) {
|
|
||||||
case os::java_thread:
|
|
||||||
// Java threads use ThreadStackSize whose default value can be changed with the flag -Xss.
|
|
||||||
assert(JavaThread::stack_size_at_create() > 0, "this should be set");
|
|
||||||
stack_size = JavaThread::stack_size_at_create();
|
|
||||||
break;
|
|
||||||
case os::compiler_thread:
|
|
||||||
if (CompilerThreadStackSize > 0) {
|
|
||||||
stack_size = (size_t)(CompilerThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
} // else fall through:
|
|
||||||
// use VMThreadStackSize if CompilerThreadStackSize is not defined
|
|
||||||
case os::vm_thread:
|
|
||||||
case os::pgc_thread:
|
|
||||||
case os::cgc_thread:
|
|
||||||
case os::watcher_thread:
|
|
||||||
if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stack_size = MAX2(stack_size, os::Aix::min_stack_allowed);
|
|
||||||
pthread_attr_setstacksize(&attr, stack_size);
|
pthread_attr_setstacksize(&attr, stack_size);
|
||||||
|
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
|
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread);
|
||||||
|
|
||||||
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
|
log_info(os, thread)("Thread started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
|
||||||
@ -3593,32 +3569,11 @@ jint os::init_2(void) {
|
|||||||
Aix::signal_sets_init();
|
Aix::signal_sets_init();
|
||||||
Aix::install_signal_handlers();
|
Aix::install_signal_handlers();
|
||||||
|
|
||||||
// Check minimum allowable stack size for thread creation and to initialize
|
// Check and sets minimum stack sizes against command line options
|
||||||
// the java system classes, including StackOverflowError - depends on page
|
if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
|
||||||
// size. Add two 4K pages for compiler2 recursion in main thread.
|
|
||||||
// Add in 4*BytesPerWord 4K pages to account for VM stack during
|
|
||||||
// class initialization depending on 32 or 64 bit VM.
|
|
||||||
os::Aix::min_stack_allowed = MAX2(os::Aix::min_stack_allowed,
|
|
||||||
JavaThread::stack_guard_zone_size() +
|
|
||||||
JavaThread::stack_shadow_zone_size() +
|
|
||||||
(4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
|
|
||||||
|
|
||||||
os::Aix::min_stack_allowed = align_size_up(os::Aix::min_stack_allowed, os::vm_page_size());
|
|
||||||
|
|
||||||
size_t threadStackSizeInBytes = ThreadStackSize * K;
|
|
||||||
if (threadStackSizeInBytes != 0 &&
|
|
||||||
threadStackSizeInBytes < os::Aix::min_stack_allowed) {
|
|
||||||
tty->print_cr("\nThe stack size specified is too small, "
|
|
||||||
"Specify at least %dk",
|
|
||||||
os::Aix::min_stack_allowed / K);
|
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the stack size a multiple of the page size so that
|
|
||||||
// the yellow/red zones can be guarded.
|
|
||||||
// Note that this can be 0, if no default stacksize was set.
|
|
||||||
JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, vm_page_size()));
|
|
||||||
|
|
||||||
if (UseNUMA) {
|
if (UseNUMA) {
|
||||||
UseNUMA = false;
|
UseNUMA = false;
|
||||||
warning("NUMA optimizations are not available on this OS.");
|
warning("NUMA optimizations are not available on this OS.");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2013, 2016 SAP SE. All rights reserved.
|
* Copyright (c) 2013, 2016 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -140,14 +140,6 @@ class Aix {
|
|||||||
// libpthread version string
|
// libpthread version string
|
||||||
static void libpthread_init();
|
static void libpthread_init();
|
||||||
|
|
||||||
// Minimum stack size a thread can be created with (allowing
|
|
||||||
// the VM to completely create the thread and enter user code)
|
|
||||||
static size_t min_stack_allowed;
|
|
||||||
|
|
||||||
// Return default stack size or guard size for the specified thread type
|
|
||||||
static size_t default_stack_size(os::ThreadType thr_type);
|
|
||||||
static size_t default_guard_size(os::ThreadType thr_type);
|
|
||||||
|
|
||||||
// Function returns true if we run on OS/400 (pase), false if we run
|
// Function returns true if we run on OS/400 (pase), false if we run
|
||||||
// on AIX.
|
// on AIX.
|
||||||
static bool on_pase() {
|
static bool on_pase() {
|
||||||
|
@ -734,7 +734,8 @@ static void *thread_native_entry(Thread *thread) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
|
bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||||
|
size_t req_stack_size) {
|
||||||
assert(thread->osthread() == NULL, "caller responsible");
|
assert(thread->osthread() == NULL, "caller responsible");
|
||||||
|
|
||||||
// Allocate the OSThread object
|
// Allocate the OSThread object
|
||||||
@ -757,32 +758,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
|
|||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
|
|
||||||
// calculate stack size if it's not specified by caller
|
// calculate stack size if it's not specified by caller
|
||||||
if (stack_size == 0) {
|
size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size);
|
||||||
stack_size = os::Bsd::default_stack_size(thr_type);
|
|
||||||
|
|
||||||
switch (thr_type) {
|
|
||||||
case os::java_thread:
|
|
||||||
// Java threads use ThreadStackSize which default value can be
|
|
||||||
// changed with the flag -Xss
|
|
||||||
assert(JavaThread::stack_size_at_create() > 0, "this should be set");
|
|
||||||
stack_size = JavaThread::stack_size_at_create();
|
|
||||||
break;
|
|
||||||
case os::compiler_thread:
|
|
||||||
if (CompilerThreadStackSize > 0) {
|
|
||||||
stack_size = (size_t)(CompilerThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
} // else fall through:
|
|
||||||
// use VMThreadStackSize if CompilerThreadStackSize is not defined
|
|
||||||
case os::vm_thread:
|
|
||||||
case os::pgc_thread:
|
|
||||||
case os::cgc_thread:
|
|
||||||
case os::watcher_thread:
|
|
||||||
if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stack_size = MAX2(stack_size, os::Bsd::min_stack_allowed);
|
|
||||||
pthread_attr_setstacksize(&attr, stack_size);
|
pthread_attr_setstacksize(&attr, stack_size);
|
||||||
|
|
||||||
ThreadState state;
|
ThreadState state;
|
||||||
@ -3502,32 +3478,11 @@ jint os::init_2(void) {
|
|||||||
Bsd::signal_sets_init();
|
Bsd::signal_sets_init();
|
||||||
Bsd::install_signal_handlers();
|
Bsd::install_signal_handlers();
|
||||||
|
|
||||||
// Check minimum allowable stack size for thread creation and to initialize
|
// Check and sets minimum stack sizes against command line options
|
||||||
// the java system classes, including StackOverflowError - depends on page
|
if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
|
||||||
// size. Add two 4K pages for compiler2 recursion in main thread.
|
|
||||||
// Add in 4*BytesPerWord 4K pages to account for VM stack during
|
|
||||||
// class initialization depending on 32 or 64 bit VM.
|
|
||||||
os::Bsd::min_stack_allowed = MAX2(os::Bsd::min_stack_allowed,
|
|
||||||
JavaThread::stack_guard_zone_size() +
|
|
||||||
JavaThread::stack_shadow_zone_size() +
|
|
||||||
(4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
|
|
||||||
|
|
||||||
os::Bsd::min_stack_allowed = align_size_up(os::Bsd::min_stack_allowed, os::vm_page_size());
|
|
||||||
|
|
||||||
size_t threadStackSizeInBytes = ThreadStackSize * K;
|
|
||||||
if (threadStackSizeInBytes != 0 &&
|
|
||||||
threadStackSizeInBytes < os::Bsd::min_stack_allowed) {
|
|
||||||
tty->print_cr("\nThe stack size specified is too small, "
|
|
||||||
"Specify at least %dk",
|
|
||||||
os::Bsd::min_stack_allowed/ K);
|
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the stack size a multiple of the page size so that
|
|
||||||
// the yellow/red zones can be guarded.
|
|
||||||
JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes,
|
|
||||||
vm_page_size()));
|
|
||||||
|
|
||||||
if (MaxFDLimit) {
|
if (MaxFDLimit) {
|
||||||
// set the number of file descriptors to max. print out error
|
// set the number of file descriptors to max. print out error
|
||||||
// if getrlimit/setrlimit fails but continue regardless.
|
// if getrlimit/setrlimit fails but continue regardless.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -120,14 +120,6 @@ class Bsd {
|
|||||||
static struct sigaction *get_chained_signal_action(int sig);
|
static struct sigaction *get_chained_signal_action(int sig);
|
||||||
static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
|
static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
|
||||||
|
|
||||||
// Minimum stack size a thread can be created with (allowing
|
|
||||||
// the VM to completely create the thread and enter user code)
|
|
||||||
static size_t min_stack_allowed;
|
|
||||||
|
|
||||||
// Return default stack size or guard size for the specified thread type
|
|
||||||
static size_t default_stack_size(os::ThreadType thr_type);
|
|
||||||
static size_t default_guard_size(os::ThreadType thr_type);
|
|
||||||
|
|
||||||
// Real-time clock functions
|
// Real-time clock functions
|
||||||
static void clock_init(void);
|
static void clock_init(void);
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ static void *thread_native_entry(Thread *thread) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool os::create_thread(Thread* thread, ThreadType thr_type,
|
bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||||
size_t stack_size) {
|
size_t req_stack_size) {
|
||||||
assert(thread->osthread() == NULL, "caller responsible");
|
assert(thread->osthread() == NULL, "caller responsible");
|
||||||
|
|
||||||
// Allocate the OSThread object
|
// Allocate the OSThread object
|
||||||
@ -723,34 +723,8 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
|||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
|
|
||||||
// stack size
|
|
||||||
// calculate stack size if it's not specified by caller
|
// calculate stack size if it's not specified by caller
|
||||||
if (stack_size == 0) {
|
size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size);
|
||||||
stack_size = os::Linux::default_stack_size(thr_type);
|
|
||||||
|
|
||||||
switch (thr_type) {
|
|
||||||
case os::java_thread:
|
|
||||||
// Java threads use ThreadStackSize which default value can be
|
|
||||||
// changed with the flag -Xss
|
|
||||||
assert(JavaThread::stack_size_at_create() > 0, "this should be set");
|
|
||||||
stack_size = JavaThread::stack_size_at_create();
|
|
||||||
break;
|
|
||||||
case os::compiler_thread:
|
|
||||||
if (CompilerThreadStackSize > 0) {
|
|
||||||
stack_size = (size_t)(CompilerThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
} // else fall through:
|
|
||||||
// use VMThreadStackSize if CompilerThreadStackSize is not defined
|
|
||||||
case os::vm_thread:
|
|
||||||
case os::pgc_thread:
|
|
||||||
case os::cgc_thread:
|
|
||||||
case os::watcher_thread:
|
|
||||||
if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stack_size = MAX2(stack_size, os::Linux::min_stack_allowed);
|
|
||||||
pthread_attr_setstacksize(&attr, stack_size);
|
pthread_attr_setstacksize(&attr, stack_size);
|
||||||
|
|
||||||
// glibc guard page
|
// glibc guard page
|
||||||
@ -956,10 +930,9 @@ static bool find_vma(address addr, address* vma_low, address* vma_high) {
|
|||||||
// bogus value for initial thread.
|
// bogus value for initial thread.
|
||||||
void os::Linux::capture_initial_stack(size_t max_size) {
|
void os::Linux::capture_initial_stack(size_t max_size) {
|
||||||
// stack size is the easy part, get it from RLIMIT_STACK
|
// stack size is the easy part, get it from RLIMIT_STACK
|
||||||
size_t stack_size;
|
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
getrlimit(RLIMIT_STACK, &rlim);
|
getrlimit(RLIMIT_STACK, &rlim);
|
||||||
stack_size = rlim.rlim_cur;
|
size_t stack_size = rlim.rlim_cur;
|
||||||
|
|
||||||
// 6308388: a bug in ld.so will relocate its own .data section to the
|
// 6308388: a bug in ld.so will relocate its own .data section to the
|
||||||
// lower end of primordial stack; reduce ulimit -s value a little bit
|
// lower end of primordial stack; reduce ulimit -s value a little bit
|
||||||
@ -4793,32 +4766,10 @@ jint os::init_2(void) {
|
|||||||
Linux::signal_sets_init();
|
Linux::signal_sets_init();
|
||||||
Linux::install_signal_handlers();
|
Linux::install_signal_handlers();
|
||||||
|
|
||||||
// Check minimum allowable stack size for thread creation and to initialize
|
// Check and sets minimum stack sizes against command line options
|
||||||
// the java system classes, including StackOverflowError - depends on page
|
if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
|
||||||
// size. Add two 4K pages for compiler2 recursion in main thread.
|
|
||||||
// Add in 4*BytesPerWord 4K pages to account for VM stack during
|
|
||||||
// class initialization depending on 32 or 64 bit VM.
|
|
||||||
os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
|
|
||||||
JavaThread::stack_guard_zone_size() +
|
|
||||||
JavaThread::stack_shadow_zone_size() +
|
|
||||||
(4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
|
|
||||||
|
|
||||||
os::Linux::min_stack_allowed = align_size_up(os::Linux::min_stack_allowed, os::vm_page_size());
|
|
||||||
|
|
||||||
size_t threadStackSizeInBytes = ThreadStackSize * K;
|
|
||||||
if (threadStackSizeInBytes != 0 &&
|
|
||||||
threadStackSizeInBytes < os::Linux::min_stack_allowed) {
|
|
||||||
tty->print_cr("\nThe stack size specified is too small, "
|
|
||||||
"Specify at least " SIZE_FORMAT "k",
|
|
||||||
os::Linux::min_stack_allowed/ K);
|
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the stack size a multiple of the page size so that
|
|
||||||
// the yellow/red zones can be guarded.
|
|
||||||
JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes,
|
|
||||||
vm_page_size()));
|
|
||||||
|
|
||||||
Linux::capture_initial_stack(JavaThread::stack_size_at_create());
|
Linux::capture_initial_stack(JavaThread::stack_size_at_create());
|
||||||
|
|
||||||
#if defined(IA32)
|
#if defined(IA32)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -170,12 +170,8 @@ class Linux {
|
|||||||
static void libpthread_init();
|
static void libpthread_init();
|
||||||
static bool libnuma_init();
|
static bool libnuma_init();
|
||||||
static void* libnuma_dlsym(void* handle, const char* name);
|
static void* libnuma_dlsym(void* handle, const char* name);
|
||||||
// Minimum stack size a thread can be created with (allowing
|
|
||||||
// the VM to completely create the thread and enter user code)
|
|
||||||
static size_t min_stack_allowed;
|
|
||||||
|
|
||||||
// Return default stack size or guard size for the specified thread type
|
// Return default guard size for the specified thread type
|
||||||
static size_t default_stack_size(os::ThreadType thr_type);
|
|
||||||
static size_t default_guard_size(os::ThreadType thr_type);
|
static size_t default_guard_size(os::ThreadType thr_type);
|
||||||
|
|
||||||
static void capture_initial_stack(size_t max_size);
|
static void capture_initial_stack(size_t max_size);
|
||||||
|
@ -1099,6 +1099,123 @@ char* os::Posix::describe_pthread_attr(char* buf, size_t buflen, const pthread_a
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check minimum allowable stack sizes for thread creation and to initialize
|
||||||
|
// the java system classes, including StackOverflowError - depends on page
|
||||||
|
// size. Add two 4K pages for compiler2 recursion in main thread.
|
||||||
|
// Add in 4*BytesPerWord 4K pages to account for VM stack during
|
||||||
|
// class initialization depending on 32 or 64 bit VM.
|
||||||
|
jint os::Posix::set_minimum_stack_sizes() {
|
||||||
|
_java_thread_min_stack_allowed = MAX2(_java_thread_min_stack_allowed,
|
||||||
|
JavaThread::stack_guard_zone_size() +
|
||||||
|
JavaThread::stack_shadow_zone_size() +
|
||||||
|
(4 * BytesPerWord COMPILER2_PRESENT(+ 2)) * 4 * K);
|
||||||
|
|
||||||
|
_java_thread_min_stack_allowed = align_size_up(_java_thread_min_stack_allowed, vm_page_size());
|
||||||
|
|
||||||
|
size_t stack_size_in_bytes = ThreadStackSize * K;
|
||||||
|
if (stack_size_in_bytes != 0 &&
|
||||||
|
stack_size_in_bytes < _java_thread_min_stack_allowed) {
|
||||||
|
// The '-Xss' and '-XX:ThreadStackSize=N' options both set
|
||||||
|
// ThreadStackSize so we go with "Java thread stack size" instead
|
||||||
|
// of "ThreadStackSize" to be more friendly.
|
||||||
|
tty->print_cr("\nThe Java thread stack size specified is too small. "
|
||||||
|
"Specify at least " SIZE_FORMAT "k",
|
||||||
|
_java_thread_min_stack_allowed / K);
|
||||||
|
return JNI_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SOLARIS
|
||||||
|
// For 64kbps there will be a 64kb page size, which makes
|
||||||
|
// the usable default stack size quite a bit less. Increase the
|
||||||
|
// stack for 64kb (or any > than 8kb) pages, this increases
|
||||||
|
// virtual memory fragmentation (since we're not creating the
|
||||||
|
// stack on a power of 2 boundary. The real fix for this
|
||||||
|
// should be to fix the guard page mechanism.
|
||||||
|
|
||||||
|
if (vm_page_size() > 8*K) {
|
||||||
|
stack_size_in_bytes = (stack_size_in_bytes != 0)
|
||||||
|
? stack_size_in_bytes +
|
||||||
|
JavaThread::stack_red_zone_size() +
|
||||||
|
JavaThread::stack_yellow_zone_size()
|
||||||
|
: 0;
|
||||||
|
ThreadStackSize = stack_size_in_bytes/K;
|
||||||
|
}
|
||||||
|
#endif // SOLARIS
|
||||||
|
|
||||||
|
// Make the stack size a multiple of the page size so that
|
||||||
|
// the yellow/red zones can be guarded.
|
||||||
|
JavaThread::set_stack_size_at_create(round_to(stack_size_in_bytes,
|
||||||
|
vm_page_size()));
|
||||||
|
|
||||||
|
_compiler_thread_min_stack_allowed = align_size_up(_compiler_thread_min_stack_allowed, vm_page_size());
|
||||||
|
|
||||||
|
stack_size_in_bytes = CompilerThreadStackSize * K;
|
||||||
|
if (stack_size_in_bytes != 0 &&
|
||||||
|
stack_size_in_bytes < _compiler_thread_min_stack_allowed) {
|
||||||
|
tty->print_cr("\nThe CompilerThreadStackSize specified is too small. "
|
||||||
|
"Specify at least " SIZE_FORMAT "k",
|
||||||
|
_compiler_thread_min_stack_allowed / K);
|
||||||
|
return JNI_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vm_internal_thread_min_stack_allowed = align_size_up(_vm_internal_thread_min_stack_allowed, vm_page_size());
|
||||||
|
|
||||||
|
stack_size_in_bytes = VMThreadStackSize * K;
|
||||||
|
if (stack_size_in_bytes != 0 &&
|
||||||
|
stack_size_in_bytes < _vm_internal_thread_min_stack_allowed) {
|
||||||
|
tty->print_cr("\nThe VMThreadStackSize specified is too small. "
|
||||||
|
"Specify at least " SIZE_FORMAT "k",
|
||||||
|
_vm_internal_thread_min_stack_allowed / K);
|
||||||
|
return JNI_ERR;
|
||||||
|
}
|
||||||
|
return JNI_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when creating the thread. The minimum stack sizes have already been calculated
|
||||||
|
size_t os::Posix::get_initial_stack_size(ThreadType thr_type, size_t req_stack_size) {
|
||||||
|
size_t stack_size;
|
||||||
|
if (req_stack_size == 0) {
|
||||||
|
stack_size = default_stack_size(thr_type);
|
||||||
|
} else {
|
||||||
|
stack_size = req_stack_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (thr_type) {
|
||||||
|
case os::java_thread:
|
||||||
|
// Java threads use ThreadStackSize which default value can be
|
||||||
|
// changed with the flag -Xss
|
||||||
|
if (req_stack_size == 0 && JavaThread::stack_size_at_create() > 0) {
|
||||||
|
// no requested size and we have a more specific default value
|
||||||
|
stack_size = JavaThread::stack_size_at_create();
|
||||||
|
}
|
||||||
|
stack_size = MAX2(stack_size,
|
||||||
|
_java_thread_min_stack_allowed);
|
||||||
|
break;
|
||||||
|
case os::compiler_thread:
|
||||||
|
if (req_stack_size == 0 && CompilerThreadStackSize > 0) {
|
||||||
|
// no requested size and we have a more specific default value
|
||||||
|
stack_size = (size_t)(CompilerThreadStackSize * K);
|
||||||
|
}
|
||||||
|
stack_size = MAX2(stack_size,
|
||||||
|
_compiler_thread_min_stack_allowed);
|
||||||
|
break;
|
||||||
|
case os::vm_thread:
|
||||||
|
case os::pgc_thread:
|
||||||
|
case os::cgc_thread:
|
||||||
|
case os::watcher_thread:
|
||||||
|
default: // presume the unknown thr_type is a VM internal
|
||||||
|
if (req_stack_size == 0 && VMThreadStackSize > 0) {
|
||||||
|
// no requested size and we have a more specific default value
|
||||||
|
stack_size = (size_t)(VMThreadStackSize * K);
|
||||||
|
}
|
||||||
|
|
||||||
|
stack_size = MAX2(stack_size,
|
||||||
|
_vm_internal_thread_min_stack_allowed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stack_size;
|
||||||
|
}
|
||||||
|
|
||||||
os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() {
|
os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() {
|
||||||
assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread");
|
assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -42,7 +42,18 @@ protected:
|
|||||||
static void print_libversion_info(outputStream* st);
|
static void print_libversion_info(outputStream* st);
|
||||||
static void print_load_average(outputStream* st);
|
static void print_load_average(outputStream* st);
|
||||||
|
|
||||||
|
// Minimum stack size a thread can be created with (allowing
|
||||||
|
// the VM to completely create the thread and enter user code)
|
||||||
|
static size_t _compiler_thread_min_stack_allowed;
|
||||||
|
static size_t _java_thread_min_stack_allowed;
|
||||||
|
static size_t _vm_internal_thread_min_stack_allowed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Return default stack size for the specified thread type
|
||||||
|
static size_t default_stack_size(os::ThreadType thr_type);
|
||||||
|
// Check and sets minimum stack sizes
|
||||||
|
static jint set_minimum_stack_sizes();
|
||||||
|
static size_t get_initial_stack_size(ThreadType thr_type, size_t req_stack_size);
|
||||||
|
|
||||||
// Returns true if signal is valid.
|
// Returns true if signal is valid.
|
||||||
static bool is_valid_signal(int sig);
|
static bool is_valid_signal(int sig);
|
||||||
|
@ -917,8 +917,15 @@ static char* describe_thr_create_attributes(char* buf, size_t buflen,
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return default stack size for thr_type
|
||||||
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
|
// default stack size when not specified by caller is 1M (2M for LP64)
|
||||||
|
size_t s = (BytesPerWord >> 2) * K * K;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
bool os::create_thread(Thread* thread, ThreadType thr_type,
|
bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||||
size_t stack_size) {
|
size_t req_stack_size) {
|
||||||
// Allocate the OSThread object
|
// Allocate the OSThread object
|
||||||
OSThread* osthread = new OSThread(NULL, NULL);
|
OSThread* osthread = new OSThread(NULL, NULL);
|
||||||
if (osthread == NULL) {
|
if (osthread == NULL) {
|
||||||
@ -953,31 +960,8 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
|||||||
tty->print_cr("In create_thread, creating a %s thread\n", thrtyp);
|
tty->print_cr("In create_thread, creating a %s thread\n", thrtyp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate stack size if it's not specified by caller.
|
// calculate stack size if it's not specified by caller
|
||||||
if (stack_size == 0) {
|
size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size);
|
||||||
// The default stack size 1M (2M for LP64).
|
|
||||||
stack_size = (BytesPerWord >> 2) * K * K;
|
|
||||||
|
|
||||||
switch (thr_type) {
|
|
||||||
case os::java_thread:
|
|
||||||
// Java threads use ThreadStackSize which default value can be changed with the flag -Xss
|
|
||||||
if (JavaThread::stack_size_at_create() > 0) stack_size = JavaThread::stack_size_at_create();
|
|
||||||
break;
|
|
||||||
case os::compiler_thread:
|
|
||||||
if (CompilerThreadStackSize > 0) {
|
|
||||||
stack_size = (size_t)(CompilerThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
} // else fall through:
|
|
||||||
// use VMThreadStackSize if CompilerThreadStackSize is not defined
|
|
||||||
case os::vm_thread:
|
|
||||||
case os::pgc_thread:
|
|
||||||
case os::cgc_thread:
|
|
||||||
case os::watcher_thread:
|
|
||||||
if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stack_size = MAX2(stack_size, os::Solaris::min_stack_allowed);
|
|
||||||
|
|
||||||
// Initial state is ALLOCATED but not INITIALIZED
|
// Initial state is ALLOCATED but not INITIALIZED
|
||||||
osthread->set_state(ALLOCATED);
|
osthread->set_state(ALLOCATED);
|
||||||
@ -4400,7 +4384,12 @@ void os::init(void) {
|
|||||||
// Constant minimum stack size allowed. It must be at least
|
// Constant minimum stack size allowed. It must be at least
|
||||||
// the minimum of what the OS supports (thr_min_stack()), and
|
// the minimum of what the OS supports (thr_min_stack()), and
|
||||||
// enough to allow the thread to get to user bytecode execution.
|
// enough to allow the thread to get to user bytecode execution.
|
||||||
Solaris::min_stack_allowed = MAX2(thr_min_stack(), Solaris::min_stack_allowed);
|
Posix::_compiler_thread_min_stack_allowed = MAX2(thr_min_stack(),
|
||||||
|
Posix::_compiler_thread_min_stack_allowed);
|
||||||
|
Posix::_java_thread_min_stack_allowed = MAX2(thr_min_stack(),
|
||||||
|
Posix::_java_thread_min_stack_allowed);
|
||||||
|
Posix::_vm_internal_thread_min_stack_allowed = MAX2(thr_min_stack(),
|
||||||
|
Posix::_vm_internal_thread_min_stack_allowed);
|
||||||
|
|
||||||
// dynamic lookup of functions that may not be available in our lowest
|
// dynamic lookup of functions that may not be available in our lowest
|
||||||
// supported Solaris release
|
// supported Solaris release
|
||||||
@ -4445,47 +4434,11 @@ jint os::init_2(void) {
|
|||||||
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
|
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check minimum allowable stack size for thread creation and to initialize
|
// Check and sets minimum stack sizes against command line options
|
||||||
// the java system classes, including StackOverflowError - depends on page
|
if (Posix::set_minimum_stack_sizes() == JNI_ERR) {
|
||||||
// size. Add two 4K pages for compiler2 recursion in main thread.
|
|
||||||
// Add in 4*BytesPerWord 4K pages to account for VM stack during
|
|
||||||
// class initialization depending on 32 or 64 bit VM.
|
|
||||||
os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
|
|
||||||
JavaThread::stack_guard_zone_size() +
|
|
||||||
JavaThread::stack_shadow_zone_size() +
|
|
||||||
(4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
|
|
||||||
|
|
||||||
os::Solaris::min_stack_allowed = align_size_up(os::Solaris::min_stack_allowed, os::vm_page_size());
|
|
||||||
|
|
||||||
size_t threadStackSizeInBytes = ThreadStackSize * K;
|
|
||||||
if (threadStackSizeInBytes != 0 &&
|
|
||||||
threadStackSizeInBytes < os::Solaris::min_stack_allowed) {
|
|
||||||
tty->print_cr("\nThe stack size specified is too small, Specify at least %dk",
|
|
||||||
os::Solaris::min_stack_allowed/K);
|
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For 64kbps there will be a 64kb page size, which makes
|
|
||||||
// the usable default stack size quite a bit less. Increase the
|
|
||||||
// stack for 64kb (or any > than 8kb) pages, this increases
|
|
||||||
// virtual memory fragmentation (since we're not creating the
|
|
||||||
// stack on a power of 2 boundary. The real fix for this
|
|
||||||
// should be to fix the guard page mechanism.
|
|
||||||
|
|
||||||
if (vm_page_size() > 8*K) {
|
|
||||||
threadStackSizeInBytes = (threadStackSizeInBytes != 0)
|
|
||||||
? threadStackSizeInBytes +
|
|
||||||
JavaThread::stack_red_zone_size() +
|
|
||||||
JavaThread::stack_yellow_zone_size()
|
|
||||||
: 0;
|
|
||||||
ThreadStackSize = threadStackSizeInBytes/K;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make the stack size a multiple of the page size so that
|
|
||||||
// the yellow/red zones can be guarded.
|
|
||||||
JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes,
|
|
||||||
vm_page_size()));
|
|
||||||
|
|
||||||
Solaris::libthread_init();
|
Solaris::libthread_init();
|
||||||
|
|
||||||
if (UseNUMA) {
|
if (UseNUMA) {
|
||||||
|
@ -292,10 +292,6 @@ class Solaris {
|
|||||||
static jint _os_thread_limit;
|
static jint _os_thread_limit;
|
||||||
static volatile jint _os_thread_count;
|
static volatile jint _os_thread_count;
|
||||||
|
|
||||||
// Minimum stack size a thread can be created with (allowing
|
|
||||||
// the VM to completely create the thread and enter user code)
|
|
||||||
|
|
||||||
static size_t min_stack_allowed;
|
|
||||||
|
|
||||||
// Stack overflow handling
|
// Stack overflow handling
|
||||||
|
|
||||||
|
@ -4215,7 +4215,7 @@ jint os::init_2(void) {
|
|||||||
min_stack_allowed = align_size_up(min_stack_allowed, os::vm_page_size());
|
min_stack_allowed = align_size_up(min_stack_allowed, os::vm_page_size());
|
||||||
|
|
||||||
if (actual_reserve_size < min_stack_allowed) {
|
if (actual_reserve_size < min_stack_allowed) {
|
||||||
tty->print_cr("\nThe stack size specified is too small, "
|
tty->print_cr("\nThe Java thread stack size specified is too small. "
|
||||||
"Specify at least %dk",
|
"Specify at least %dk",
|
||||||
min_stack_allowed / K);
|
min_stack_allowed / K);
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -33,10 +33,6 @@ define_pd_global(bool, DontYieldALot, false);
|
|||||||
define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default
|
define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default
|
||||||
define_pd_global(intx, VMThreadStackSize, 2048);
|
define_pd_global(intx, VMThreadStackSize, 2048);
|
||||||
|
|
||||||
// if we set CompilerThreadStackSize to a value different than 0, it will
|
|
||||||
// be used in os::create_thread(). Otherwise, due the strange logic in os::create_thread(),
|
|
||||||
// the stack size for compiler threads will default to VMThreadStackSize, although it
|
|
||||||
// is defined to 4M in os::Aix::default_stack_size()!
|
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 4096);
|
define_pd_global(intx, CompilerThreadStackSize, 4096);
|
||||||
|
|
||||||
// Allow extra space in DEBUG builds for asserts.
|
// Allow extra space in DEBUG builds for asserts.
|
||||||
|
@ -533,23 +533,17 @@ void os::Aix::init_thread_fpu_state(void) {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
size_t os::Aix::min_stack_allowed = 128*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
|
||||||
|
|
||||||
// return default stack size for thr_type
|
// return default stack size for thr_type
|
||||||
size_t os::Aix::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
// default stack size (compiler thread needs larger stack)
|
// default stack size (compiler thread needs larger stack)
|
||||||
// Notice that the setting for compiler threads here have no impact
|
|
||||||
// because of the strange 'fallback logic' in os::create_thread().
|
|
||||||
// Better set CompilerThreadStackSize in globals_<os_cpu>.hpp if you want to
|
|
||||||
// specify a different stack size for compiler threads!
|
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t os::Aix::default_guard_size(os::ThreadType thr_type) {
|
|
||||||
return 2 * page_size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// helper functions for fatal error handler
|
// helper functions for fatal error handler
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,9 +31,11 @@
|
|||||||
//
|
//
|
||||||
define_pd_global(bool, DontYieldALot, false);
|
define_pd_global(bool, DontYieldALot, false);
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 1024);
|
||||||
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
||||||
define_pd_global(intx, VMThreadStackSize, 1024);
|
define_pd_global(intx, VMThreadStackSize, 1024);
|
||||||
#else
|
#else
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 512);
|
||||||
// ThreadStackSize 320 allows a couple of test cases to run while
|
// ThreadStackSize 320 allows a couple of test cases to run while
|
||||||
// keeping the number of threads that can be created high. System
|
// keeping the number of threads that can be created high. System
|
||||||
// default ThreadStackSize appears to be 512 which is too big.
|
// default ThreadStackSize appears to be 512 which is too big.
|
||||||
@ -41,7 +43,6 @@ define_pd_global(intx, ThreadStackSize, 320);
|
|||||||
define_pd_global(intx, VMThreadStackSize, 512);
|
define_pd_global(intx, VMThreadStackSize, 512);
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
|
||||||
|
|
||||||
define_pd_global(size_t, JVMInvokeMethodSlack, 8192);
|
define_pd_global(size_t, JVMInvokeMethodSlack, 8192);
|
||||||
|
|
||||||
|
@ -838,9 +838,13 @@ bool os::is_allocatable(size_t bytes) {
|
|||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
size_t os::Bsd::min_stack_allowed = 64 * K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
|
||||||
#else
|
#else
|
||||||
size_t os::Bsd::min_stack_allowed = (48 DEBUG_ONLY(+4))*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
|
#define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
|
||||||
@ -849,7 +853,7 @@ size_t os::Bsd::min_stack_allowed = (48 DEBUG_ONLY(+4))*K;
|
|||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
// return default stack size for thr_type
|
// return default stack size for thr_type
|
||||||
size_t os::Bsd::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
// default stack size (compiler thread needs larger stack)
|
// default stack size (compiler thread needs larger stack)
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
@ -859,11 +863,6 @@ size_t os::Bsd::default_stack_size(os::ThreadType thr_type) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t os::Bsd::default_guard_size(os::ThreadType thr_type) {
|
|
||||||
// Creating guard page is very expensive. Java thread has HotSpot
|
|
||||||
// guard page, only enable glibc guard page for non-Java threads.
|
|
||||||
return (thr_type == java_thread ? 0 : page_size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Java thread:
|
// Java thread:
|
||||||
//
|
//
|
||||||
|
@ -282,9 +282,11 @@ bool os::is_allocatable(size_t bytes) {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
size_t os::Bsd::min_stack_allowed = 64 * K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
|
||||||
|
|
||||||
size_t os::Bsd::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
#else
|
#else
|
||||||
@ -293,12 +295,6 @@ size_t os::Bsd::default_stack_size(os::ThreadType thr_type) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t os::Bsd::default_guard_size(os::ThreadType thr_type) {
|
|
||||||
// Only enable glibc guard pages for non-Java threads
|
|
||||||
// (Java threads have HotSpot guard pages)
|
|
||||||
return (thr_type == java_thread ? 0 : page_size());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void current_stack_region(address *bottom, size_t *size) {
|
static void current_stack_region(address *bottom, size_t *size) {
|
||||||
address stack_bottom;
|
address stack_bottom;
|
||||||
address stack_top;
|
address stack_top;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -33,7 +33,7 @@ define_pd_global(bool, DontYieldALot, false);
|
|||||||
define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default
|
define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default
|
||||||
define_pd_global(intx, VMThreadStackSize, 2048);
|
define_pd_global(intx, VMThreadStackSize, 2048);
|
||||||
|
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
define_pd_global(intx, CompilerThreadStackSize, 2048);
|
||||||
|
|
||||||
define_pd_global(uintx,JVMInvokeMethodSlack, 8192);
|
define_pd_global(uintx,JVMInvokeMethodSlack, 8192);
|
||||||
|
|
||||||
|
@ -473,10 +473,12 @@ bool os::is_allocatable(size_t bytes) {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
size_t os::Linux::min_stack_allowed = 64 * K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
|
||||||
|
|
||||||
// return default stack size for thr_type
|
// return default stack size for thr_type
|
||||||
size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
// default stack size (compiler thread needs larger stack)
|
// default stack size (compiler thread needs larger stack)
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
return s;
|
return s;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -33,10 +33,6 @@ define_pd_global(bool, DontYieldALot, false);
|
|||||||
define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default
|
define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default
|
||||||
define_pd_global(intx, VMThreadStackSize, 2048);
|
define_pd_global(intx, VMThreadStackSize, 2048);
|
||||||
|
|
||||||
// if we set CompilerThreadStackSize to a value different than 0, it will
|
|
||||||
// be used in os::create_thread(). Otherwise, due the strange logic in os::create_thread(),
|
|
||||||
// the stack size for compiler threads will default to VMThreadStackSize, although it
|
|
||||||
// is defined to 4M in os::Linux::default_stack_size()!
|
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 4096);
|
define_pd_global(intx, CompilerThreadStackSize, 4096);
|
||||||
|
|
||||||
// Allow extra space in DEBUG builds for asserts.
|
// Allow extra space in DEBUG builds for asserts.
|
||||||
|
@ -533,15 +533,13 @@ void os::Linux::set_fpu_control_word(int fpu_control) {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
size_t os::Linux::min_stack_allowed = 128*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
|
||||||
|
|
||||||
// return default stack size for thr_type
|
// return default stack size for thr_type
|
||||||
size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
// default stack size (compiler thread needs larger stack)
|
// default stack size (compiler thread needs larger stack)
|
||||||
// Notice that the setting for compiler threads here have no impact
|
|
||||||
// because of the strange 'fallback logic' in os::create_thread().
|
|
||||||
// Better set CompilerThreadStackSize in globals_<os_cpu>.hpp if you want to
|
|
||||||
// specify a different stack size for compiler threads!
|
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,7 +31,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
define_pd_global(size_t, JVMInvokeMethodSlack, 12288);
|
define_pd_global(size_t, JVMInvokeMethodSlack, 12288);
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
|
||||||
|
|
||||||
// Used on 64 bit platforms for UseCompressedOops base address
|
// Used on 64 bit platforms for UseCompressedOops base address
|
||||||
define_pd_global(size_t, HeapBaseMinAddress, CONST64(4)*G);
|
define_pd_global(size_t, HeapBaseMinAddress, CONST64(4)*G);
|
||||||
|
@ -726,10 +726,12 @@ bool os::is_allocatable(size_t bytes) {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
size_t os::Linux::min_stack_allowed = 128 * K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
|
||||||
|
|
||||||
// return default stack size for thr_type
|
// return default stack size for thr_type
|
||||||
size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
// default stack size (compiler thread needs larger stack)
|
// default stack size (compiler thread needs larger stack)
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
return s;
|
return s;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,9 +30,11 @@
|
|||||||
|
|
||||||
define_pd_global(bool, DontYieldALot, false);
|
define_pd_global(bool, DontYieldALot, false);
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 1024);
|
||||||
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
||||||
define_pd_global(intx, VMThreadStackSize, 1024);
|
define_pd_global(intx, VMThreadStackSize, 1024);
|
||||||
#else
|
#else
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 512);
|
||||||
// ThreadStackSize 320 allows a couple of test cases to run while
|
// ThreadStackSize 320 allows a couple of test cases to run while
|
||||||
// keeping the number of threads that can be created high. System
|
// keeping the number of threads that can be created high. System
|
||||||
// default ThreadStackSize appears to be 512 which is too big.
|
// default ThreadStackSize appears to be 512 which is too big.
|
||||||
@ -40,8 +42,6 @@ define_pd_global(intx, ThreadStackSize, 320);
|
|||||||
define_pd_global(intx, VMThreadStackSize, 512);
|
define_pd_global(intx, VMThreadStackSize, 512);
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
|
||||||
|
|
||||||
define_pd_global(size_t, JVMInvokeMethodSlack, 8192);
|
define_pd_global(size_t, JVMInvokeMethodSlack, 8192);
|
||||||
|
|
||||||
// Used on 64 bit platforms for UseCompressedOops base address
|
// Used on 64 bit platforms for UseCompressedOops base address
|
||||||
|
@ -676,13 +676,17 @@ bool os::is_allocatable(size_t bytes) {
|
|||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
size_t os::Linux::min_stack_allowed = 64 * K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
|
||||||
#else
|
#else
|
||||||
size_t os::Linux::min_stack_allowed = (48 DEBUG_ONLY(+4))*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = (48 DEBUG_ONLY(+ 4)) * K;
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
// return default stack size for thr_type
|
// return default stack size for thr_type
|
||||||
size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
// default stack size (compiler thread needs larger stack)
|
// default stack size (compiler thread needs larger stack)
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
|
@ -307,9 +307,11 @@ bool os::is_allocatable(size_t bytes) {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// thread stack
|
// thread stack
|
||||||
|
|
||||||
size_t os::Linux::min_stack_allowed = 64 * K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
|
||||||
|
|
||||||
size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
|
size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
|
||||||
#else
|
#else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,7 +31,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
define_pd_global(size_t, JVMInvokeMethodSlack, 12288);
|
define_pd_global(size_t, JVMInvokeMethodSlack, 12288);
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
|
||||||
|
|
||||||
// Used on 64 bit platforms for UseCompressedOops base address
|
// Used on 64 bit platforms for UseCompressedOops base address
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
|
@ -84,9 +84,13 @@
|
|||||||
// Minimum stack size for the VM. It's easier to document a constant
|
// Minimum stack size for the VM. It's easier to document a constant
|
||||||
// but it's different for x86 and sparc because the page sizes are different.
|
// but it's different for x86 and sparc because the page sizes are different.
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
size_t os::Solaris::min_stack_allowed = 128*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
|
||||||
#else
|
#else
|
||||||
size_t os::Solaris::min_stack_allowed = 96*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 96 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 96 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 96 * K;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int os::Solaris::max_register_window_saves_before_flushing() {
|
int os::Solaris::max_register_window_saves_before_flushing() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,10 +30,12 @@
|
|||||||
|
|
||||||
define_pd_global(bool, DontYieldALot, true); // Determined in the design center
|
define_pd_global(bool, DontYieldALot, true); // Determined in the design center
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 1024);
|
||||||
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default
|
||||||
define_pd_global(intx, VMThreadStackSize, 1024);
|
define_pd_global(intx, VMThreadStackSize, 1024);
|
||||||
define_pd_global(size_t, JVMInvokeMethodSlack, 8*K);
|
define_pd_global(size_t, JVMInvokeMethodSlack, 8*K);
|
||||||
#else
|
#else
|
||||||
|
define_pd_global(intx, CompilerThreadStackSize, 512);
|
||||||
// ThreadStackSize 320 allows a couple of test cases to run while
|
// ThreadStackSize 320 allows a couple of test cases to run while
|
||||||
// keeping the number of threads that can be created high.
|
// keeping the number of threads that can be created high.
|
||||||
define_pd_global(intx, ThreadStackSize, 320);
|
define_pd_global(intx, ThreadStackSize, 320);
|
||||||
@ -41,7 +43,6 @@ define_pd_global(intx, VMThreadStackSize, 512);
|
|||||||
define_pd_global(size_t, JVMInvokeMethodSlack, 10*K);
|
define_pd_global(size_t, JVMInvokeMethodSlack, 10*K);
|
||||||
#endif // AMD64
|
#endif // AMD64
|
||||||
|
|
||||||
define_pd_global(intx, CompilerThreadStackSize, 0);
|
|
||||||
|
|
||||||
// Used on 64 bit platforms for UseCompressedOops base address
|
// Used on 64 bit platforms for UseCompressedOops base address
|
||||||
define_pd_global(size_t, HeapBaseMinAddress, 2*G);
|
define_pd_global(size_t, HeapBaseMinAddress, 2*G);
|
||||||
|
@ -86,15 +86,19 @@
|
|||||||
|
|
||||||
#define MAX_PATH (2 * K)
|
#define MAX_PATH (2 * K)
|
||||||
|
|
||||||
// Minimum stack size for the VM. It's easier to document a constant value
|
// Minimum stack sizes for the VM. It's easier to document a constant value
|
||||||
// but it's different for x86 and sparc because the page sizes are different.
|
// but it's different for x86 and sparc because the page sizes are different.
|
||||||
#ifdef AMD64
|
#ifdef AMD64
|
||||||
size_t os::Solaris::min_stack_allowed = 224*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 394 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 224 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 224 * K;
|
||||||
#define REG_SP REG_RSP
|
#define REG_SP REG_RSP
|
||||||
#define REG_PC REG_RIP
|
#define REG_PC REG_RIP
|
||||||
#define REG_FP REG_RBP
|
#define REG_FP REG_RBP
|
||||||
#else
|
#else
|
||||||
size_t os::Solaris::min_stack_allowed = 64*K;
|
size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
|
||||||
|
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
|
||||||
#define REG_SP UESP
|
#define REG_SP UESP
|
||||||
#define REG_PC EIP
|
#define REG_PC EIP
|
||||||
#define REG_FP EBP
|
#define REG_FP EBP
|
||||||
|
@ -443,7 +443,7 @@ class os: AllStatic {
|
|||||||
|
|
||||||
static bool create_thread(Thread* thread,
|
static bool create_thread(Thread* thread,
|
||||||
ThreadType thr_type,
|
ThreadType thr_type,
|
||||||
size_t stack_size = 0);
|
size_t req_stack_size = 0);
|
||||||
static bool create_main_thread(JavaThread* thread);
|
static bool create_main_thread(JavaThread* thread);
|
||||||
static bool create_attached_thread(JavaThread* thread);
|
static bool create_attached_thread(JavaThread* thread);
|
||||||
static void pd_start_thread(Thread* thread);
|
static void pd_start_thread(Thread* thread);
|
||||||
|
@ -80,7 +80,7 @@ bool Exceptions::special_exception(Thread* thread, const char* file, int line, H
|
|||||||
if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
|
if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
|
||||||
InstanceKlass* ik = InstanceKlass::cast(h_exception->klass());
|
InstanceKlass* ik = InstanceKlass::cast(h_exception->klass());
|
||||||
assert(ik->is_initialized(),
|
assert(ik->is_initialized(),
|
||||||
"need to increase min_stack_allowed calculation");
|
"need to increase java_thread_min_stack_allowed calculation");
|
||||||
}
|
}
|
||||||
#endif // ASSERT
|
#endif // ASSERT
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file
|
|||||||
Klass* k = SystemDictionary::StackOverflowError_klass();
|
Klass* k = SystemDictionary::StackOverflowError_klass();
|
||||||
oop e = InstanceKlass::cast(k)->allocate_instance(CHECK);
|
oop e = InstanceKlass::cast(k)->allocate_instance(CHECK);
|
||||||
exception = Handle(THREAD, e); // fill_in_stack trace does gc
|
exception = Handle(THREAD, e); // fill_in_stack trace does gc
|
||||||
assert(InstanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation");
|
assert(InstanceKlass::cast(k)->is_initialized(), "need to increase java_thread_min_stack_allowed calculation");
|
||||||
if (StackTraceInThrowable) {
|
if (StackTraceInThrowable) {
|
||||||
java_lang_Throwable::fill_in_stack_trace(exception, method());
|
java_lang_Throwable::fill_in_stack_trace(exception, method());
|
||||||
}
|
}
|
||||||
|
@ -88,20 +88,6 @@ public class TestOptionsWithRanges {
|
|||||||
*/
|
*/
|
||||||
excludeTestMaxRange("CICompilerCount");
|
excludeTestMaxRange("CICompilerCount");
|
||||||
|
|
||||||
/*
|
|
||||||
* JDK-8136766
|
|
||||||
* Temporarily remove ThreadStackSize from testing because Windows can set it to 0
|
|
||||||
* (for default OS size) but other platforms insist it must be greater than 0
|
|
||||||
*/
|
|
||||||
excludeTestRange("ThreadStackSize");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove the flag controlling the size of the stack because the
|
|
||||||
* flag has direct influence on the physical memory usage of
|
|
||||||
* the VM.
|
|
||||||
*/
|
|
||||||
allOptionsAsMap.remove("CompilerThreadStackSize");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0)
|
* Exclude MallocMaxTestWords as it is expected to exit VM at small values (>=0)
|
||||||
*/
|
*/
|
||||||
@ -124,6 +110,8 @@ public class TestOptionsWithRanges {
|
|||||||
excludeTestMaxRange("OldSize");
|
excludeTestMaxRange("OldSize");
|
||||||
excludeTestMaxRange("ParallelGCThreads");
|
excludeTestMaxRange("ParallelGCThreads");
|
||||||
|
|
||||||
|
excludeTestMaxRange("CompilerThreadStackSize");
|
||||||
|
excludeTestMaxRange("ThreadStackSize");
|
||||||
excludeTestMaxRange("VMThreadStackSize");
|
excludeTestMaxRange("VMThreadStackSize");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
198
hotspot/test/runtime/Thread/TooSmallStackSize.java
Normal file
198
hotspot/test/runtime/Thread/TooSmallStackSize.java
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8140520
|
||||||
|
* @summary Setting small CompilerThreadStackSize, ThreadStackSize, and
|
||||||
|
* VMThreadStackSize values should result in an error message that shows
|
||||||
|
* the minimum stack size value for each thread type.
|
||||||
|
* @library /test/lib
|
||||||
|
* @modules java.base/jdk.internal.misc
|
||||||
|
* java.management
|
||||||
|
* @run main TooSmallStackSize
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The primary purpose of this test is to make sure we can run with a
|
||||||
|
* stack smaller than the minimum without crashing. Also this test will
|
||||||
|
* determine the minimum allowed stack size for the platform (as
|
||||||
|
* provided by the JVM error message when a very small stack is used),
|
||||||
|
* and then verify that the JVM can be launched with that stack size
|
||||||
|
* without a crash or any error messages.
|
||||||
|
*
|
||||||
|
* Note: The '-Xss<size>' and '-XX:ThreadStackSize=<k-bytes>' options
|
||||||
|
* both control Java thread stack size. This repo's version of the test
|
||||||
|
* exercises the '-XX:ThreadStackSize' VM option. The jdk repo's version
|
||||||
|
* of the test exercises the '-Xss' option.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
|
||||||
|
public class TooSmallStackSize {
|
||||||
|
/* for debugging. Normally false. */
|
||||||
|
static final boolean verbose = false;
|
||||||
|
static final String CompilerThreadStackSizeString = "CompilerThreadStackSize";
|
||||||
|
static final String ThreadStackSizeString = "Java thread stack size";
|
||||||
|
static final String VMThreadStackSizeString = "VMThreadStackSize";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the minimum stack size this platform will allowed based on the
|
||||||
|
* contents of the error message the JVM outputs when too small of a
|
||||||
|
* stack size was used.
|
||||||
|
*
|
||||||
|
* The testOutput argument must contain the result of having already run
|
||||||
|
* the JVM with too small of a stack size.
|
||||||
|
*/
|
||||||
|
static String getMinStackAllowed(String testOutput) {
|
||||||
|
/*
|
||||||
|
* The JVM output will contain in one of the lines:
|
||||||
|
* "The CompilerThreadStackSize specified is too small. Specify at least 100k"
|
||||||
|
* "The Java thread stack size specified is too small. Specify at least 100k"
|
||||||
|
* "The VMThreadStackSize specified is too small. Specify at least 100k"
|
||||||
|
* Although the actual size will vary. We need to extract this size
|
||||||
|
* string from the output and return it.
|
||||||
|
*/
|
||||||
|
String matchStr = "Specify at least ";
|
||||||
|
int match_idx = testOutput.indexOf(matchStr);
|
||||||
|
if (match_idx >= 0) {
|
||||||
|
int size_start_idx = match_idx + matchStr.length();
|
||||||
|
int k_start_idx = testOutput.indexOf("k", size_start_idx);
|
||||||
|
// don't include the 'k'; the caller will have to
|
||||||
|
// add it back as needed.
|
||||||
|
return testOutput.substring(size_start_idx, k_start_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Expect='" + matchStr + "'");
|
||||||
|
System.out.println("Actual: " + testOutput);
|
||||||
|
System.out.println("FAILED: Could not get the stack size from the output");
|
||||||
|
throw new RuntimeException("test fails");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run the JVM with the specified stack size.
|
||||||
|
*
|
||||||
|
* Returns the minimum allowed stack size gleaned from the error message,
|
||||||
|
* if there is an error message. Otherwise returns the stack size passed in.
|
||||||
|
*/
|
||||||
|
static String checkStack(String stackOption, String optionMesg, String stackSize) throws Exception {
|
||||||
|
String min_stack_allowed;
|
||||||
|
|
||||||
|
System.out.println("*** Testing " + stackOption + stackSize);
|
||||||
|
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
stackOption + stackSize,
|
||||||
|
// Uncomment the following to get log output
|
||||||
|
// that shows actual thread creation sizes.
|
||||||
|
// "-Xlog:os+thread",
|
||||||
|
"-version");
|
||||||
|
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
|
||||||
|
if (verbose) {
|
||||||
|
System.out.println("stdout: " + output.getStdout());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output.getExitValue() == 0) {
|
||||||
|
// checkMinStackAllowed() is called with stackSize values
|
||||||
|
// that should be the minimum that works. This method,
|
||||||
|
// checkStack(), is called with stackSize values that
|
||||||
|
// should be too small and result in error messages.
|
||||||
|
// However, some platforms fix up a stackSize value that is
|
||||||
|
// too small into something that works so we have to allow
|
||||||
|
// for checkStack() calls that work.
|
||||||
|
System.out.println("PASSED: got exit_code == 0 with " + stackOption + stackSize);
|
||||||
|
min_stack_allowed = stackSize;
|
||||||
|
} else {
|
||||||
|
String expect = "The " + optionMesg + " specified is too small";
|
||||||
|
if (verbose) {
|
||||||
|
System.out.println("Expect='" + expect + "'");
|
||||||
|
}
|
||||||
|
output.shouldContain(expect);
|
||||||
|
min_stack_allowed = getMinStackAllowed(output.getStdout());
|
||||||
|
|
||||||
|
System.out.println("PASSED: got expected error message with " + stackOption + stackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return min_stack_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run the JVM with the minimum allowed stack size. This should always succeed.
|
||||||
|
*/
|
||||||
|
static void checkMinStackAllowed(String stackOption, String optionMesg, String stackSize) throws Exception {
|
||||||
|
System.out.println("*** Testing " + stackOption + stackSize);
|
||||||
|
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
stackOption + stackSize,
|
||||||
|
// Uncomment the following to get log output
|
||||||
|
// that shows actual thread creation sizes.
|
||||||
|
// "-Xlog:os+thread",
|
||||||
|
"-version");
|
||||||
|
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
System.out.println("PASSED: VM launched with " + stackOption + stackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
|
/*
|
||||||
|
* The result of a 16k stack size should be a quick exit with a complaint
|
||||||
|
* that the stack size is too small. However, for some win32 builds, the
|
||||||
|
* stack is always at least 64k, and this also sometimes is the minimum
|
||||||
|
* allowed size, so we won't see an error in this case.
|
||||||
|
*
|
||||||
|
* This test case will also produce a crash on some platforms if the fix
|
||||||
|
* for 6762191 is not yet in place.
|
||||||
|
*/
|
||||||
|
checkStack("-XX:ThreadStackSize=", ThreadStackSizeString, "16");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try with a 32k stack size, which is the size that the launcher will
|
||||||
|
* set to if you try setting to anything smaller. This should produce the same
|
||||||
|
* result as setting to 16k if the fix for 6762191 is in place.
|
||||||
|
*/
|
||||||
|
String min_stack_allowed = checkStack("-XX:ThreadStackSize=", ThreadStackSizeString, "32");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try again with a the minimum stack size that was given in the error message
|
||||||
|
*/
|
||||||
|
checkMinStackAllowed("-XX:ThreadStackSize=", ThreadStackSizeString, min_stack_allowed);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now redo the same tests with the compiler thread stack size:
|
||||||
|
*/
|
||||||
|
checkStack("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "16");
|
||||||
|
min_stack_allowed = checkStack("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, "32");
|
||||||
|
checkMinStackAllowed("-XX:CompilerThreadStackSize=", CompilerThreadStackSizeString, min_stack_allowed);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now redo the same tests with the VM thread stack size:
|
||||||
|
*/
|
||||||
|
checkStack("-XX:VMThreadStackSize=", VMThreadStackSizeString, "16");
|
||||||
|
min_stack_allowed = checkStack("-XX:VMThreadStackSize=", VMThreadStackSizeString, "32");
|
||||||
|
checkMinStackAllowed("-XX:VMThreadStackSize=", VMThreadStackSizeString, min_stack_allowed);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user