Request for review (M): 7171890: C1: add Class.isInstance intrinsic

Krystal Mok rednaxelafx at gmail.com
Wed May 30 19:55:14 PDT 2012


Hi Remi and Chris,

Yes, it's doable. I'll just take the same approach for
clazz1.isAssignableFrom(clazz2).
I'm fine with doing it in this change. But it might take some time as I
have some other things that I have to do right now.

Meanwhile I'd like to wait for Chris and see how much this patch improves
the new JSR 292 implementation performance. If it's not good enough, I'll
try again with more complicated solutions.

Regards,
Kris

On Thu, May 31, 2012 at 3:43 AM, Christian Thalinger <
christian.thalinger at oracle.com> wrote:

>
> On May 30, 2012, at 11:49 AM, Rémi Forax wrote:
>
> > Hi Krystal,
> > is it also possible to try to trap Class.isAssignableFrom(Class),
> > if one of Class is constant ?
>
> If Kris has time, why not.  The Class.isInstance is important now because
> we will heavily use it in the new JSR 292 implementation.  For JRuby's
> red-black tree it used 67% of the run time (yeah, JNI is expensive).
>
> -- Chris
>
> >
> > Rémi
> >
> > On 05/30/2012 05:31 PM, Krystal Mok wrote:
> >> Hi all,
> >>
> >> Could I have a couple of review for this change, please?
> >> https://gist.github.com/2830194#file_c1_is_instance.patch
> >>
> >> This patch implements Class.isInstance() intrinsic in C1.
> >> As a first cut, the current implementation is pretty straightforward:
> >> 1. During HIR construction, Class.isInstance() is inlined as an
> Intrinsic node
> >>   in GraphBuilder::try_inline_intrinsics();
> >> 2. Try to canonicalize the Intrinsic node into an InstanceOf node when
> >>   appending the node to the HIR graph;
> >> 3. Generate a leaf call to a runtime helper (Runtime1::is_instance_of)
> during
> >>   LIR generation for the remaining Intrinsic nodes for
> Class.isInstance().
> >>   This keeps the change platform-independent.
> >>
> >> There are several opportunities for more optimizations. e.g.
> >> 1. Turn more Intrinsic nodes into InstanceOf nodes during HIR
> optimizations and
> >>   during LIR generation;
> >> 2. Check the clazz.isInstance(null) case in a couple of places *after*
> clazz is
> >>   null-checked or guaranteed to be non-null; turn that into a constant
> false.
> >> 3. Follow the lir_store_check example for better platform-dependent
> performance
> >>
> >> These shall be addressed in some future change, if necessary.
> >>
> >> Regards,
> >> Kris
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20120531/77e85ddb/attachment.html 


More information about the hotspot-compiler-dev mailing list