8219370: NMT: Move synchronization primitives from mtInternal to mtSynchronizer

Reviewed-by: dholmes, rehn
This commit is contained in:
Zhengyu Gu 2019-02-20 10:22:46 -05:00
parent 2e8fc8328a
commit 2cc6f5951c
8 changed files with 15 additions and 14 deletions

View File

@ -177,7 +177,7 @@ private:
* These event objects are type-stable and immortal - we never delete them.
* Events are associated with a thread for the lifetime of the thread.
*/
class PlatformEvent : public CHeapObj<mtInternal> {
class PlatformEvent : public CHeapObj<mtSynchronizer> {
private:
double cachePad[4]; // Increase odds that _mutex is sole occupant of cache line
volatile int _event; // Event count/permit: -1, 0 or 1
@ -212,7 +212,7 @@ class PlatformEvent : public CHeapObj<mtInternal> {
// API updates of course). But Parker methods use fastpaths that break that
// level of encapsulation - so combining the two remains a future project.
class PlatformParker : public CHeapObj<mtInternal> {
class PlatformParker : public CHeapObj<mtSynchronizer> {
protected:
enum {
REL_INDEX = 0,
@ -230,7 +230,7 @@ class PlatformParker : public CHeapObj<mtInternal> {
};
// Platform specific implementation that underpins VM Monitor/Mutex class
class PlatformMonitor : public CHeapObj<mtInternal> {
class PlatformMonitor : public CHeapObj<mtSynchronizer> {
private:
pthread_mutex_t _mutex; // Native mutex for locking
pthread_cond_t _cond; // Native condition variable for blocking

View File

@ -281,7 +281,7 @@ class Solaris {
};
class PlatformEvent : public CHeapObj<mtInternal> {
class PlatformEvent : public CHeapObj<mtSynchronizer> {
private:
double CachePad[4]; // increase odds that _mutex is sole occupant of cache line
volatile int _Event;
@ -317,7 +317,7 @@ class PlatformEvent : public CHeapObj<mtInternal> {
void unpark();
};
class PlatformParker : public CHeapObj<mtInternal> {
class PlatformParker : public CHeapObj<mtSynchronizer> {
protected:
mutex_t _mutex[1];
cond_t _cond[1];
@ -336,7 +336,7 @@ class PlatformParker : public CHeapObj<mtInternal> {
};
// Platform specific implementation that underpins VM Monitor/Mutex class
class PlatformMonitor : public CHeapObj<mtInternal> {
class PlatformMonitor : public CHeapObj<mtSynchronizer> {
private:
mutex_t _mutex; // Native mutex for locking
cond_t _cond; // Native condition variable for blocking

View File

@ -148,7 +148,7 @@ private:
static volatile intptr_t _crash_mux;
};
class PlatformEvent : public CHeapObj<mtInternal> {
class PlatformEvent : public CHeapObj<mtSynchronizer> {
private:
double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
volatile int _Event ;
@ -174,7 +174,7 @@ class PlatformEvent : public CHeapObj<mtInternal> {
class PlatformParker : public CHeapObj<mtInternal> {
class PlatformParker : public CHeapObj<mtSynchronizer> {
protected:
HANDLE _ParkEvent ;
@ -188,7 +188,7 @@ class PlatformParker : public CHeapObj<mtInternal> {
} ;
// Platform specific implementation that underpins VM Monitor/Mutex class
class PlatformMonitor : public CHeapObj<mtInternal> {
class PlatformMonitor : public CHeapObj<mtSynchronizer> {
private:
CRITICAL_SECTION _mutex; // Native mutex for locking
CONDITION_VARIABLE _cond; // Native condition variable for blocking

View File

@ -132,6 +132,7 @@ class AllocatedObj {
f(mtArguments, "Arguments") \
f(mtModule, "Module") \
f(mtSafepoint, "Safepoint") \
f(mtSynchronizer, "Synchronization") \
f(mtNone, "Unknown") \
//end

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, 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
@ -29,7 +29,7 @@
MonitorChunk::MonitorChunk(int number_on_monitors) {
_number_of_monitors = number_on_monitors;
_monitors = NEW_C_HEAP_ARRAY(BasicObjectLock, number_on_monitors, mtInternal);
_monitors = NEW_C_HEAP_ARRAY(BasicObjectLock, number_on_monitors, mtSynchronizer);
_next = NULL;
}

View File

@ -30,7 +30,7 @@
// Data structure for holding monitors for one activation during
// deoptimization.
class MonitorChunk: public CHeapObj<mtInternal> {
class MonitorChunk: public CHeapObj<mtSynchronizer> {
private:
int _number_of_monitors;
BasicObjectLock* _monitors;

View File

@ -39,7 +39,7 @@
// TODO: Check if _name[MONITOR_NAME_LEN] should better get replaced by const char*.
static const int MONITOR_NAME_LEN = 64;
class Monitor : public CHeapObj<mtInternal> {
class Monitor : public CHeapObj<mtSynchronizer> {
public:
// A special lock: Is a lock where you are guaranteed not to block while you are

View File

@ -40,7 +40,7 @@
class JavaThread;
// Implements the limited, platform independent Semaphore API.
class Semaphore : public CHeapObj<mtInternal> {
class Semaphore : public CHeapObj<mtSynchronizer> {
SemaphoreImpl _impl;
// Prevent copying and assignment of Semaphore instances.