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
Compiling to OCaml bytecode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-09-09 (12:43)
From: Jon Harrop <jon@f...>
Subject: Compiling to OCaml bytecode

I am interested in improving the performance of a simple term-level 
interpreter. As OCaml's bytecode is so fast, I'd like to replace the 
interpreter with a JIT compiler that compiles to OCaml bytecode and then uses 
OCaml's bytecode interpreter to execute the generated code efficiently and 
handle the results.

Does the OCaml distribution expose everything needed to do this? I assume the 
Dynlink module is where I should be looking. I've never used it before but it 
looks as though it only loads from file (the "loadfile" function), so I'd 
have to compile to a .cmo file and load that. What is the easiest way to 
recover the result? If the necessary functionality is not already exposed, 
could it and/or what are the odds that it will be added?

Also, is a bytecode-compiled JIT bytecode compiler likely to outperform a 
native-code-compiled term-level interpreter? I assume the JIT compiler would 
itself need to be compiled to bytecode in order to provide the bytecode 
interpreter for the generated code.

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists