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 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id F0CDCBC69 for ; Sun, 2 Dec 2007 11:00:06 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAHYQUkfUGyokimdsb2JhbACPSgEIAggiBw X-IronPort-AV: E=Sophos;i="4.23,240,1194217200"; d="scan'208";a="4811438" Received: from smtp6-g19.free.fr ([212.27.42.36]) by mail2-smtp-roc.national.inria.fr with ESMTP; 02 Dec 2007 11:00:06 +0100 Received: from smtp6-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp6-g19.free.fr (Postfix) with ESMTP id 4CA715FE4D; Sun, 2 Dec 2007 11:00:06 +0100 (CET) Received: from [192.168.1.3] (che78-2-82-237-71-191.fbx.proxad.net [82.237.71.191]) by smtp6-g19.free.fr (Postfix) with ESMTP id BD51B5FE3C; Sun, 2 Dec 2007 11:00:05 +0100 (CET) Message-ID: <47528225.5040802@inria.fr> Date: Sun, 02 Dec 2007 11:00:05 +0100 From: Xavier Leroy User-Agent: Thunderbird 2.0.0.4 (X11/20070620) MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] LLVM: A native-code compiler for MiniML in ~100LOC References: <200711262052.18186.jon@ffconsultancy.com> In-Reply-To: <200711262052.18186.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; native-code:01 compiler:01 native-code:01 compiler:01 subset:01 run-time:01 first-order:01 higher-order:01 runtime:01 garbage:01 garbage:01 caml-list:01 functions:01 functions:01 closure:01 > I went through the usual steps in trying this and was extremely > impressed with the results. After only two days I was able to create > an optimizing native-code compiler for a subset of CAML large enough > to represent the following Fibonacci program: Yes, LLVM is an impressive project and your example demonstrates that LLVM is very well suited to run-time code generation. However, I have a point of terminology to make: the language you implemented is not what is normally called Mini-ML in the literature. Your language has first-order, second-class functions, while Mini-ML has higher-order, first-class functions. A runtime code generator for Mini-ML would be significantly more complex, since it has to deal with first-class functions either through closure conversion or defunctionalization, meaning in both cases dynamic allocation and garbage collection. Which brings us back to Basile's original question about LLVM and the Caml garbage collector. The following page suggests that they can already work together: http://llvm.org/docs/GarbageCollection.html - Xavier Leroy