Skip to content

Commit

Permalink
8313081: MonitoringSupport_lock should be unconditionally initialized…
Browse files Browse the repository at this point in the history
… after 8304074

Backport-of: a9d21c61fb12a11e18c6bb8aa903e5a8e42473f1
  • Loading branch information
Paul Hohensee committed Jul 31, 2023
1 parent 24fe96b commit a892672
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/mutexLocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ void mutex_init() {

MUTEX_DEFN(MarkStackFreeList_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(MarkStackChunkList_lock , PaddedMutex , nosafepoint);

MUTEX_DEFN(MonitoringSupport_lock , PaddedMutex , service-1); // used for serviceability monitoring support
}
MUTEX_DEFN(MonitoringSupport_lock , PaddedMutex , service-1); // used for serviceability monitoring support

MUTEX_DEFN(StringDedup_lock , PaddedMonitor, nosafepoint);
MUTEX_DEFN(StringDedupIntern_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(RawMonitor_lock , PaddedMutex , nosafepoint-1);
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/services/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,7 @@ JVM_ENTRY(jlong, jmm_GetTotalThreadAllocatedMemory(JNIEnv *env))
}

{
assert(MonitoringSupport_lock != nullptr, "Must be");
MutexLocker ml(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
if (result < high_water_result) {
// Encountered (2) above, or result wrapped to a negative value. In
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@
*/

/*
* @test
* @bug 6173675 8231209 8304074
* @test id=G1
* @bug 6173675 8231209 8304074 8313081
* @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
* @author Paul Hohensee
* @requires vm.gc.G1
* @run main/othervm -XX:+UseG1GC ThreadAllocatedMemory
*/

/*
* @test id=Serial
* @bug 6173675 8231209 8304074 8313081
* @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
* @requires vm.gc.Serial
* @run main/othervm -XX:+UseSerialGC ThreadAllocatedMemory
*/

import java.lang.management.*;
Expand Down

1 comment on commit a892672

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.