mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-13 06:59:38 +00:00
8235931: add OM_CACHE_LINE_SIZE and use smaller size on SPARCv9 and X64
Reviewed-by: dholmes, redestad, mdoerr
This commit is contained in:
parent
e7e182a318
commit
b9e3a4efef
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2020, 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
|
||||
@ -42,12 +42,14 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
|
||||
#if defined(TIERED)
|
||||
// tiered, 64-bit, large machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 128
|
||||
#define OM_CACHE_LINE_SIZE 64
|
||||
#elif defined(COMPILER1)
|
||||
// pure C1, 32-bit, small machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 16
|
||||
#elif defined(COMPILER2)
|
||||
// pure C2, 64-bit, large machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 128
|
||||
#define OM_CACHE_LINE_SIZE 64
|
||||
#endif
|
||||
|
||||
#if defined(SOLARIS)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2020, 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
|
||||
@ -40,6 +40,7 @@ const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
#ifdef _LP64
|
||||
// tiered, 64-bit, large machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 128
|
||||
#define OM_CACHE_LINE_SIZE 64
|
||||
#else
|
||||
// tiered, 32-bit, medium machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 64
|
||||
@ -52,6 +53,7 @@ const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
#ifdef _LP64
|
||||
// pure C2, 64-bit, large machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 128
|
||||
#define OM_CACHE_LINE_SIZE 64
|
||||
#else
|
||||
// pure C2, 32-bit, medium machine
|
||||
#define DEFAULT_CACHE_LINE_SIZE 64
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2020, 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
|
||||
@ -120,6 +120,12 @@ class ObjectWaiter : public StackObj {
|
||||
// intptr_t. There's no reason to use a 64-bit type for this field
|
||||
// in a 64-bit JVM.
|
||||
|
||||
#ifndef OM_CACHE_LINE_SIZE
|
||||
// Use DEFAULT_CACHE_LINE_SIZE if not already specified for
|
||||
// the current build platform.
|
||||
#define OM_CACHE_LINE_SIZE DEFAULT_CACHE_LINE_SIZE
|
||||
#endif
|
||||
|
||||
class ObjectMonitor {
|
||||
friend class ObjectSynchronizer;
|
||||
friend class ObjectWaiter;
|
||||
@ -139,7 +145,7 @@ class ObjectMonitor {
|
||||
// _object is a good choice to share the cache line with _header.
|
||||
// _next_om shares _header's cache line for pre-monitor list historical
|
||||
// reasons. _next_om only changes if the next ObjectMonitor is deflated.
|
||||
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE,
|
||||
DEFINE_PAD_MINUS_SIZE(0, OM_CACHE_LINE_SIZE,
|
||||
sizeof(volatile markWord) + sizeof(void* volatile) +
|
||||
sizeof(ObjectMonitor *));
|
||||
void* volatile _owner; // pointer to owning thread OR BasicLock
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2020, 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
|
||||
@ -517,15 +517,15 @@ void ObjectSynchronizer::notifyall(Handle obj, TRAPS) {
|
||||
// performed by the CPU(s) or platform.
|
||||
|
||||
struct SharedGlobals {
|
||||
char _pad_prefix[DEFAULT_CACHE_LINE_SIZE];
|
||||
char _pad_prefix[OM_CACHE_LINE_SIZE];
|
||||
// These are highly shared mostly-read variables.
|
||||
// To avoid false-sharing they need to be the sole occupants of a cache line.
|
||||
volatile int stw_random;
|
||||
volatile int stw_cycle;
|
||||
DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile int) * 2);
|
||||
DEFINE_PAD_MINUS_SIZE(1, OM_CACHE_LINE_SIZE, sizeof(volatile int) * 2);
|
||||
// Hot RW variable -- Sequester to avoid false-sharing
|
||||
volatile int hc_sequence;
|
||||
DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile int));
|
||||
DEFINE_PAD_MINUS_SIZE(2, OM_CACHE_LINE_SIZE, sizeof(volatile int));
|
||||
};
|
||||
|
||||
static SharedGlobals GVars;
|
||||
@ -1082,9 +1082,9 @@ ObjectMonitor* ObjectSynchronizer::om_alloc(Thread* self) {
|
||||
assert(_BLOCKSIZE > 1, "invariant");
|
||||
size_t neededsize = sizeof(PaddedObjectMonitor) * _BLOCKSIZE;
|
||||
PaddedObjectMonitor* temp;
|
||||
size_t aligned_size = neededsize + (DEFAULT_CACHE_LINE_SIZE - 1);
|
||||
size_t aligned_size = neededsize + (OM_CACHE_LINE_SIZE - 1);
|
||||
void* real_malloc_addr = NEW_C_HEAP_ARRAY(char, aligned_size, mtInternal);
|
||||
temp = (PaddedObjectMonitor*)align_up(real_malloc_addr, DEFAULT_CACHE_LINE_SIZE);
|
||||
temp = (PaddedObjectMonitor*)align_up(real_malloc_addr, OM_CACHE_LINE_SIZE);
|
||||
(void)memset((void *) temp, 0, neededsize);
|
||||
|
||||
// Format the block.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2020, 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
|
||||
@ -34,7 +34,13 @@
|
||||
class ObjectMonitor;
|
||||
class ThreadsList;
|
||||
|
||||
typedef PaddedEnd<ObjectMonitor, DEFAULT_CACHE_LINE_SIZE> PaddedObjectMonitor;
|
||||
#ifndef OM_CACHE_LINE_SIZE
|
||||
// Use DEFAULT_CACHE_LINE_SIZE if not already specified for
|
||||
// the current build platform.
|
||||
#define OM_CACHE_LINE_SIZE DEFAULT_CACHE_LINE_SIZE
|
||||
#endif
|
||||
|
||||
typedef PaddedEnd<ObjectMonitor, OM_CACHE_LINE_SIZE> PaddedObjectMonitor;
|
||||
|
||||
struct DeflateMonitorCounters {
|
||||
int n_in_use; // currently associated with objects
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user