caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] OCaml runtime system and Java
@ 2001-04-05 22:08 Alain Frisch
  2001-04-06  0:27 ` Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Alain Frisch @ 2001-04-05 22:08 UTC (permalink / raw)
  To: Caml list

(sorry, this post may be slightly off-topic)

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 ?

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 ?


-- 
  Alain Frisch

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] OCaml runtime system and Java
  2001-04-05 22:08 [Caml-list] OCaml runtime system and Java Alain Frisch
@ 2001-04-06  0:27 ` Jacques Garrigue
  0 siblings, 0 replies; 3+ messages in thread
From: Jacques Garrigue @ 2001-04-06  0:27 UTC (permalink / raw)
  To: frisch; +Cc: caml-list

From: Alain Frisch <frisch@clipper.ens.fr>

> 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 ?
> 
> 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 ?

You do not need C. What appeared from experience is that ocamlopt is
more than enough for practical use: for a project we had a programmer
write a full fledge Java VM in ocaml, able of running an XML parser
for instance. He did it in about a month, and the speed was about a
factor 3 of the Java JDK VM (without JIT, of course). If speed is not
your main concern (it shouldn't be if you're using Java anyway :-)),
then it should be enough.

It is only a VM, and does not contain extra runtime extensions, like
the GUI, and does not implement the bytecode checker, but I suppose
some people might have a use for that anyway.

We plan to release this code, but this may take some time as the
project was with a company, and they must agree. However the company
is used to open sourcing, and I see no reason they would refuse.

Jacques

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] OCaml runtime system and Java
@ 2001-04-06  1:30 David Gurr
  0 siblings, 0 replies; 3+ messages in thread
From: David Gurr @ 2001-04-06  1:30 UTC (permalink / raw)
  To: frisch; +Cc: caml-list


> 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.

-D

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-04-06  1:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-05 22:08 [Caml-list] OCaml runtime system and Java Alain Frisch
2001-04-06  0:27 ` Jacques Garrigue
2001-04-06  1:30 David Gurr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).