[Mono-dev] JIT and Inlining - why doesn't it happen?

Andreas Nahr ClassDevelopment at A-SoftTech.com
Thu May 1 05:28:34 EDT 2008

I just checked the R01/R02 methods and they both have 20 IL instructions
with 22 bytes of IL code, so this is pretty much a corner case. However the
Ch method that you mention has a mere 9 IL instructions and only 9 bytes of
IL code, so this does not explain why it doesn't get inlined if the
threshold is 20 bytes of IL.





Von: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag von Alan
Gesendet: Donnerstag, 1. Mai 2008 10:26
An: Rodrigo Kumpera
Cc: mono-devel
Betreff: Re: [Mono-dev] JIT and Inlining - why doesn't it happen?



That makes sense. I was just quite surprised at the time that the methods
were not being inlined as they were only simple maths operations. I checked
monodis for one of the methods and it turned out to be 8 IL instructions,
which is probably 24 bytes, which would explain why it wasn't inlined.


On Thu, May 1, 2008 at 12:24 AM, Rodrigo Kumpera <kumpera at gmail.com> wrote:

Well, the inliner basically eliminates the penalty from using properties and
empty constructors.

Increasing the inline threshold is tricky and might now be worthy as there
are too many situations that abort inlining. So it would significantly
increase JIT time for diminishing gains.

On Wed, Apr 30, 2008 at 6:38 PM, Alan McGovern <alan.mcgovern at gmail.com>

This method does not get inlined:

private uint Ch (uint u, uint v, uint w) 
    return (u&v) ^ (~u&w);

If that isn't inlined then don't ask me what kind of method *could* be
inlined by the JIT.



On Wed, Apr 30, 2008 at 11:32 PM, Rodrigo Kumpera <kumpera at gmail.com> wrote:

Mono only inline very short methods. Right now methods must have a body at
most 20 bytes long.

2008/4/30 Alan McGovern <alan.mcgovern at gmail.com>:

I recently started doing a bit of optimisation work on the
hashing/cryptography classes in mono. When working on the managed SHA256
class[1], i noticed that mono isn't inlining what i'd consider some *very*
simple methods.

The helper methods which do the bitshifting (Ro0, Ro1, Ch, Maj etc) aren't
inlined! Each of these methods is only called once in the code. By manually
inlining those method calls, performance increased significantly - about
70%. Why isn't mono inlining these methods? Can mono be made inline these?


ity.Cryptography/SHA256Managed.cs?rev=46462&view=markup> &view=markup

Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080501/4fa352ab/attachment.html 

More information about the Mono-devel-list mailing list