RFR: 8238174: migrate ObjectMonitor::_owner field away from C++ volatile semantics [v2]

Daniel D.Daugherty dcubed at openjdk.java.net
Wed Nov 18 02:25:18 UTC 2020


On Wed, 18 Nov 2020 01:52:58 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   @dholmes-ora CR - resolve David's comments.
>
> Looks good!
> One nit and one suggestion for your consideration.
> Thanks,
> David

@dholmes-ora - Thanks for the quick review!

> src/hotspot/share/runtime/objectMonitor.inline.hpp line 58:
> 
>> 56: // Returns NULL if DEFLATER_MARKER is observed.
>> 57: inline void* ObjectMonitor::owner() const {
>> 58:   void* owner = owner_raw();
> 
> There is an inconsistency with `owner()` and `owner_is_DEFLATER_MARKER()` where one delegates to `owner_raw()` and the other repeats the `Atomic::load(&_owner)`. They should both do the same thing - probably better to use `owner_raw()`.

Good catch! I changed owner_is_DEFLATER_MARKER() to use owner_raw().

> src/hotspot/share/runtime/objectMonitor.inline.hpp line 34:
> 
>> 32: 
>> 33: inline intptr_t ObjectMonitor::is_entered(TRAPS) const {
>> 34:   if (THREAD == owner_raw() || THREAD->is_lock_owned((address) owner_raw())) {
> 
> Suggestion: add a local to avoid two calls to `owner_raw()`.

Done.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1278


More information about the hotspot-runtime-dev mailing list