RFR: 8244550: Unsafe::allocateInstance does redundant transitions
Mandy Chung
mandy.chung at oracle.com
Wed May 6 23:40:18 UTC 2020
On 5/6/20 4: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/
Looks good.
Nit: variable `ih` typically means handle. This could simply be `i`.
358 instanceOop ih =
InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(cls),
CHECK_NULL); Mandy
More information about the hotspot-runtime-dev
mailing list