mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8263718: unused-result warning happens at os_linux.cpp
Reviewed-by: dholmes, stuefe
This commit is contained in:
parent
787908c778
commit
f1d4ae6cc9
3 changed files with 7 additions and 21 deletions
|
@ -663,14 +663,20 @@ static void *thread_native_entry(Thread *thread) {
|
|||
|
||||
thread->record_stack_base_and_size();
|
||||
|
||||
#ifndef __GLIBC__
|
||||
// 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.
|
||||
// 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;
|
||||
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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue