Segmented stack

via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 16 21:23:38 PDT 2014


On Thursday, 16 October 2014 at 22:20:34 UTC, Brad Anderson wrote:
> You might want to try asking the Go and Rust mailing lists 
> since they have a lot of experience with segmented stacks.

But note that Go has a different problem since they want high 
concurrency, so stacks have to stay small (and be able to 
shrink). I believe they copy stacks and rewrite pointers… (ugh)

> Rust abandoned them for a few reasons you can read about 
> here[1]. The announcement specifically mentions they believe 
> the MMU can take care of the stack on 64-bits.

They don't have much of a choice since AMD64 does not provide a 
segmented memory model.

Why they chose the flat model I cannot say, but I believe it has 
to do with the x86 memory architecture and how 32-bit x86 
implements segments as a separate layer from page tables with 
segments pointing to address ranges rather than a page table 
slot. If segment registers were more abstract (with no notion of 
physical memory addresses) then it would make sense to have it 
IMO.

Many-core probably make the 32-bit x86 model expensive to 
implement with little gain, so the FS and GS registers have been 
repurposed for other things instead.


More information about the Digitalmars-d mailing list