digitalmars.D.bugs - [Issue 4298] New: Constant array translated to unnecessary array literal creation
- d-bugmail puremagic.com (47/47) Jun 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4298
- d-bugmail puremagic.com (29/29) Jun 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4298
- d-bugmail puremagic.com (26/26) Jun 15 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4298
- d-bugmail puremagic.com (14/19) Jun 15 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4298
- d-bugmail puremagic.com (10/10) Jul 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4298
- d-bugmail puremagic.com (10/10) Sep 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4298
- d-bugmail puremagic.com (12/12) Feb 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4298
http://d.puremagic.com/issues/show_bug.cgi?id=4298 Summary: Constant array translated to unnecessary array literal creation Product: D Version: 2.041 Platform: x86 OS/Version: All Status: NEW Keywords: performance Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: rsinfu gmail.com --- Using constant (const or immutable) dynamic array causes unnecessary array literal creation if the constant array has an initializer. This behavior degrades performance, and also causes the bug 4297. Test code and the disassembled output: -------------------- immutable int[] TABLE = [ 1, 2, 3 ]; void foo() { const(int)[] tab = TABLE; } -------------------- _D4test3fooFZv: push EBP mov EBP,ESP push EBX push 3 push 2 push 1 push 3 mov EAX,offset FLAT:_D12TypeInfo_Axi6__initZ SYM32 push EAX call _d_arrayliteralT PC32 mov ECX,EAX mov EBX,3 add ESP,014h pop EBX pop EBP ret -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298 Shin Fujishiro <rsinfu gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Patch against DMD r526: ==================== --- src/optimize.c +++ src/optimize.c -58,10 +58,9 Expression *expandVar(int result, VarDeclaration *v) return e; } - Type *tb = v->type->toBasetype(); if (result & WANTinterpret || v->storage_class & STCmanifest || - (tb->ty != Tsarray && tb->ty != Tstruct) + v->type->isscalar() ) { if (v->init) ==================== The if condition is changed so that only scalar constants are expanded. Affected types are Tarray, Taarray, Tclass and Tdelegate. Arrays and associative arrays should not be expanded (the reported problem); classes and delegates are not necessary to be expanded. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298 Shin Fujishiro <rsinfu gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|patch | --- -------------------- void main() { immutable s = "abc"; auto t = s[0 .. $ - 1]; } -------------------- % dmd -run test test.o(.text._Dmain+0x1a): In function `_Dmain': : undefined reference to `_D4test4mainFZv8__dollarxk' -------------------- The link error does not occur if the dollar $ is replaced with s.length. The real cause of the link error may be elsewhere (only $ causes a link error?), but the patch itself doesn't work anyway. So I remove the 'patch' keyword. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 15 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298 Shin Fujishiro <rsinfu gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch Depends on| |3779 ---The link error does not occur if the dollar $ is replaced with s.length. The real cause of the link error may be elsewhere (only $ causes a link error?), but the patch itself doesn't work anyway. So I remove the 'patch' keyword.The linker error about __dollar is caused by bug 3779. I think the patch in a dependency to bug 3779. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 15 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dsimcha yahoo.com *** Issue 3370 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: -------
Jul 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |r.sagitario gmx.de *** Issue 4631 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: -------
Sep 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 2356 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2012