From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA07608; Fri, 25 Jun 2004 12:00:13 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA07809 for ; Fri, 25 Jun 2004 12:00:12 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i5PA07EV028787; Fri, 25 Jun 2004 12:00:07 +0200 Received: from bourg.inria.fr (bourg.inria.fr [128.93.11.100]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA07355; Fri, 25 Jun 2004 12:00:06 +0200 (MET DST) Received: from basile by bourg.inria.fr with local (Exim 4.34) id 1BdnUe-0000dk-Q2; Fri, 25 Jun 2004 11:59:36 +0200 Date: Fri, 25 Jun 2004 11:59:36 +0200 To: Jon Harrop , caml-list@inria.fr Subject: Re: [Caml-list] Writing a JIT compiler Message-ID: <20040625095936.GA2041@bourg.inria.fr> References: <200406250904.09178.postmaster@jdh30.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <200406250904.09178.postmaster@jdh30.plus.com> User-Agent: Mutt/1.5.6+20040523i From: "Basile Starynkevitch [local]" X-Miltered: at nez-perce with ID 40DBF7A7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 basile:01 basile:01 2004:99 ocamlopt:01 marshalling:01 bytecomp:01 mli:01 mli:01 metaocaml:01 metaocaml:01 2004:99 cminusminus:01 compiler:01 compiler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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