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

Mikael Gerdin mikael.gerdin at oracle.com
Tue Jul 18 07:48:12 UTC 2017

Hi Aleksey,

On 2017-07-17 21:40, Aleksey Shipilev wrote:
> On 07/17/2017 06:00 PM, Aleksey Shipilev wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8184753
>> fastdebug builds performance is important to minimize testing time. In GC tests,
>> we have a big hotspot at this line in oop::size_given_klass():
>>    assert(s % MinObjAlignment == 0, "Oop size is not properly aligned: %d", s);
>> The hotspot is because of the integer division. Alas, the divisor is not known
>> at compile time, because it can be set from the JVM command line, so compiler
>> cannot optimize it. There is an easy fix, use the MinObjectAlignmentMask to assert:
>>    http://cr.openjdk.java.net/~shade/8184753/webrev.01
>> This also fixes all uses of MinObjAlignment in similar expressions.
> 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?


inline bool is_object_aligned(size_t word_size) {
   return is_aligned(word_size, MinObjAlignment);


> -Aleksey

More information about the hotspot-dev mailing list