Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Writing a JIT compiler
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile Starynkevitch [local] <basile.starynkevitch@i...>
Subject: Re: [Caml-list] Writing a JIT compiler
On Fri, Jun 25, 2004 at 09:04:09AM +0100, Jon Harrop wrote:
> 
> I'm trying to convert an interpreter written in OCaml into a JIT compiler. 
> Generating OCaml code from host code seems to be the best way to do this as 
> the generated code can then use the interpreter's data structures and 
> functions.
> 
> However, I'm currently creating temporary source files, calling ocamlopt and 
> using marshalling to another temporary file in order to get the data back and 
> forth.
> 
> Is there a better way of doing this?


Definitely have a look at http://cristal.inria.fr/~starynke/ocamljit.html

You did not explain why are you writing a JIT (speed issues?) and what
is the target language (x86 machine code, assembler, C, Ocaml?)  of
your JIT.

You might generate "lambda" representation (see
ocaml/bytecomp/lambda.mli) of the compiler, or at least typed trees
(see ocaml/typedtree.mli).

You might use MetaOcaml see http://metaocaml.org/

Some of their papers might help:
http://www.cs.rice.edu/%7Etaha/publications/conference/gpce03b.ps
http://www.cs.rice.edu/%7Etaha/publications/preprints/2004-02-16.ps
http://www.cs.rice.edu/%7Etaha/publications/journal/tcs00.pdf

You might generate C-- code: see http://cminusminus.org/

Regards.


-- 
Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr
Project cristal.inria.fr - phone +33 1 3963 5197 - mobile 6 8501 2359
http://cristal.inria.fr/~starynke --- all opinions are only mine 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners