Re:Abandoning segmented stacks in Rust
by tomp on Wednesday November 06, 2013 @08:57AM
(#6682653)
That's a possible solution, but it requires that stack is relocatable (i.e. that you can find and rewrite all pointers to data on the stack), which is a significant complication with regards to a segmented stacks implementation. If you have a relocatable stack, you might as well use copy-the-whole-stack strategy with continuous stacks.
[ Parent
| on HN ]
Re:Abandoning segmented stacks in Rust
by simonmar on Thursday November 07, 2013 @04:40AM
(#6688519)
Segmented stacks are better even if you have a relocatable stack. GHC switched from monolithic copy-the-whole-thing-to-grow-it to segmented stacks a while ago, and it was a big win. Not just because we waste less space, but because the GC knows when individual stack segments are dirty so that it doesn't need to traverse the whole stack. To avoid the thrashing issue we copy the top 1KB of the previous stack chunk into the new stack chunk when we allocate a new chunk.