Stack frames larger than 4K should be rejected, but what if I want more

Steven Schveighoffer schveiguy at gmail.com
Mon Jun 28 12:41:20 UTC 2021


On 6/27/21 2:56 PM, IGotD- wrote:
> This is a breakout thread from this thread.
> 
> https://forum.dlang.org/thread/ghodronzxeirokyoqeag@forum.dlang.org
> 
> According to the comment from Walter.
> 
> *As per Walter's recent comment in that thread, he asserts that stack 
> allocations beyond 4k should be rejected.*
> 
> in this issue:
> https://issues.dlang.org/show_bug.cgi?id=17566
> 
> In general I can agree with the rationale to not allow stack frames 
> larger than 4K when it comes to normal programming, it makes sense. 
> However, since D is supposed to be a "systems programming language" the 
> language should not dictate what the programmer should be able to do 
> with the stack. It also assumes things that all systems have 4K page 
> sizes, that the stack should be used moderately. There might be cases 
> when the programmer wants to go nuts with stack and do a lot storage on 
> it, for whatever reason. Therefore I think this limit should not be a 
> language definition.
> 
> First this 4K limit should be configurable per operating system. Also 
> there should be an option to override this limit, for example with a 
> compiler option.

Could this be fixed by not allowing *uninitialized* stack segments 
larger than 4k? Basically, if you can't create a stack which contains a 
contiguous 4k of uninitialized space, then you can't skip over the guard 
page.

void-initialized data is pretty rare in D.

-Steve


More information about the Digitalmars-d mailing list