Skip to content

Commit a9d21c6

Browse files
author
Paul Hohensee
committed
8313081: MonitoringSupport_lock should be unconditionally initialized after 8304074
Reviewed-by: dholmes, sspitsyn, shade
1 parent 4c2e54f commit a9d21c6

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/hotspot/share/runtime/mutexLocker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ void mutex_init() {
224224

225225
MUTEX_DEFN(MarkStackFreeList_lock , PaddedMutex , nosafepoint);
226226
MUTEX_DEFN(MarkStackChunkList_lock , PaddedMutex , nosafepoint);
227-
228-
MUTEX_DEFN(MonitoringSupport_lock , PaddedMutex , service-1); // used for serviceability monitoring support
229227
}
228+
MUTEX_DEFN(MonitoringSupport_lock , PaddedMutex , service-1); // used for serviceability monitoring support
229+
230230
MUTEX_DEFN(StringDedup_lock , PaddedMonitor, nosafepoint);
231231
MUTEX_DEFN(StringDedupIntern_lock , PaddedMutex , nosafepoint);
232232
MUTEX_DEFN(RawMonitor_lock , PaddedMutex , nosafepoint-1);

src/hotspot/share/services/management.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,7 @@ JVM_ENTRY(jlong, jmm_GetTotalThreadAllocatedMemory(JNIEnv *env))
21162116
}
21172117

21182118
{
2119+
assert(MonitoringSupport_lock != nullptr, "Must be");
21192120
MutexLocker ml(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
21202121
if (result < high_water_result) {
21212122
// Encountered (2) above, or result wrapped to a negative value. In

test/jdk/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@
2222
*/
2323

2424
/*
25-
* @test
26-
* @bug 6173675 8231209 8304074
25+
* @test id=G1
26+
* @bug 6173675 8231209 8304074 8313081
2727
* @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
28-
* @author Paul Hohensee
28+
* @requires vm.gc.G1
29+
* @run main/othervm -XX:+UseG1GC ThreadAllocatedMemory
30+
*/
31+
32+
/*
33+
* @test id=Serial
34+
* @bug 6173675 8231209 8304074 8313081
35+
* @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
36+
* @requires vm.gc.Serial
37+
* @run main/othervm -XX:+UseSerialGC ThreadAllocatedMemory
2938
*/
3039

3140
import java.lang.management.*;

0 commit comments

Comments
 (0)