www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11345] New: Optimize array literal to static array assignment to not allocate on GC heap

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

           Summary: Optimize array literal to static array assignment to
                    not allocate on GC heap
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: performance
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



00:16:45 MSD ---
This has already been introduced when fixing Issue 2356 in dmd pull 1883 [1]
but was reverted because of Issue 11238 in dmd pull 2682 [2]:
---
void main()
{
    int[2] m = [4, 6]; // optimized (Issue 2356)
    m = [m[1], m[0]]; // swap, currently calls `_d_arrayliteralTX`
    assert(m == [6, 4]);
}
---

Instead of calling `_d_arrayliteralTX` it should be rewritten to create a
temporary static array if needed.


[1] https://github.com/D-Programming-Language/dmd/pull/1883
[2] https://github.com/D-Programming-Language/dmd/pull/2682

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


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sean invisibleduck.org



00:24:40 MSD ---
*** Issue 4881 has been marked as a duplicate of this issue. ***

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