[Mono-list] Re: could mono become a hybrid cil/java platform?

Zaphod j0k3rin@yahoo.co.in
Tue, 28 May 2002 22:30:44 +0530


On Tue, May 28, 2002 at 10:59:34AM +0000, Freddy BL wrote:
> So, at first it seams to be easy to translate:
> 
> iload_x  -> ldloc.x
> istore_x -> stloc.x
> iadd     -> add
> return   -> ret
> aload_0  -> ldarg.0

It *might* look easy.... but to tell you some of the complicated
stuff....

The JVM uses dynamic type local variables ... IL doesnot

so like 

sipush 0
istore_3
ldc "hello"
astore_3

is valid , but 

ldc.i4.0
stloc.3
ldstr "hello"
ldloc.3 

is illegal ... which will need a hell lot of dynamic flow analysis
to find out what was in local var 3 at a point of execution and relocate
to a new var of correct type ... I'll decline to bore you with *how*..

Also add a few of the JVM's good features like pop2 , dup2_x1 , dup2_x2
and [Ljava/lang/String; you get a cart load of work. oh and I forgot
the jump target mapping , different size operands (like long,double)...

So a simple convertor is impossible... unlike your claims .. for
any useful code.