copy elimination for tuples

Vlad Balin vlad@REDACTED
Thu Mar 18 17:24:08 CET 2004


Thanks for reply. Are there any documents available describing GC techniques
used in HiPE and BEAM?

Vlad.
> -----Original Message-----
> From: Richard Carlsson [mailto:richardc@REDACTED] 
> Sent: 17 марта 2004 г. 22:06
> To: Vlad Balin
> Cc: erlang-questions@REDACTED
> Subject: Re: copy elimination for tuples
> 
> 
> 
> On Wed, 17 Mar 2004, Vlad Balin wrote:
> 
> > I'm interested in copy elimination optimization for tuples. 
> As far as 
> > I know, this feature has not been implemented yet. Is there any 
> > specific reason or considerations? Have anyone tried to do that?
> 
> The main obstacle is that the garbage collector currently 
> requires that there are no pointers from an older generation 
> to a younger one. This means that you can only "zap" fields 
> in a tuple if you have full control of where the tuple is 
> located. For instance, a tuple that was created only a few 
> steps earlier (even in the same function) may have already 
> been moved to an older generation if a GC was triggered 
> between the two program points. So it is not enough to know 
> that the tuple will not be needed in its old form when you do 
> a "setelement".
> 
> Currently, some destructive updating of tuple fields is 
> introduced when it is certain that there will be no GC; this 
> typically happens in the code generated to create tuples when 
> the "record syntax" is expanded. Note that this is a compiler 
> optimization only - the destructive setelement operations 
> cannot be accessed from normal Erlang code.
> 
> 	/Richard
> 
> 
> Richard Carlsson (richardc@REDACTED)   (This space 
> intentionally left blank.)
> E-mail: Richard.Carlsson@REDACTED	WWW: 
> http://user.it.uu.se/~richardc/
>  "Having users is like 
> optimization: the wise course is to delay it."
>    -- Paul Graham
> 




More information about the erlang-questions mailing list