[Mono-list] A question about the implementation of Object Model Instructions.

Paolo Molaro lupus@ximian.com
Mon, 30 Jun 2003 15:18:13 +0200


On 06/30/03 Mark Easton wrote:
> As mentioned in partition 3 of the CLI, the Object Model Instructions
> could theoretically be translated into a series of Base Instructions,
> and while such an implementation would complicate the JIT process, I
> presume it would simplify the creation of a JIT compiler for different
> platforms.
> 
> So the question I have is does Mono take this approach for JITing or
> does it do something cleverer? I did have a quick scan through the
> source, but I'm a bit new to the source and haven't got my bearings yet.

Yes, the new JIT tries to factor complex opcodes into simpler ones
so that a port needs only to implement simpler code sequences.
When the conversion from a coarse opcode to more primitive opcodes
happens, though, it depends on how much information about the original
opcode we want to preserve for later optimization passes.
Take the ldlen opcode, for example: it is a simple load of a field
from the MonoArray structure. This way a port t a different architecture
doesn't need to implement the ldlen opcode, but just a general purpose
load from base+offset. The ldlen->load conversion, though, is not done
immediatly, because we may want to know it's a ldlen opcode if, for
example, it's used in the condition of a loop (enabling us to avoid
out of bounds checks). Something slightly different happens for the
stelem opcodes: they are decomposed to a ldelema + store right away
and the ldelema is converted to simpler opcodes only some time later (at
the same level as ldlen and for mostly the same reasons).
BTW: the mini/mini-doc.txt describes the JIT process, you may want to
read it.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better