RFR: 8138659: Speed up InstanceKlass subclass discrimination (original) (raw)

Coleen Phillimore coleen.phillimore at oracle.com
Mon Oct 5 20:02:31 UTC 2015


In http://cr.openjdk.java.net/~kbarrett/8138659/webrev.00/src/share/vm/oops/instanceKlass.hpp.udiff.html

There are right_n_bits() and bitfield functions in globalDefinitions.hpp that would make some bit manipulation in this set_kind() easier to read.

Minor comment: I'd put kind_is_instance() .. kind_is_class_loader() functions on one line each and not use so much vertical space.

This is all I have to comment. It looks like a good change to me.

Coleen

On 10/3/15 2:26 PM, Kim Barrett wrote:

Please review this change to speed up discrimination among the classes rooted at InstanceKlass.

We use 2 bits from InstanceKlass::miscflags (the misckind field) for discrimination among the four kinds of InstanceKlass. We use the low 2 bits of miscflags to avoid a shift when accessing the field. This means that all the existing flags are being shifted up 2 bits. Added an accessor and a suite of predicates to InstanceKlass. Added kind argument to InstanceKlass constructor, which is used to set the misckind field. Updated all callers to provide the appropriate value. With these changes we can use the layouthelper-based Klass::oopisinstance to get to the InstanceKlass case, and use the misckind value to further discriminate from there. In particular, the concrete InstanceKlass case is (after inlining) (klass->layouthelper > 0) && ((staticcast<InstanceKlass*>(klass)->miscflags & 3) == 0) We could do better with a single discriminator, but there doesn't appear to be a good place to add such in Klass, and we don't want to make Klass bigger. Changed calls to Klass::oopisinstanceXXX to instead call Klass::oopisinstance then cast to InstanceKlass and use the corresponding kindisxxx predicate. Removed the no longer used Klass::oopisinstanceXXX functions. Removed unused InstanceRefKlass::cast. InstanceMirrorKlass::cast is retained because it is used. InstanceClassLoaderKlass::cast does not exist. CR: https://bugs.openjdk.java.net/browse/JDK-8138659 Webrev: http://cr.openjdk.java.net/~kbarrett/8138659/webrev.00/ Testing: JPRT Aurora ad-hoc defaults + GC Nightly + Runtime Nightly



More information about the hotspot-dev mailing list