From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id D5FFFBBAF for ; Sun, 5 Dec 2010 23:34:17 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgoCAK6h+0zLOwFrkWdsb2JhbACVHI4UFQEBAQEJCxERAx+9GIIUgzUEjhs X-IronPort-AV: E=Sophos;i="4.59,302,1288566000"; d="scan'208";a="91565255" Received: from outbound.icp-qv1-irony-out2.iinet.net.au ([203.59.1.107]) by mail1-smtp-roc.national.inria.fr with ESMTP; 05 Dec 2010 23:34:16 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlUFACii+0zLzuai/2dsb2JhbACVHI4Ucb0ZghSDNQSOGw X-IronPort-AV: E=Sophos;i="4.59,302,1288540800"; d="scan'208";a="714867778" Received: from unknown (HELO hendrix.mega-nerd.net) ([203.206.230.162]) by outbound.icp-qv1-irony-out2.iinet.net.au with ESMTP; 06 Dec 2010 06:34:13 +0800 Received: from hendrix.mnn (hendrix.mnn [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id C92F4106E7B for ; Mon, 6 Dec 2010 09:34:12 +1100 (EST) Date: Mon, 6 Dec 2010 09:34:12 +1100 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: Re: ocamlopt LLVM support (Was: [Caml-list] OCamlJIT2 vs. OCamlJIT) Message-Id: <20101206093412.e2de2d5c.mle+ocaml@mega-nerd.com> In-Reply-To: References: <3DCEA910-1382-47E5-876B-059178F8F82E@googlemail.com> <20101130124803.7952fca1@deb0> <0a8b01cb90da$da5e6240$8f1b26c0$@com> <5E2DA3F1-7998-4F62-B617-7B6451D1001D@googlemail.com> <0b3b01cb9161$a81c8e10$f855aa30$@com> <0b9301cb91a3$8f42fd60$adc8f820$@com> <0cae01cb9325$a8ddc3d0$fa994b70$@com> Reply-To: caml-list@inria.fr Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 ocamlopt:01 ocaml:01 compiler:01 compiler:01 bytecode:01 haskell:01 blog:98 garbage:01 garbage:01 wrote:01 rewrite:01 experimental:01 exception:01 caml-list:01 Benedikt Meurer wrote: > Using a different data representation within OCaml would indeed be > possible, but one has to ask what it's worth? Is it necessary to use a different data representation? What does that buy you? > 1. You will have to rewrite not only the compiler, At least the compiler backend, and the new backend might require changes in earlier stages earlier of the compiler. > the standard > library and the bytecode interpreter (already a massive amount of > work), Why? > but you also loose compatibility with almost every existing OCaml > library binding, since the native function interface will be different. > That's a hell of a lot of work for many people. Again, why? When the GHC haskell compiler gained an LLVM backend, the LLVM project accepted changes to allow a new GHC specific calling convention. Couldn't the same be done for Ocaml? > 3. The current garbage collector is mostly straight-forward because of There is no need to use LLVM's GC if something better already exists. > Two main areas for now: The GC interface and the exception handling. If the Ocaml versions of these are already better than what LLVM can provide, here is no reason to use the LLVM versions. I'm currently working on the LLVM backend to an experimental compiler called DDC: http://www.mega-nerd.com/erikd/Blog/CodeHacking/DDC/index.html DDC had an existing C backend and its own garbage collector. For the LLVM backend I have kept the C calling convention and the existing GC and just used LLVM for code generation. In my experience, LLVM has been a pleasure to work with, but the backend is not yet far enough advanced for any speed comparisons between the C and LLVM backend. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/