RFR: 8244550: Unsafe::allocateInstance does redundant transitions

coleen.phillimore at oracle.com coleen.phillimore at oracle.com
Wed May 6 23:16:41 UTC 2020


Looks good to me!
Coleen

On 5/6/20 7:09 PM, 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