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 MAA09198; Tue, 5 Jun 2001 12:44:33 +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 MAA08947 for ; Tue, 5 Jun 2001 12:44:32 +0200 (MET DST) Received: from iona.dcs.gla.ac.uk (iona.dcs.gla.ac.uk [130.209.240.35]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f55AiVn29616 for ; Tue, 5 Jun 2001 12:44:31 +0200 (MET DST) Received: from crab.dcs.gla.ac.uk ([130.209.241.150]) by iona.dcs.gla.ac.uk with esmtp (Exim 3.13 #1) id 157EK6-0004Gl-00; Tue, 05 Jun 2001 11:44:30 +0100 Received: by crab.dcs.gla.ac.uk (8.8.8+Sun/Dumb) id LAA13141; Tue, 5 Jun 2001 11:44:28 +0100 (BST) From: reig@dcs.gla.ac.uk Message-Id: <200106051044.LAA13141@crab.dcs.gla.ac.uk> Subject: Re: [Caml-list] Ocaml and C-- To: caml-list@inria.fr Date: Tue, 5 Jun 2001 11:44:27 +0100 (BST) Cc: Basile.Starynkevitch@cea.fr (STARYNKEVITCH Basile), nr@eecs.harvard.edu (Norman Ramsey), reig@dcs.gla.ac.uk (Fermin Reig) In-Reply-To: <200105291930.f4TJUiL05545@wally.eecs.harvard.edu> from "Norman Ramsey" at May 29, 2001 03:30:52 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Norman Ramsey wrote: > > > Supposing that QC-- will deliver it promises... > > will Ocaml switch to target C-- or will Ocaml continue to > > natively target the usual architectures (x86, Alpha, Sparc, ia64, > > x86-64...)? > > It's way too early to ask anyone to make this decision, because C-- is > a long way away from being good enough and reliable enough to support > a production compiler. Having said that, Fermin Reig has been doing > some very interesting experiments with OCaml and C--, which I hope he > will comment on here. I have modified ocamlopt to emit C-- instead of Mach code (Mach is ocamlopt's intermediate language of abstract machine instructions). The C-- backend produces code that is slightly slower than the native ocamlopt backend (alpha/linux). I have identified several reasons for this slowdown: 1. Memory allocation. ocamlopt combines several allocations in the same basic block into one that requests a larger chunk of memory. This is done in the Mach internal representation, so we lose this optimization in the C-- backend. OCaml programs contain many individual allocations and each allocation translates into a conditional branch, which is not cheap in modern RISC proessors. 2. Instruction scheduling ocamlopt does better instruction scheduling inside basic blocks than the C-- compiler. 3. Garbage collection The C-- compiler reports GC roots to the garbage collector that may not be live at the point of the collection (the collector is still type-accurate, but not liveness-accurate). This prevents some garbage from being reclaimed and can make each collection to take longer. Other minor issues that may slowdown garbage collection (email me if you want to know the details). 4. Exception handling It's a little bit more costly via C--, but so little that it should go unnoticed (though I haven't measured it). Fermin ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr