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

David Holmes david.holmes at oracle.com
Fri Oct 14 00:02:00 UTC 2016



On 13/10/2016 8:25 PM, 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.

Hmmm okay. I still dislike the proliferation of that assert, and think 
it should be fixed where possible. I don't know if there is a better way 
to write the code using obj+offset() without actually generating the 
pointless instructions. If the mark offset must always be zero then 
perhaps it should some kind of compile-time constant.

>> However this is an enhancement not a bug so realistically it is not a
>> cleanup that should be being done in JDK 9 at this time. Unless you want
>> to go through the FC extension process.
>
> No, I don't. So we put that on hold until jdk10-dev is branched off?

Yes please.

Thanks,
David

> Roman
>


More information about the hotspot-dev mailing list