RFR (S) 8184753: Assert against MinObjectAlignmentMask to avoid integer division

Mikael Gerdin mikael.gerdin at oracle.com
Tue Jul 18 07:58:27 UTC 2017

Hi Aleksey,

On 2017-07-18 09:51, Aleksey Shipilev wrote:
> Hi Mikael,
> On 07/18/2017 09:48 AM, Mikael Gerdin wrote:
>>> Noticed two new asserts in arguments.cpp have excess whitespace, fixed:
>>>     http://cr.openjdk.java.net/~shade/8184753/webrev.02
>> Did you consider using is_object_aligned in the newly created align.hpp?
>> http://hg.openjdk.java.net/jdk10/hs/hotspot/file/5e9c41536bd2/src/share/vm/utilities/align.hpp#l120
>> inline bool is_object_aligned(size_t word_size) {
>>    return is_aligned(word_size, MinObjAlignment);
>> }
> I did, but haven't done this for two reasons:
>    a) The asserts are about object _sizes_, not the objects themselves;
>    b) Doing *Mask fits other uses of MinObjAlignment(InBytes)(Mask) around HS;

But the is_object_aligned(size_t) function _is_ about object sizes, it 
just has a weird naming and a weird overload with the void* variant 
which asserts that a pointer is correctly aligned.

Another approach would be to just get rid of the weird one in align.hpp 
and use the MinObjAlignmentMask in plab.cpp instead.

> Thanks,
> -Aleksey

More information about the hotspot-dev mailing list