www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11237] New: zero initializer emitted to read-only data segment, slow compilation

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237

           Summary: zero initializer emitted to read-only data segment,
                    slow compilation
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu



cat > bug.d << CODE
struct Buffer { ubyte[64 * 1024] buffer; }
CODE

dmd -c bug

----

The compilation takes forever (5s) due to the reasons named in
http://d.puremagic.com/issues/show_bug.cgi?id=10866#c20.
It's a regression introduced after v2.063.2 that the initializer
is not emitted as BSS symbol.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 11233 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |



Bug 11233 was resolved which dix the performance issue.
We still need to do something about the rdata vs. BSS thing, otherwise zero
initializers use up unnecessary space in the object files.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237




13:12:20 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2660

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ba8b515e0adc6471aeef0bb1cca6a4092c15c037
fix Issue 11237 - zero initializer emitted to read-only data segment, slow
compilation

https://github.com/D-Programming-Language/dmd/commit/fc9b88cddaf3a279dcf5ce1ec8b262c4a47020e1


fix Issue 11237 - zero initializer emitted to read-only data segment, sl...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237




Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/056d444ceb70ede8dff9b5fcca5deadb42c21433


fix Issue 11237 - zero initializer emitted to read-only data segment, sl...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |



The broke struct initializers.
They are emitted to object files with a symbol size of 1 byte regardless of
their actual size.
Also I wonder why the initializer are now common symbols ('V') while they
previously were normal uninitialized variables ('B').

Test case

cat > bug.d << CODE
struct Buffer { ubyte[64 * 1024] buffer; }
CODE

dmd2.063.2 -c bug
nm -S bug.o
0000000000000000 0000000000010000 B _D4bug26Buffer6__initZ

// 1-byte size and weak object
dmd2.064 -c bug
nm -S bug.o
0000000000000000 0000000000000001 V _D4bug26Buffer6__initZ

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 31 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, wrong-code



https://github.com/D-Programming-Language/dmd/pull/2701

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 31 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a7985b238c08da200f1c68c50a52ee6f7aa7c941
fix ElfObj::common_block size

- fix Issue 11237

- Need to explicitly pass the size of the defined common
  symbol as it can't be computed from the symbol type.

https://github.com/D-Programming-Language/dmd/commit/ac537e9b7eb7f2910bbbbb6022a26e3eb08e348e
struct initializer are not weak symbols

- fix Issue 11237

- The function outdata will take care of the
  BSS optimization for DTallzeros.

https://github.com/D-Programming-Language/dmd/commit/77632a636ae16605bb45c9f6f0ce0932adbfcf82
add test case for Issue 11237

- fix OS name of linux in Makefile

https://github.com/D-Programming-Language/dmd/commit/37e15abcd77a67423f166d9de6895b63e22c4676


fix Issue 11237

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237




Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/273baf36ccd718749f4f68c1d11473a64f473211


fix Issue 11237

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 01 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11237


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2013