8140600: Convert unnecessarily malloc'd Monitors to value members

Change a malloc'd monitor into an embedded monitor.

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Derek White 2016-02-29 11:32:12 -05:00
parent 9e60be45df
commit dbaa70361f
2 changed files with 12 additions and 12 deletions

View file

@ -57,21 +57,21 @@ void G1YoungRemSetSamplingThread::stop() {
} }
} }
G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() : ConcurrentGCThread() { G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() :
_monitor = new Monitor(Mutex::nonleaf, ConcurrentGCThread(),
_monitor(Mutex::nonleaf,
"G1YoungRemSetSamplingThread monitor", "G1YoungRemSetSamplingThread monitor",
true, true,
Monitor::_safepoint_check_never); Monitor::_safepoint_check_never) {
set_name("G1 Young RemSet Sampling"); set_name("G1 Young RemSet Sampling");
create_and_start(); create_and_start();
} }
void G1YoungRemSetSamplingThread::sleep_before_next_cycle() { void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag); MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
if (!_should_terminate) { if (!_should_terminate) {
intx waitms = G1ConcRefinementServiceIntervalMillis; // 300, really should be? intx waitms = G1ConcRefinementServiceIntervalMillis; // 300, really should be?
_monitor->wait(Mutex::_no_safepoint_check_flag, waitms); _monitor.wait(Mutex::_no_safepoint_check_flag, waitms);
} }
} }
@ -92,8 +92,8 @@ void G1YoungRemSetSamplingThread::run_service() {
} }
void G1YoungRemSetSamplingThread::stop_service() { void G1YoungRemSetSamplingThread::stop_service() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag); MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
_monitor->notify(); _monitor.notify();
} }
void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() { void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,7 @@
// increase the young gen size to keep pause time length goal. // increase the young gen size to keep pause time length goal.
class G1YoungRemSetSamplingThread: public ConcurrentGCThread { class G1YoungRemSetSamplingThread: public ConcurrentGCThread {
private: private:
Monitor* _monitor; Monitor _monitor;
void sample_young_list_rs_lengths(); void sample_young_list_rs_lengths();