From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA01682 for caml-red; Thu, 4 Jan 2001 22:18:50 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA29060 for ; Thu, 4 Jan 2001 21:49:26 +0100 (MET) Received: from unknown-230-101.pilot.net (unknown-230-101.pilot.net [206.98.230.101]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f04KnPT22823 for ; Thu, 4 Jan 2001 21:49:25 +0100 (MET) Received: from unknown-239-164.pilot.net (unknown-239-164.pilot.net [206.189.239.164]) by unknown-230-101.pilot.net with ESMTP id PAA07724; Thu, 4 Jan 2001 15:49:22 -0500 (EST) Received: from uswaumsxbhmedge.med.ge.com (localhost [127.0.0.1]) by unknown-239-164.pilot.net with ESMTP id PAA27653; Thu, 4 Jan 2001 15:49:22 -0500 (EST) Received: from mrs.mrs.med.ge.com (MRS [3.57.196.1]) by uswaumsxbhmedge.med.ge.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2651.58) id Z0T1S7ZT; Thu, 4 Jan 2001 14:49:21 -0600 Received: (from gurr@localhost) by mrs.mrs.med.ge.com (8.9.3+Sun/8.9.3) id MAA05288; Thu, 4 Jan 2001 12:48:09 -0800 (PST) Date: Thu, 4 Jan 2001 12:48:09 -0800 (PST) From: David Gurr Message-Id: <200101042048.MAA05288@mrs.mrs.med.ge.com> To: Basile.Starynkevitch@cea.fr Subject: IBMs UVM? RE: JIT-compilation for OCaml? Cc: caml-list@inria.fr X-Sun-Charset: US-ASCII Sender: weis@pauillac.inria.fr OK, JVM is not an ideal target for compiling ML. But what about IBM's UVM. Does anyone here know about IBM's VMs? I have seen hints that UVM started life as a VM for Smalltalk. If so, it is probabaly ML friendly. Does anyone know more about this? STARYNKEVITCH Basile: > It is well known (e.g. see the Kawa implementation of Scheme on the > JVM) that the Java Virtual Machine is not well suited for functional > programming: function closures and tail-recursion calls (which are > actually jump with arguments) do not exist in the JVM, and emulating > them (e.g. closures as instances of specially generated classes) is > quite inefficient. The JVM is not as universal as Sun's marketing hype > claim it is... > > On the contrary the Ocaml virtual machine was (of course) designed for > functional programming, and efficiently implement tails calls and > closure constructions. There are a number of gotchas with compiling Ocaml to JVM but closures are not really the problem. Jumps do exist but they are only "within a method" Which means that you get lots of code duplication if you do a naive compilation of a let rec. But if you try the MLj (a SML to JVM compiler written in SML) you will see that this really is not a problem. If I had to point to one single difference between the java and ocaml runtimes that really simplifies compilation of Ocaml it would be the universal data type (ie the union of 31 bit tagged ints and 32 bit pointers -- for 32 bit machines of course). This makes it easy to compile efficient polymorphic code. With JVM you need to monomorphise the code. If you do so at compilation time you need the whole program (al MLj and Milton) which works but ... . But if the point of JVM is to do JIT then it makes sense to do monomorphing at JIT time. And there are hooks to JVM so you can do this (and some people doing generics for java have tried this). My opinion after doing a fair bit of this is that the Ocaml implementation is oh so much nicer to work with so I've mostly lost interest in the subject. A more promising direction is to compile java to a 64bit ocaml runtime. But I think the Ocaml group does not like that idea. - David Gurr MLj : http://www.dcs.ed.ac.uk/home/mlj/