On Tue, Oct 29, 2013 at 7:08 AM, Niko Matsakis <[email protected]> wrote:
> If I understand correctly, what you are proposing is to offer fixed
> size stacks and to use a guard page to check for stack overflow (vs a
> stack preamble)?
>
> My two thoughts are:
>
> 1. I do think segmented stacks offer several tangible benefits:
>
> - Recursion limited only by available memory / address space
> - Avoid chewing up address space on 32 bit builds
>
> However, I can accept that on balance they are not worth the price,
> given that point #2 is probably not that important for 64-bit systems.
>
> It is sad to lose limitless recursion but typically one can rewrite
> routines that recurse arbitrarily deep to use a stack on the heap,
> though sometimes the code is very unnatural, and using a stack on the
> heap will not play as well with lifetimes, since the compiler doesn't
> know that you are obeying a stack discipline.
>

I agree. This is why I think fixed-size stacks feel like a step
backwards. There's still room to have optional segmented stacks, but
it's going to require a lot of extra complexity to do right.

> 2. I think that our official semantics for stack overflow should be
> task failure, not abort. There are some technical challenges to be
> overcome with regard to the best way to signal/detect stack overflow,
> and I'm fine with this being a "todo" item (possibly for a long time).
> But abort is wrong.
>

I don't know how to go about doing this, but am open to it.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to