Version française
Home     About     Download     Resources     Contact us    
Browse thread
record field access
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <raffalli@u...>
Subject: Re: [Caml-list] record field access

>
> 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