From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 0CB1DBC69 for ; Thu, 16 Aug 2007 19:42:42 +0200 (CEST) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7GHgdnj026009 for ; Thu, 16 Aug 2007 19:42:41 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAN8nxEZ5LGJp/2dsb2JhbAAN X-IronPort-AV: E=Sophos;i="4.19,272,1183300200"; d="scan'208";a="173994861" Received: from ppp121-44-98-105.lns10.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.98.105]) by ipmail01.adl2.internode.on.net with ESMTP; 17 Aug 2007 03:07:32 +0930 Subject: Re: [Caml-list] JIT VM in OCaml: Impossible? From: skaller To: Gordon Henriksen Cc: Caml List In-Reply-To: <4DB2486A-4E68-4843-A02C-B058DB2CA28D@mac.com> References: <5C180944-2CD9-48FB-8802-8AF57972AD2C@gmail.com> <4DB2486A-4E68-4843-A02C-B058DB2CA28D@mac.com> Content-Type: text/plain Date: Fri, 17 Aug 2007 03:37:31 +1000 Message-Id: <1187285851.6017.17.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 46C48C8F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 runtime:01 compiler:01 10,:98 sourceforge:01 wrote:01 wrote:01 unix:01 compile:01 caml-list:01 data:02 data:02 structures:02 binary:02 On Thu, 2007-08-16 at 12:24 -0400, Gordon Henriksen wrote: > On 2007-08-16, at 10:10, Joel Reymont wrote: > > > Is it possible to write a JIT VM in OCaml? > > > > > > It seems that this should not be possible as OCaml does not allow > > for code generation at runtime. Am I mistaken? > > > Sure. You could write a compiler and assembler in ocaml. > But you'd need to write glue code in C or assembly to > convert the ocaml representation to machine data structures, Why? Ocaml is just as capable of generating binary data as C .. if not more capable. You would need some glue to actually *execute* this code, but that is also true in C. For Unix, mmap() would probably be used. The question is: why would you do this? Why not just generate C (or C++ as Felix does) and compile it to a shared library, then link and execute it? -- John Skaller Felix, successor to C++: http://felix.sf.net