[LLVMdev] Ocaml(opt) & llvm

Basile STARYNKEVITCH basile at starynkevitch.net
Mon Nov 26 10:27:19 PST 2007


Hello All (to Ocaml List & CC LLVM list)

As some might probably know, the LLVM compiler http://llvm.org/ has (at 
least in its latest SVN snapshot) a binding for Ocaml. This means that 
one could code in Ocaml some stuff (eg a JIT-ing compiler) which uses 
(and links with) LLVM libraries.
http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-November/011481.html
http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-November/011507.html

However, to generate code with LLVM for Ocamlopt, this is not enough, 
since while LLVM does have hooks to support garbage collection
http://www.llvm.org/docs/GarbageCollection.html
I don't know of any actual hooks to fit into the needs of Ocamlopt 
garbage colector (which AFAIK require some specific frame descriptors in 
the code, in some hashtables, which details are tricky and known to very 
few implementors, perhaps only Xavier Leroy & Damien Doligez).

So is there any code to fit the Ocaml GC requirements into LLVM 
abilities, ie to use LLVM to generate (eg JIT) code which respect Ocaml 
GC requirements.

Of course, I do know that there are some typing issues and theoritical 
points which I deliberately ignore here. I'm supposing the guy wanting 
to LLVM for Ocaml is knowing that he seeks trouble.

And Metaocaml is (unfortunately) nearly dead: future (in ocaml 3.11 or 
3.12) dynamic libraries ability is not a full replacement! Even if one 
might generate Ocaml code and compile & dlopen it in a future version of 
Ocaml.

Thanks for reading.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***



More information about the llvm-dev mailing list