Software Assurance Reference Dataset
via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 13 04:04:26 PDT 2014
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 foo(int a) {
int[100] b = void;
b[$-1] = a;
return b[$-1];
}
int bar(int a) {
int[8000] b = void;
b[$-1] = a;
return b[$-1];
}
# objdump -d bigstack.o | ddemangle | less
Disassembly of section .text.int bigstack.foo(int):
0000000000000000 <int bigstack.foo(int)>:
0: 55 push %rbp
1: 48 8b ec mov %rsp,%rbp
4: 48 81 ec a0 01 00 00 sub $0x1a0,%rsp
b: 48 8d 45 f4 lea -0xc(%rbp),%rax
f: 89 38 mov %edi,(%rax)
11: 8b 45 f4 mov -0xc(%rbp),%eax
14: c9 leaveq
15: c3 retq
16: 66 90 xchg %ax,%ax
Disassembly of section .text.int bigstack.bar(int):
0000000000000000 <int bigstack.bar(int)>:
0: 55 push %rbp
1: 48 8b ec mov %rsp,%rbp
4: 48 81 ec 10 7d 00 00 sub $0x7d10,%rsp
b: 48 8d 45 f4 lea -0xc(%rbp),%rax
f: 89 38 mov %edi,(%rax)
11: 8b 45 f4 mov -0xc(%rbp),%eax
14: c9 leaveq
15: c3 retq
16: 66 90 xchg %ax,%ax
(This is with DMD master on Linux x86_64. Same with -m32.)
More information about the Digitalmars-d
mailing list