mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8212173: Thread._stack_base/_stack_size initialized too late for new threads
Reviewed-by: dholmes, simonis
This commit is contained in:
parent
67d76fe937
commit
e4f51809e4
26 changed files with 146 additions and 184 deletions
|
@ -649,6 +649,9 @@ bool os::Linux::manually_expand_stack(JavaThread * t, address addr) {
|
|||
|
||||
// Thread start routine for all newly created threads
|
||||
static void *thread_native_entry(Thread *thread) {
|
||||
|
||||
thread->record_stack_base_and_size();
|
||||
|
||||
// Try to randomize the cache line index of hot stack frames.
|
||||
// This helps when threads of the same stack traces evict each other's
|
||||
// cache lines. The threads can be either from the same JVM instance, or
|
||||
|
@ -695,20 +698,15 @@ static void *thread_native_entry(Thread *thread) {
|
|||
}
|
||||
|
||||
// call one more level start routine
|
||||
thread->run();
|
||||
thread->call_run();
|
||||
|
||||
// Note: at this point the thread object may already have deleted itself.
|
||||
// Prevent dereferencing it from here on out.
|
||||
thread = NULL;
|
||||
|
||||
log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
|
||||
os::current_thread_id(), (uintx) pthread_self());
|
||||
|
||||
// If a thread has not deleted itself ("delete this") as part of its
|
||||
// termination sequence, we have to ensure thread-local-storage is
|
||||
// cleared before we actually terminate. No threads should ever be
|
||||
// deleted asynchronously with respect to their termination.
|
||||
if (Thread::current_or_null_safe() != NULL) {
|
||||
assert(Thread::current_or_null_safe() == thread, "current thread is wrong");
|
||||
thread->clear_thread_current();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue