RFR: 8292059: Do not inline InstanceKlass::allocate_instance() [v3]

Claes Redestad redestad at openjdk.org
Thu Mar 9 11:11:24 UTC 2023


On Thu, 9 Mar 2023 10:36:36 GMT, Afshin Zafari <duke at openjdk.org> wrote:

>> The inline and not-inline versions of the method is stress tested to compare the performance difference. 
>> The `oop java_class` input parameter is changed to `InstanceKlass *` to gain more performance.
>> The statistics are drawn in the following charts. The vertical axis is in milliseconds.
>> 
>> ![chart (2)](https://user-images.githubusercontent.com/4697012/221848555-2884313e-9d26-41c9-a265-3f1ce295b17b.png)
>> 
>> ![chart (3)](https://user-images.githubusercontent.com/4697012/221863810-94118677-b4af-468f-90c6-5ea365ae3588.png)
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8292059: Do not inline InstanceKlass::allocate_instance()

src/hotspot/share/prims/jni.cpp line 967:

> 965: 
> 966:   instanceOop i = InstanceKlass::allocate_instance(
> 967:                     InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz))),

Perhaps it would be nice with a utility method to reduce some of the clutter. Just folding the `as_Klass` into a new method `instanceKlass::cast_from_oop(..)` (or just `from_oop`) would cut away a fair chunk and could be used to similar effect elsewhere (counting 21 cases where this would be applicable).

-------------

PR: https://git.openjdk.org/jdk/pull/12782


More information about the hotspot-dev mailing list