On Sunday, 13 July 2014 at 23:35:46 UTC, Walter Bright wrote:
On 7/13/2014 4:04 AM, "Marc Schütz" <schue...@gmx.net>" wrote:
On Sunday, 13 July 2014 at 03:25:08 UTC, Walter Bright wrote:
On 7/11/2014 10:28 AM, deadalnix wrote:
The compiler can ensure that you hit at least every 4k or so.

And it already does.

Doesn't look so:


    int bar(int a) {
        int[8000] b = void;
        b[$-1] = a;
        return b[$-1];
    }

On Win32:

_D4foo53barFiZi comdat
        assume  CS:_D4foo53barFiZi
                push    EBP
                mov     EBP,ESP
                mov     EDX,7
L8:             sub     ESP,01000h
                test    [ESP],ESP
                dec     EDX
                jne     L8
                sub     ESP,0D04h
                lea     ECX,-8[EBP]
                mov     [ECX],EAX
                mov     EAX,-8[EBP]
                leave
                ret

It doesn't do it on Linux because gcc doesn't do it. But the capability is in the back end, and it does it for alloca(), too.

Hmm... but this using DMD, not GDC. Or do you mean that DMD doesn't do it, because GCC doesn't do it either? If so, what is the reason for this? Why shouldn't this feature be enabled on every platform?

Reply via email to