[Mono-dev] Simple method devirtualization patch

Rodrigo Kumpera kumpera at gmail.com
Fri May 25 20:35:58 EDT 2007


Hi Robert,

I was revisiting the code and there must be 2 checks, but one is for sealed
class and one for sealed method, but obviously the patch is wrong, thanks
for spoting!
About the string_ctor check should be removed as well.

Rodrigo

On 5/25/07, Robert Jordan <robertj at gmx.net> wrote:
>
> Hey,
>
> Rodrigo Kumpera wrote:
> > The following patch perform simple devirtualization based on the sealed
> > flag
> > of methods and types.
> >
> > The patch makes pystone 4% faster with IronPython 2.0 and 1% faster with
> > IronPython 1.0. It should improve other benchmarks as well, since it
> main
> > contribution is statically dispatching delegate.Invoke. To provide more
> > broad results a sse pass that perform type propagation is needed.
> >
> > The only thing I'm not sure about this patch is if it should handle
> > remoting
> > wrappers is some sort of way.
>
> > --- inssel.brg        (revision 77933)
> > +++ inssel.brg        (working copy)
> > @@ -1690,6 +1690,17 @@
> >                       method = ((MonoCallInst*)tree)->method =
> mono_marshal_get_remoting_invoke_with_check (method);
> >               }
> >
> > +             MONO_EMIT_NEW_UNALU (cfg, OP_CHECK_THIS, -1, this_reg);
> > +
> > +             tree->dreg = state->reg1;
> > +             tree->opcode = novirtop;
> > +             mono_bblock_add_inst (cfg->cbb, tree);
> > +             return;
> > +     }
> > +
> > +     if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) &&
> > +             ((method->klass->flags & TYPE_ATTRIBUTE_SEALED) ||
> > +                     (method->klass->flags & TYPE_ATTRIBUTE_SEALED))) {
>
> One of the TYPE_ATTRIBUTE_SEALED checks is redundant.
> You probably want method->flags & METHOD_ATTRIBUTE_FINAL.
>
> >               if (!method->string_ctor)
>
> The string ctor is probably not virtual, so you should leave the check
> where it was.
>
> I'd rather remove the 2nd branch at all and put the
> method->klass->flags & TYPE_ATTRIBUTE_SEALED check in the existing one.
>
> I didn't test it, though.
>
>
> Robert
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070525/9c240721/attachment.html 


More information about the Mono-devel-list mailing list