Benedikt Meurer JavaScript Engine Hacker and Programming Language Enthusiast.

ocaml-experimental

The ocaml-experimental repository serves as a playground for experimenting with new features and changes to the OCaml language and runtime, including a new native code toplevel ocamlnat and an implementation of the linear scan register allocator for the optimizing native code compiler ocamlopt.

Native code toplevel #

We have developed a new native code OCaml toplevel ocamlnat, which is up to 100 times faster than the byte code toplevel ocaml. It is based on the optimizing native code compiler, the native runtime and an earlier prototype by Alain Frisch. It is build upon Just-In-Time techniques and currently supports Unix-like systems (i.e. Linux, BSD or Mac OS X) running on x86 or x86-64 processors. Support for additional architectures and operating systems is planned, but not yet available.

The native code toplevel was moved to a new project ocamlnat.

Download #

Installation #

Download the latest source code release ocaml-3.12.1+ocamlnatjit2.tar.bz2 (or any other release from the list above), and extract the source distribution tarball using the following command:

tar xjf ocaml-3.12.1+ocamlnatjit2.tar.bz2
cd ocaml-3.12.1+ocamlnatjit2

The installation is similar to the installation of any regular upstream OCaml source distribution, so make sure to consult the INSTALL and README files if you run into trouble.

Assuming that you want to install the experimental OCaml into /usr/local on a Unix-like system (i.e. Linux, BSD or Mac OS X), proceed by

./configure -prefix /usr/local
make world
make opt
make opt.opt

These are basically the standard configuration and build steps as described in the INSTALL file. Feel free to pass additional parameters the configure script if you need to.

Afterwards run the following command to also build the new native OCaml toplevel ocamlnat, which is currently only available on Unix-like systems running on x86 or x86-64 processors, so this command will fail on other systems.

make ocamlnat

The final step is to install the new OCaml distribution into the selected prefix directory (i.e. /usr/local).

sudo make install

Et voila, now you can use your new OCaml distribution, especially the new ocamlnat toplevel. Assuming that you installed it into /usr/local, then you can execute it using the following command, which presents you with an interactive toplevel prompt, i.e.:

$ /usr/local/bin/ocamlnat
        Objective Caml version 3.12.1+ocamlnatjit2 (Thu Oct 06 2011 00:00:00 GMT+0000 (Coordinated Universal Time)) - native toplevel

#

You can use it as a drop-in replacement for the byte code toplevel ocaml in almost all cases, and enjoy a performance boost of up to 100x (compared to the byte code toplevel), as detailed here and here.

Publications #

License #

ocaml-experimental is licensed under the Q Public License and the GNU Lesser General Public License just like the original OCaml distribution. See the LICENSE file for details and exceptions.

Source code

Available on GitHub: https://github.com/bmeurer/ocaml-experimental

Download it in either zip or tar formats.

Clone the project with Git by running:

git clone git://github.com/bmeurer/ocaml-experimental.git

Bug Reports

If you come across any problems, please create a ticket and we will try to get it fixed as soon as possible.

Report a Bug

Contributing

Once you have made your commits:

  1. Fork ocaml-experimental.
  2. Create a topic branch - git checkout -b my_branch
  3. Push to your topic branch - git push origin my_branch
  4. Create a Pull Request from your topic branch.
  5. That's it!

Fork ocaml-experimental

Copyright © 2010-2011 Benedikt Meurer. See the LICENSE file for details.