Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Future of labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <gerd@g...>
Subject: Re: [Caml-list] ocaml, java, rmi and jini
On Tue, 03 Apr 2001, Chris Hecker wrote:
>>hi there, i'm interested in integrating java and jini with ocaml. i 
>>understand that executing ocaml bytecode on JVMs might not be a 
>>good idea
>
>Have you seen this?
>http://www.ocaml-programming.de/javacaml/manual/
>
>I'd love to be able to either compile ocaml to JVM bytecodes (yes, I know it's hard) 
>or have the javacaml system provide good access to some of the java libraries
>(some graphics, mouse/keyboard, simple UI, networking).  Is Gerd reading this? 

Yes. 

>I sent mail about the status of javacaml a while back, but haven't heard
>anything yet. 

Sorry that I sometimes cannot reply immediately.

>I'm interested in this because I want to write relatively
>simple web applets in ocaml, so javacaml would be find for me.  I assume
>anybody who wants to actually deliver a production app for a JVM would need a
>better solution. 

Javacaml has very poor performance, and I think it is impossible to change
that. Even if we compile to Java bytecode directly. The point is that Java
bytecode is very restrictive due to its sandbox principle, and this makes it
impossible to map a different programming style to the code structure needed by
the JVM. For example, there is no "goto" in the JVM, but we need it for tail
recursion. Another problem are closures. There is no direct equivalent in Java;
you can only define classes that contain the implicit closure variables as
instance variables, and that have an "apply" method. This is a very expensive
mapping, and even if Java can deal with many classes, I don't believe that it
can deal with that many classes we would need to run Caml programs (usually
containing lots of closures).

Perhaps there is a scheme that maps from Caml to Java, but you would need
extensive program analysis to optimize the code.

Of course, it is still possible to use the current JavaCaml implementation, and
to extend it. However, I must warn you. "Some graphics, mouse/keyboard,
simple UI, networking" would require more performance than this emulation can
give you, even with execellent JIT compilers and fast CPUs. It's only several
thousand bytecode instructions per second.

Gerd
-- 
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de
Germany                     
----------------------------------------------------------------------------
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr