RFR(S): 8236035: refactor ObjectMonitor::set_owner() and _owner field setting

Kim Barrett kim.barrett at oracle.com
Tue Jan 28 21:42:27 UTC 2020


> On Jan 28, 2020, at 12:10 PM, Daniel D. Daugherty <daniel.daugherty at oracle.com> wrote:
> On 1/27/20 4:44 PM, Kim Barrett wrote:
>> src/hotspot/share/runtime/objectMonitor.hpp
>>  241   // Try to set _owner field to new_value if the current value matches
>>  242   // old_value. Otherwise, does not change the _owner field.
>>  243   void*     try_set_owner_from(void* old_value, void* new_value);
>> 
>> It would be nice if the comment described the result.
> 
> By "result" I'm hoping that you mean the return value... :-)

Yes.  Your update looks good.

>> (The old_value seems to be (nearly?) always either a value we already
>> have for other reasons, or NULL, so the only additional cost we're
>> paying for it is register pressure to keep it around until the possible
>> tracing use.)
> 
> One of reasons for the 'old_value' parameter is the "state machine"
> asserts that I've added. We want to make sure that we verify the
> expected old value of the _owner field before we change it in order
> to detect state machine violations.

Yes, I saw that, and I think that’s fine.



More information about the hotspot-runtime-dev mailing list