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

Ulf Ochsenfahrt ulfjack@gmx.de
Wed, 29 May 2002 09:47:46 +0200 (MEST)


You're not entirely right there:
The normal Java-Compilers do NOT produce this type of code - reusing local
variables with different types.

The real problem is that Java-Code normally uses the Java API, which you
would have to translate to the .NET API or rewrite it in .NET (or have them
automatically translated). If you have them automatically translated you need to
mess around with the native functions.

-- Ulf


---- Original Message:

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.

_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net