On 7/11/2012 9:57 AM, David Piepgrass wrote:
On Sunday, 8 July 2012 at 19:28:11 UTC, Walter Bright wrote:
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
Why?

Extra instructions generated for each function.


2. interfacing to C code becomes problematic
Isn't it possible to auto-commit new pages when C code needs it? I see that
*moving* the stack would be a problem unless you have a means to adjust all
pointers that point into the stack. If you need to call C code in 32-bit, you'd
have to specify a maximum stack size.

There's no way to predict how much stack arbitrary C code will use.


Reply via email to