[Mono-devel-list] Re: [Mono-list] inlining of methods using structs

Rüdiger Klaehn rudi at gamemakers.de
Fri Aug 20 05:40:41 EDT 2004


Varga Zoltan wrote:

>                                                  Hi,
> 
>    There is no reason why such methods can't be inlined. It
> is just that
> the neccessary code is not yet implemented, or not tested
> enough to be
> enabled.
> 
I managed to get the mini code generator to inline all methods involving 
structs. I just had to comment out some assertions and change the 
inlining cost heuristics in mono_method_check_inlining.

It works, but it is actually slower than without inlining. The problem 
is that inlining is only worth it if subsequent optimizations like 
temporary struct elimination happen. That does not seem to be the case.

For example in this line:

Complex x,c;
...
x=x*x+c;

there are two temporary structs generated. One by the multiplication 
operator and one by the addition operator method. Ideally the JIT should 
eliminate these temporary structs and produce code similar to the 
manually inlined version:

//x=x*x...
t = xre * xre - xim * xim;
xim = xre * xim + xre * xim;
xre = t;
//...+c;
xre += cre;
xim += cim;

It is really a pity that this does not work, since otherwise mono would 
be extremely interesting for scientific computing and general high 
performance computing.

best regards

Rüdiger



More information about the Mono-devel-list mailing list