[Mono-dev] Simple method devirtualization patch

Rodrigo Kumpera kumpera at gmail.com
Mon May 28 10:37:46 EDT 2007


Hey,

I've fixed the patch with the help of Jb Evans and not it works as expected.
It was causing some problems since I've mixed up the sealed flag for types
and the final flag for methods.

Cheer,s
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/20070528/c5ce95bc/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: devirt.patch
Type: application/octet-stream
Size: 1400 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070528/c5ce95bc/attachment.obj 


More information about the Mono-devel-list mailing list