RFR: 8217325: Enable inlining of java_lang_Class::oop_size_raw

Claes Redestad claes.redestad at oracle.com
Thu Jan 17 22:59:50 UTC 2019


Aleksey, Coleen, thanks for reviewing!

On 2019-01-17 20:24, coleen.phillimore at oracle.com wrote:
> +1 nice!
> Coleen
>
> On 1/17/19 12:23 PM, Aleksey Shipilev wrote:
>> On 1/17/19 6:12 PM, Claes Redestad wrote:
>>> Hi,
>>>
>>> InstanceMirrorKlass::oop_size could be helped slightly if
>>> java_lang_Class::oop_size_raw was made inlineable.
>>>
>>> This significantly speeds up one branch in oopDesc::size_given_klass
>>> (heavily used by G1, at least during startup/warmup) while not causing
>>> any increase in binary size (linux x64).
>>>
>>> Bug:    https://bugs.openjdk.java.net/browse/JDK-8217325
>>> Webrev: http://cr.openjdk.java.net/~redestad/8217325/open.00/
>> Looks good.
>>
>> I remember seeing the profiles for Shenandoah that walks the objects 
>> and uses oopDesc::size*
>> heavily, and it was inlined in product builds. That said, inlining it 
>> manually does not hurt.

This patch improves the inlining in the slow path taken from 
oopDesc::size_given_klass when
the klass is an InstanceMirrorKlass. This is slow since it has to call 
the virtual Klass::oop_size method, which
can't be inlined, but can still be beneficial if the GC has to deal with 
a lot of InstanceMirrorKlass oops.

The happy case where the oop is a regular object or even an array is 
dealt with without taking a virtual call
in oopDesc::size_given_klass. Something to take a closer look at is that 
this method - despite being
inlineable - doesn't seem to be inlined into oopDesc::size on linux x64 
using the gcc version we're building
with (product builds).  This seems unfortunate..

Thanks!

/Claes

>>
>> -Aleksey
>>
>



More information about the hotspot-runtime-dev mailing list