Skip to content

Commit b2728cb

Browse files
committed
8189685: need PerfMemory class update and a volatile_static_field support in VMStructs
Reviewed-by: ysuenaga, dholmes, sspitsyn
1 parent e22762c commit b2728cb

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

src/hotspot/share/gc/shared/vmStructs_gc.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#endif
5555

5656
#define VM_STRUCTS_GC(nonstatic_field, \
57+
volatile_static_field, \
5758
volatile_nonstatic_field, \
5859
static_field, \
5960
unchecked_nonstatic_field) \

src/hotspot/share/runtime/perfMemory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ char* PerfMemory::_start = nullptr;
5151
char* PerfMemory::_end = nullptr;
5252
char* PerfMemory::_top = nullptr;
5353
size_t PerfMemory::_capacity = 0;
54-
int PerfMemory::_initialized = false;
54+
volatile int PerfMemory::_initialized = 0;
5555
PerfDataPrologue* PerfMemory::_prologue = nullptr;
56-
bool PerfMemory::_destroyed = false;
56+
volatile bool PerfMemory::_destroyed = false;
5757

5858
void perfMemory_init() {
5959

src/hotspot/share/runtime/perfMemory.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ class PerfMemory : AllStatic {
121121
static char* _top;
122122
static size_t _capacity;
123123
static PerfDataPrologue* _prologue;
124-
static int _initialized;
125-
static bool _destroyed;
124+
static volatile int _initialized;
125+
static volatile bool _destroyed;
126126

127127
static void create_memory_region(size_t sizep);
128128
static void delete_memory_region();

src/hotspot/share/runtime/vmStructs.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180

181181
#define VM_STRUCTS(nonstatic_field, \
182182
static_field, \
183-
static_ptr_volatile_field, \
183+
volatile_static_field, \
184184
unchecked_nonstatic_field, \
185185
volatile_nonstatic_field, \
186186
nonproduct_nonstatic_field, \
@@ -194,6 +194,7 @@
194194
/*************/ \
195195
\
196196
VM_STRUCTS_GC(nonstatic_field, \
197+
volatile_static_field, \
197198
volatile_nonstatic_field, \
198199
static_field, \
199200
unchecked_nonstatic_field) \
@@ -447,7 +448,7 @@
447448
static_field(PerfMemory, _top, char*) \
448449
static_field(PerfMemory, _capacity, size_t) \
449450
static_field(PerfMemory, _prologue, PerfDataPrologue*) \
450-
static_field(PerfMemory, _initialized, int) \
451+
volatile_static_field(PerfMemory, _initialized, int) \
451452
\
452453
/********************/ \
453454
/* SystemDictionary */ \
@@ -477,7 +478,7 @@
477478
volatile_nonstatic_field(ClassLoaderData, _klasses, Klass*) \
478479
nonstatic_field(ClassLoaderData, _has_class_mirror_holder, bool) \
479480
\
480-
static_ptr_volatile_field(ClassLoaderDataGraph, _head, ClassLoaderData*) \
481+
volatile_static_field(ClassLoaderDataGraph, _head, ClassLoaderData*) \
481482
\
482483
/**********/ \
483484
/* Arrays */ \
@@ -638,7 +639,7 @@
638639
static_field(Threads, _number_of_non_daemon_threads, int) \
639640
static_field(Threads, _return_code, int) \
640641
\
641-
static_ptr_volatile_field(ThreadsSMRSupport, _java_thread_list, ThreadsList*) \
642+
volatile_static_field(ThreadsSMRSupport, _java_thread_list, ThreadsList*) \
642643
nonstatic_field(ThreadsList, _length, const uint) \
643644
nonstatic_field(ThreadsList, _threads, JavaThread *const *const) \
644645
\
@@ -2685,7 +2686,7 @@ VMStructEntry VMStructs::localHotSpotVMStructs[] = {
26852686

26862687
VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
26872688
GENERATE_STATIC_VM_STRUCT_ENTRY,
2688-
GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
2689+
GENERATE_VOLATILE_STATIC_VM_STRUCT_ENTRY,
26892690
GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
26902691
GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
26912692
GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
@@ -2887,7 +2888,7 @@ JNIEXPORT uint64_t gHotSpotVMLongConstantEntryArrayStride = STRIDE(gHotSpotVMLon
28872888
void VMStructs::init() {
28882889
VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
28892890
CHECK_STATIC_VM_STRUCT_ENTRY,
2890-
CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
2891+
CHECK_VOLATILE_STATIC_VM_STRUCT_ENTRY,
28912892
CHECK_NO_OP,
28922893
CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
28932894
CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,

src/hotspot/share/runtime/vmStructs.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ class VMStructs {
163163
#define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
164164
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
165165

166-
// This macro generates a VMStructEntry line for a static pointer volatile field,
166+
// This macro generates a VMStructEntry line for a static volatile field,
167167
// e.g.: "static ObjectMonitor * volatile g_block_list;"
168-
#define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
169-
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void *)&typeName::fieldName },
168+
#define GENERATE_VOLATILE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
169+
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (type*)&typeName::fieldName },
170170

171171
// This macro generates a VMStructEntry line for an unchecked
172172
// nonstatic field, in which the size of the type is also specified.
@@ -205,9 +205,9 @@ class VMStructs {
205205
#define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
206206
{type* dummy = &typeName::fieldName; }
207207

208-
// This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
208+
// This macro checks the type of a static volatile VMStructEntry by comparing pointer types,
209209
// e.g.: "static ObjectMonitor * volatile g_block_list;"
210-
#define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
210+
#define CHECK_VOLATILE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
211211
{type volatile * dummy = &typeName::fieldName; }
212212

213213
// This macro ensures the type of a field and its containing type are

0 commit comments

Comments
 (0)