RFR (S): 8140600: Convert unnecessarily malloc'd Monitors to value members

Derek White derek.white at oracle.com
Mon Feb 29 15:46:59 UTC 2016


Hi Kim,

On 2/29/16 12:34 AM, Kim Barrett wrote:
>> On Feb 26, 2016, at 11:16 PM, Derek White <derek.white at oracle.com> wrote:
>>
>> This small fix changes a malloc'd monitor into an embedded monitor. Also adds assert that no one holds the monitor when we destruct it.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8140600
>> Webrev: http://cr.openjdk.java.net/~drwhite/8140600/webrev.01/
>> Tests: jprt
>>
>> Note: Merged with mgerdin's change to g1YoungRemSetSamplingThread.
>>
>> Thanks!
>>
>>   - Derek
> ------------------------------------------------------------------------------
> src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp
>    70 G1YoungRemSetSamplingThread::~G1YoungRemSetSamplingThread() {
>    71   assert(!_monitor.is_locked(), "don't delete locked monitor");
>    72 }
>
> The assert seems misplaced here; it seems like an invariant that
> ~Monitor ought to be checking instead. And it looks like ~Monitor
> already checks for this, as well as other bad states for destruction.

Ah, I should have checked Monitor. That simplifies things.
>
> If the assert is removed, the destructor can revert back to being
> implicitly defined.
>
> ------------------------------------------------------------------------------
>
> Looks good otherwise.
>
> I don't need a new webrev just for removal of that destructor.

OK, Thanks Kim!

  - Derek



More information about the hotspot-gc-dev mailing list