http://d.puremagic.com/issues/show_bug.cgi?id=3490
Summary: DMD Never Inlines Functions that Could Throw
Product: D
Version: 2.036
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: performance
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from David Simcha <[email protected]> 2009-11-09 06:26:18 PST ---
Here's an absurdly simple test program. enforceStuff() does not get inlined,
as the disassembly below shows. I couldn't find anything about exceptions in
inline.c, but if this doesn't get inlined, I assume nothing that could throw
ever does.
This severely affects the performance of std.range, since Andrei uses enforce()
all over the place, causing lots of stuff not to be inlined. For example, I
read disassemblies involving std.range.Take and it seems like Take.popFront()
and Take.front() are never inlined.
void main() {
enforceStuff(1);
}
void enforceStuff(uint num) { // Not inlined.
if(num == 0) {
throw new Exception("");
}
}
Disassembly of main():
__Dmain PROC NEAR
; COMDEF __Dmain
push eax ; 0000 _ 50
mov eax, 1 ; 0001 _ B8, 00000001
call _D5test812enforceStuffFkZv ; 0006 _ E8,
00000000(rel)
xor eax, eax ; 000B _ 31. C0
pop ecx ; 000D _ 59
ret ; 000E _ C3
__Dmain ENDP
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------