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

Luis Luis.panadero at gmail.com
Mon Jun 28 07:27:46 UTC 2021


On Monday, 28 June 2021 at 07:10:05 UTC, Ola Fosheim Grøstad 
wrote:
> On Sunday, 27 June 2021 at 22:16:12 UTC, IGotD- wrote:
>> That's a good observation. Does this mean that the point of 
>> the suggested 4K limit falls?
>
> No, because the compiler can refuse to inline, but it is a bad 
> idea.
>
> It also means that safe functions cannot call FFI, how can you 
> prove that FFI does not exceed 4K after inlining?
>
> D is trying to become a high level language, but is also aiming 
> to be system level and that is not really an attainable goal. 
> You have to make a choice. It would be better for D to not go 
> for 100% safe, but instead prevent common mistakes.
>
> I've never ran out of stack for any code I've written ever.
>
> Maybe that means allocating larger stacks so that guard pages 
> are never hit, add more guard pages and simply terminate when 
> guard pages are hit.
>
> Other alternatives: do stack depth analysis, add stack less 
> coroutines.
>
> Anyway, for a system level language, those choices should be at 
> the hand of the programmer. I agree with you on that.

I'm pretty worried how this would affect the actual 
coroutines/fibers implementation. I'm slowly trying to write a 
retro game engine that uses a lot of fibers (hundreds!) on a 
single thread.


More information about the Digitalmars-d mailing list