On 7/8/2012 6:49 AM, bearophile wrote:
I think in Go the function stack is segmented and growable as in Go. This saves
RAM if you need a small stack, and avoids stack overflows where lot of stack is
needed.
The trouble with segmented stacks are:
1. they have a significant runtime penalty
2. interfacing to C code becomes problematic
Also, they do not save RAM, they save address space. RAM is not committed until
a stack memory page is actually used.
Segmented stacks are useful for 32 bit address space. However, they are not
useful for 64 bit address spaces. Heck, you can allocate 4 billion stacks of 4
billion bytes each! (Remember, allocating address space is not allocating actual
memory.)
Given that the programming world is moving rapidly to 64 bit exclusively, I
think segmented stacks are a dead end technology. They would have been much more
interesting 15 years ago.