Spin-off issue from: https://issues.dlang.org/show_bug.cgi?id=13952
> The amount of code generated for the constructor is still worrisome.
> Especially the part that initializes X86Reg, because it initializes every field individually, it constructs a temporary on the stack only to end up loading zero into edx.
Comment #1 by code — 2015-03-20T01:20:23Z
cat > bug.d << CODE
struct Bug
{
size_t[16 * 1024] data;
}
void test()
{
auto b = Bug();
}
CODE
----
dmd -c bug
----
It looks like related to issue 11233, but is most likely due to the change struct literal code, that not performs field assignment instead of copying the init array.
Comment #2 by code — 2015-03-20T01:24:52Z
mov %eax,-0x20000(%rbp)
mov %eax,-0x1fffc(%rbp)
mov %eax,-0x1fff8(%rbp)
...
mov %ecx,-0x1f804(%rbp)
xor %edx,%edx // Why edx all of a sudden?
mov %edx,-0x1f800(%rbp)
...
mov %edx,-0xc(%rbp)
mov %edx,-0x8(%rbp)
mov %edx,-0x4(%rbp)
In total 32768 4-byte assignments to initialize the struct.