8263718: unused-result warning happens at os_linux.cpp
Reviewed-by: dholmes, stuefe
This commit is contained in:
parent
787908c778
commit
f1d4ae6cc9
@ -546,16 +546,6 @@ objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NU
|
|||||||
static void *thread_native_entry(Thread *thread) {
|
static void *thread_native_entry(Thread *thread) {
|
||||||
|
|
||||||
thread->record_stack_base_and_size();
|
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
|
|
||||||
// from different JVM instances. The benefit is especially true for
|
|
||||||
// processors with hyperthreading technology.
|
|
||||||
static int counter = 0;
|
|
||||||
int pid = os::current_process_id();
|
|
||||||
alloca(((pid ^ counter++) & 7) * 128);
|
|
||||||
|
|
||||||
thread->initialize_thread_current();
|
thread->initialize_thread_current();
|
||||||
|
|
||||||
OSThread* osthread = thread->osthread();
|
OSThread* osthread = thread->osthread();
|
||||||
|
@ -663,14 +663,20 @@ static void *thread_native_entry(Thread *thread) {
|
|||||||
|
|
||||||
thread->record_stack_base_and_size();
|
thread->record_stack_base_and_size();
|
||||||
|
|
||||||
|
#ifndef __GLIBC__
|
||||||
// Try to randomize the cache line index of hot stack frames.
|
// Try to randomize the cache line index of hot stack frames.
|
||||||
// This helps when threads of the same stack traces evict each other's
|
// 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
|
// cache lines. The threads can be either from the same JVM instance, or
|
||||||
// from different JVM instances. The benefit is especially true for
|
// from different JVM instances. The benefit is especially true for
|
||||||
// processors with hyperthreading technology.
|
// processors with hyperthreading technology.
|
||||||
|
// This code is not needed anymore in glibc because it has MULTI_PAGE_ALIASING
|
||||||
|
// and we did not see any degradation in performance without `alloca()`.
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
int pid = os::current_process_id();
|
int pid = os::current_process_id();
|
||||||
alloca(((pid ^ counter++) & 7) * 128);
|
void *stackmem = alloca(((pid ^ counter++) & 7) * 128);
|
||||||
|
// Ensure the alloca result is used in a way that prevents the compiler from eliding it.
|
||||||
|
*(char *)stackmem = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
thread->initialize_thread_current();
|
thread->initialize_thread_current();
|
||||||
|
|
||||||
|
@ -519,16 +519,6 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo);
|
|||||||
static unsigned __stdcall thread_native_entry(Thread* thread) {
|
static unsigned __stdcall thread_native_entry(Thread* thread) {
|
||||||
|
|
||||||
thread->record_stack_base_and_size();
|
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
|
|
||||||
// from different JVM instances. The benefit is especially true for
|
|
||||||
// processors with hyperthreading technology.
|
|
||||||
static int counter = 0;
|
|
||||||
int pid = os::current_process_id();
|
|
||||||
_alloca(((pid ^ counter++) & 7) * 128);
|
|
||||||
|
|
||||||
thread->initialize_thread_current();
|
thread->initialize_thread_current();
|
||||||
|
|
||||||
OSThread* osthr = thread->osthread();
|
OSThread* osthr = thread->osthread();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user