RFR (S) 8247296: Optimize JVM_GetDeclaringClass

David Holmes david.holmes at oracle.com
Fri Jul 24 03:49:58 UTC 2020


Bug: https://bugs.openjdk.java.net/browse/JDK-8247296
webrev: http://cr.openjdk.java.net/~dholmes/8247296/webrev/

Please review this simple optimization contributed by Christoph Dreis in 
its initial form and then expanded by me to cover other cases in jvm.cpp.

http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2020-June/040025.html

There is a common pattern of code of the form:

if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
     ! 
java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_instance_klass()) 
{

which resolves cls twice. There are also duplicate calls to as_Klass 
that can be removed in a couple of cases.

Testing: tiers 1 - 3

Thanks,
David


More information about the hotspot-runtime-dev mailing list