[Issue 4440] [patch] Inlining delegate literals
https://issues.dlang.org/show_bug.cgi?id=4440 Iain Buclaw changed: What|Removed |Added Priority|P2 |P3 --
[Issue 4440] [patch] Inlining delegate literals
https://issues.dlang.org/show_bug.cgi?id=4440 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #11 from Walter Bright bugzi...@digitalmars.com --- You're right, Brad. Fixing this involves doing constant propagation in the front end. It's possible to do it, as constant propagation is the easiest of the data flow optimizations to do. --
[Issue 4440] [patch] Inlining delegate literals
https://issues.dlang.org/show_bug.cgi?id=4440 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Hardware|Other |All --
[Issue 4440] [patch] Inlining delegate literals
https://issues.dlang.org/show_bug.cgi?id=4440 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Keywords||performance --
[Issue 4440] [patch] Inlining delegate literals
https://issues.dlang.org/show_bug.cgi?id=4440 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=9785 --
[Issue 4440] [patch] Inlining delegate literals
https://issues.dlang.org/show_bug.cgi?id=4440 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|D1 D2 |D2 --
[Issue 4440] [patch] Inlining delegate literals
http://d.puremagic.com/issues/show_bug.cgi?id=4440 David Simcha dsim...@yahoo.com changed: What|Removed |Added Blocks||4264 Summary|[patch] inlined delegates |[patch] Inlining delegate |produces different asm than |literals |straight lined code | --- Comment #8 from David Simcha dsim...@yahoo.com 2010-08-29 13:55:31 PDT --- Blocks 4264 because I need delegate literal inlining to get decent performance out of opApply-based map, filter, etc. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4440] [patch] Inlining delegate literals
http://d.puremagic.com/issues/show_bug.cgi?id=4440 --- Comment #9 from David Simcha dsim...@yahoo.com 2010-08-29 14:26:50 PDT --- I just tried this patch out and on second thought I'm not sure it's worth integrating as-is because it's so limited. It won't even handle the case where a function that calls a delegate gets inlined and the delegate passed from the call site is a literal. Even the following doesn't get inlined: bool evaluateDelegate(bool delegate() dg) { return dg(); } void main() { evaluateDelegate({return false;}); } Here's the disassembly of main(): __Dmain PROC NEAR ; COMDEF __Dmain sub esp, 24 ; _ 83. EC, 18 xor eax, eax; 0003 _ 31. C0 mov ecx, offset _D5test94mainFZv12__dgliteral1MFZb; 0005 _ B9, (segrel) pushebx ; 000A _ 53 mov edx, ecx; 000B _ 8B. D1 mov dword ptr [esp+4H], eax ; 000D _ 89. 44 24, 04 mov eax, dword ptr [esp+4H] ; 0011 _ 8B. 44 24, 04 mov ebx, dword ptr [esp+4H] ; 0015 _ 8B. 5C 24, 04 mov dword ptr [esp+8H], ecx ; 0019 _ 89. 4C 24, 08 calledx ; 001D _ FF. D2 xor eax, eax; 001F _ 31. C0 pop ebx ; 0021 _ 5B add esp, 24 ; 0022 _ 83. C4, 18 ret ; 0025 _ C3 __Dmain ENDP -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4440] [patch] Inlining delegate literals
http://d.puremagic.com/issues/show_bug.cgi?id=4440 --- Comment #10 from Brad Roberts bra...@puremagic.com 2010-08-29 14:31:55 PDT --- Agreed. Getting delegate inlining in dmd is going to take serious work. The problem is that the inliner is no where near a const propagation pass. It needs to know that the variables in play have a single, unchangeable, value. At the point of inlining, there's just a variable with an unknown -- to the compiler -- value. So, while this change does help that one narrow use case, it's of almost no practical value. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---