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=none 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 48F63BC69 for ; Sat, 21 Oct 2006 17:13:05 +0200 (CEST) Received: from smtp.Neuf.fr (sp604005mt.neufgp.fr [84.96.92.11]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9LFD4TO028934 for ; Sat, 21 Oct 2006 17:13:05 +0200 Received: from [192.168.144.231] ([84.5.234.181]) by sp604005mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0J7H006GCOK6HG11@sp604005mt.gpm.neuf.ld> for caml-list@inria.fr; Sat, 21 Oct 2006 16:07:19 +0200 (CEST) Date: Sat, 21 Oct 2006 16:07:24 +0200 From: Christophe Raffalli Subject: Re: [Caml-list] record field access In-reply-to: <200610210823.39902.jon@ffconsultancy.com> To: Jon Harrop Cc: caml-list@inria.fr Message-id: <453A299C.5050506@univ-savoie.fr> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT References: <20061021035358.GB15596@malaquias.gwiceb1> <200610210823.39902.jon@ffconsultancy.com> User-Agent: Thunderbird 1.5.0.7 (Macintosh/20060909) X-Miltered: at concorde with ID 453A3900.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 raffalli:01 raffalli:01 univ-savoie:01 optimise:01 indirection:01 indirection:01 stack:01 compiler:01 stack:01 christophe:01 caml-list:01 avoids:01 immutable:01 implemented:02 > > Otherwise, I don't know. I tried a lot of different combinations to try to > optimise my ray_sphere routine in the ray tracer. I got the impression that > it can affect register allocation, e.g. no CSE => pulling out {a.x=ax} in a > pattern requires an extra register but avoids repeated indirection (ax vs > a.x). > > I think register allocation shoud make the pattern preferable, because if there are to much registers, one indirection is needed anyway, and for a record field there is no need to store the value in the stack, because we know it is inside the record ? What I mean is that in let { l = x } = r in (* l being immutable or not muted in the ...*) ... x ... x ... x some x may be in register, other may be implemented as r.x, but if there is not enough registers, the compiler should know that it does not have to reserve stack space to store x. Christophe Raffalli