[Issue 11345] New: Optimize array literal to static array assignment to not allocate on GC heap

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 24 13:16:46 PDT 2013


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 at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-10-25 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: -------


More information about the Digitalmars-d-bugs mailing list