[9] RFR (XS): 8139247: Improper locking of MethodData::_extra_data_lock

David Holmes david.holmes at oracle.com
Thu Mar 3 21:57:39 UTC 2016


On 3/03/2016 8:40 PM, Vladimir Ivanov wrote:
> http://cr.openjdk.java.net/~vlivanov/8139247/webrev.00
> https://bugs.openjdk.java.net/browse/JDK-8139247
>
> Solaris Studio C++ compiler generates tightly coupled
> Monitor::lock/unlock calls for unnamed MutexLocker which breaks

Just to be clear this is not a compiler bug - the anonymous instance can 
be destructed at any time after construction as it lives only until the 
end of the expression that defines it. Arguably any compiler not doing 
this is the buggy one. :)

Cheers,
David

> synchronization between ciMethodData::load_extra_data() and
> MethodData::bci_to_extra_data().
>
>    MutexLocker(mdo->extra_data_lock());
>
> is compiled into:
>
>    load_extra_data+0x001d: movq %r13,%rdi
>    load_extra_data+0x0020: call lock [ 0xfffffd7fe6df46c0, .+0x7cc5c0 ]
>    load_extra_data+0x0025: movq %r13,%rdi
>    load_extra_data+0x0028: call unlock [ 0xfffffd7fe6df47f0, .+0x7cc6e8
>
> But after adding a name, we hit a compiler bug in SS12u4 and
> Monitor::unlock call is missed. So, have to add a workaround (same as in
> JDK-8146616 [1]).
>
> Testing: verified machine code for ciMethodData::load_extra_data().
>
> Best regards,
> Vladimir Ivanov
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8146616


More information about the hotspot-dev mailing list