[Bug 139] GDC writes all-zero initialisers in the rodata section

via D.gnu d.gnu at puremagic.com
Sat Jul 12 07:07:50 PDT 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=139

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject.org> ---
FYI, the backend does *almost* the right thing.


        .globl  _D4test6Buffer6__initZ
        .section        .rodata
        .align 64
        .type   _D4test6Buffer6__initZ, @object
        .size   _D4test6Buffer6__initZ, 65536
_D4test6Buffer6__initZ:
        .zero   65536


It is able to correctly recognise that the initialiser is all zeros, and
reduces it to .zero 65536.  Unfortunately, because there *is* an initialiser in
the first place means that it puts it in .section .rodata, instead of
optimising for size and putting it in .bss

What we should be doing is checking if initializer_zerop, then undoing our
work.

This has a run-time cost (it would be nice to have a test for all zeros before
building and discarding trees) but for the size reduction, it would be worth
it.

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20140712/3182990f/attachment.html>


More information about the D.gnu mailing list