[Mono-list] CIL

Miguel de Icaza miguel@ximian.com
02 Sep 2002 13:48:13 -0400


Hello,

>  I am new to mono..Can anybody tell me what is the
> intermediate language used in JIT? just like CVM byte
> code in portable.NET??

There is no name for the intermediate language used by the Mono JIT, but
I can describe this for you.  

The Mono JIT "hidrates" the input stream of byte codes into a tree, so
things like: ldc.1 ldc.2 add become:

	    add
           /   \
         ldc.1 ldc.2

Not every node is translated to a node with the same name, multiple
simplifications happen at this level, you can see the list of node codes
in the x86.brg file (grep for %constant).

We take this opportunity to do some of the work in advance for the code
generation.  This means that the codes for the nodes in the tree are not
the same as the CIL opcodes.  For instance, the runtime would generate
special opcodes for object remoting, and replaces calls to Math.Sin with
a SIN opcode (which gets inlined as a floating point instruction).

Other nodes are internal implementation details used by the remoting

The higher level optimizations happen at this level.  The current ones:
constant folding, constant propagation and inlining, and in the future
we hope to have CSE implemented on this tree as well.

Once this is done, the tree is fed to the tree-pattern matching code
generator (the one generated by monoburg), registers are allocated,
possibly adding new nodes to spill/reload and finally the code is
generated.

Miguel.