[Mono-list] inlining of methods using structs

Rüdiger Klaehn rudi@lambda-computing.de
Fri, 20 Aug 2004 11:40:41 +0200

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;

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:

t = xre * xre - xim * xim;
xim = xre * xim + xre * xim;
xre = t;
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