8313081: MonitoringSupport_lock should be unconditionally initialized after 8304074

Reviewed-by: dholmes, sspitsyn, shade
This commit is contained in:
Paul Hohensee 2023-07-26 19:30:21 +00:00
parent 4c2e54fb05
commit a9d21c61fb
3 changed files with 15 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -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.*;