English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: [Caml-list] OCaml runtime system and Java
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-06 (01:31)
From: David Gurr <gurr@m...>
Subject: Re: [Caml-list] OCaml runtime system and Java

> It seems than a few OCaml users have considered various approaches for
> running Caml programs on the Java VM. Has there been some attempt to do
> it the other way round, that is to run Java on the OCaml runtime system ?

Yes.  It is much better than the other directions.  But boxing 32 bit 
ints is a killer on 32 bit machines.  So your compiler ... .

> It could be with the full OCaml VM, or maybe more realistically, with a
> specialized VM using only the OCaml memory model (GC and block layout)
> and thread scheduling. Would it be difficult to implement (in C for
> instance) a Java VM on top of the OCaml runtime system ?

Yes (well more like tedious).  Java has lots of cruft.  For example JNI. 
And what would you do with 32 bit ints on 32 bit machines?  You
could extend custom blocks with garbage collection ops, but then what is
left of the ocaml runtime? 

A third idea, modify the instruction set of a JVM, add tagged ints, and
boot the verifier.  In Harrisa, I'm adding to and/or replacing the JVM
instructions with ZAM instructions (and translating class files to cmo
files).  The point is not a better way to run ML ('cause dis aint it),
but to ease migration from java to ML.  If it works I will do it again
on a java 1.3 implementation.  Will I miss the ocaml garbage
collector?  Yes.  Will something need to be done?  I expect so. I will
try adding ocaml's minor heap as a first step.

My other hack is to revive Camloo.  Camloo is the front end of
caml-light and the back end of Bigloo.  It compiled caml-light to C
with good interop with C and Scheme.  Bigloo now compiles to either C
or JVM.  Bigloo compiles modules and does lots of optimization.  I
expect that it satifactorily deals with the faults of JVM.

Before anyone points out the drawbacks of "O'Camloo", let me say that I
am impressed with both Ocaml and Bigloo.  They are based on very
different strategies toward dealing with a world dominated by C and
Unix.  Both are very successful.  While I am at it, I will say that I
am also impressed with MLj.  I agree with gerd's take on MLj but unlike
Bigloo and Ocaml, MLj died young and for reasons other than its own
virtues.  If MLj was as old and refined as Bigloo and Ocaml, it would
be quite good.  For example the whole program only & slow compile
disappear if you add a second backend that targets ZAM.  And this is
not difficult. Even in its current state it is well worth using
for the cases where it makes sense.


PS this is a hobby project so no promises on when I will have
anything nor that it will be worth distributing tho it will
be free if it is distributed.
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr