Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Tail calls in the JVM and the OCamlJava project
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-27 (08:36)
From: forum@x...
Subject: Re: [Caml-list] Tail calls in the JVM and the OCamlJava project
Selon Jon Harrop <>:

> For anyone who missed it, there has been a very interesting development in
> land. Arnold Schwaighofer claims to have the first working implementation of
> tail calls on the recently open sourced Hotspot Java compiler:
> Given the existence of the OCamlJava project, this should be of great
> interest
> to the OCaml community because it might pave the way to even better numerical
> performance and easier parallelism with simple interop to rich libraries and
> so forth.

The work done around the Da Vinci machine
is clearly interesting for the future of the OCaml-Java project (and for almost
any compiler targeting the JVM). However, we have no evidence regarding the
'transfert rate' from the Da Vinci machine to the 'plain' JVM.

That being said, some other developments are needed before we get decent
performances from ocamljava-compiled code. Not trying to be exhaustive, I
would list:
  - tail calls (*);
  - garbage collector strategies better suited to functional languages (*);
  - some kind of 'method pointers' for efficient closure handling (*)
  - a better memory model (**);
  - a better code generator (**);
  - more aggressive unboxing of values, like in ocamlopt (**).

Items marked by (*) are related to the JVM while those marked by (**) are
developments to be done on the OCaml-Java codebase. One chance for the
OCaml-Java project is that the hype around so-called scripting languages
seems to push Sun to design and integrate things that are useful to
OCaml-Java. Indeed, scripting languages and OCaml express some common
needs such as garbage collectors oriented towards short-lived objects,
or function/method pointers. Almost all that benefits to scripting
languages will also benefit to OCaml-Java.

Anyway, we will have to wait until JDK 7 (planned / hoped for late 2009)
to see some of these changes available for production. In the meantime,
I will have to find some time to work on OCaml-Java to correct its

Xavier Clerc