RFR: 8244550: Unsafe::allocateInstance does redundant transitions

Claes Redestad claes.redestad at oracle.com
Wed May 6 23:48:52 UTC 2020


Thanks, David!

/Claes

On 2020-05-07 01:40, David Holmes wrote:
> Looks good!
> 
> Thanks,
> David
> 
> On 7/05/2020 9:09 am, Claes Redestad wrote:
>> Hi,
>>
>> Unsafe::allocateInstance transitions from VM to native only to call
>> jni_AllocObject, transitioning back into VM.
>>
>> This contributes measurably to overhead when run in interpreter and C1,
>> so improving this helps startup/warmup. (C2 replaces with an intrinsic.)
>>
>> Patch moves code to allocate instance into InstanceKlass, so that it
>> can be shared between jni.cpp and unsafe.cpp, and changes to the unsafe
>> call doesn't go via jni_AllocObject.
>>
>> Patch: http://cr.openjdk.java.net/~redestad/8244550/open.00/
>> Bug:   https://bugs.openjdk.java.net/browse/JDK-8244550
>>
>> Testing: tier1-3, reduces U::allocateInstance overhead per call from
>> ~100ns to ~60ns
>>
>> Thanks!
>>
>> /Claes


More information about the hotspot-runtime-dev mailing list