Tail/Non tail recursion
Bjorn Gustavsson
bjorn@REDACTED
Tue Sep 2 10:09:16 CEST 2003
Thomas Lindgren <thomasl_erlang@REDACTED> writes:
[...]
> Between 1 and 2, there may in general be a garbage
> collection. Thus, if a generational collector is used,
> the code needs to check whether A was tenured or not,
> and if tenured, record an old-to-new pointer.
>
> (As I recall, BEAM:s GC furthermore did not support
> such recording, since there was no need for it
> elsewhere. I'm not sure of how things are now.)
The current GC does not support pointers from the old
generation to the new. There is a newer, experimental,
not stable GC implementation that includes a write barrier
to allow pointers from the old generation to the youngest.
Regarding making the cons operation tail-recursive, I cannot
see that it can be done without entirely re-designing the Beam
instruction set in a non-backward compatible way. Therefore,
it will probably never be done.
/Bjorn
--
Björn Gustavsson Ericsson Utvecklings AB
bjorn@REDACTED ÄT2/UAB/F/P
BOX 1505
+46 8 727 56 87 125 25 Älvsjö
More information about the erlang-questions
mailing list