RFR: 8167659: Access of mark word should use oopDesc::mark_offset_in_bytes() instead of '0'

Andrew Haley aph at redhat.com
Thu Oct 13 10:44:19 UTC 2016


On 13/10/16 11:25, Roman Kennke wrote:
> Am Donnerstag, den 13.10.2016, 20:21 +1000 schrieb David Holmes:
>> Hi Roman,
>>
>> On 13/10/2016 7:40 PM, Roman Kennke wrote:
>>>
>>> In several places in Hotspot's assembly routines, we're using
>>> Address(obj, 0) to access the object's mark word. This is bad style and
>>> makes it very hard to find all the places where the mark word is used.
>>> It should use Address(obj, oopDesc::mark_offset_in_bytes()) instead.
>>
>> The changes from 0 seem fine.
>>
>> The additional asserts make me think that something as basic as:
>>
>> assert(oopDesc::mark_offset_in_bytes() == 0, "assumption");
>>
>> should only ever need to be checked once when the VM is initialized.
> 
> I put them there because there's cmpxchg right below that uses obj
> directly as address. This way I reach my primary goal: identifying
> the places that access the mark word, while not complicating the
> code with additional (and pointless) lea instructions to build an
> obj+0 address.

The problem with this approach is that it's not robust: everybody for
evermore would have to remember to add such asserts.  And these are
checked every time in a slowdebug build.

Andrew.



More information about the hotspot-dev mailing list