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 XAA27030; Mon, 12 Jul 2004 23:13:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA27523 for ; Mon, 12 Jul 2004 23:13:37 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6CLDVSH018838; Mon, 12 Jul 2004 23:13:35 +0200 Received: from [192.168.1.200] (ppp216-145.lns1.syd3.internode.on.net [203.122.216.145]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i6CLDR4Y065866; Tue, 13 Jul 2004 06:43:29 +0930 (CST) Subject: Re: Tail calls (Was Re: [Caml-list] Does Caml have slow arithmetics ?) From: skaller Reply-To: skaller@users.sourceforge.net To: Xavier Leroy Cc: brogoff , caml-list In-Reply-To: <20040712170738.GA3699@yquem.inria.fr> References: <20040707091308.GA26172@bourg.inria.fr> <20040707145803.GB27498@yquem.inria.fr> <1089227778.29648.81.camel@pelican.wigram> <20040708034455.GB29942@davidb.org> <40ED190E.3080005@ps.uni-sb.de> <20040708140408.GA2386@davidb.org> <20040708163653.A1260@beaune.inria.fr> <20040712170738.GA3699@yquem.inria.fr> Content-Type: text/plain Message-Id: <1089666807.29648.381.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 13 Jul 2004 07:13:27 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40F2FEFB.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 arithmetics:01 sourceforge:01 2004:99 recursion:01 ocamlopt:01 -inline:01 inlining:01 inlining:01 tail-call:01 optimised:01 9660:01 glebe:01 caml:01 feasible:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 2004-07-13 at 03:07, Xavier Leroy wrote: > 2- When the function being tail-called is the current function > (tail recursion). > 3- When the function being tail-called has no more than N arguments, > keeping in mind that a function with free variables has one extra > hidden argument representing its environment. > Proper elimination of tail calls in ocamlopt in all cases is feasible > but requires a bit of work. Can you comment on the effect of -inline switch and inlining in general? If you have let rec f a1 a2 a3 a4 ... = let g b1 b2 ... = f b2 b2 ... in g a1 a2 ... we have situation where the tail call in g isn't to g but to its parent f .. however this is an obvious candidate for inlining, and if we inline g into the body of f, then the tail call is to f, which is itself, which might then be tail-call optimised .. yes? -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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