digitalmars.D.bugs - [Issue 9655] New: Two functions with identical implementations are allowed to have the same address
- d-bugmail puremagic.com (33/33) Mar 05 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9655
- d-bugmail puremagic.com (20/39) Mar 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9655
http://d.puremagic.com/issues/show_bug.cgi?id=9655 Summary: Two functions with identical implementations are allowed to have the same address Product: D Version: D2 Platform: All URL: http://www.informit.com/guides/content.aspx?g=cplusplu s&seqNum=561 OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: websites AssignedTo: nobody puremagic.com ReportedBy: bugzilla digitalmars.com 21:54:35 PST --- In regards to: http://d.puremagic.com/issues/show_bug.cgi?id=9623 Related C++ article "Can Two Functions Have the Same Address?" http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=561 This quote pretty much sells me: -- Additionally, Google's compiler team have experimented with Identical Code Folding (ICF) and reported that "[d]etailed experiments on the x86 platform show that ICF can reduce the text size [the program section in which functions' code is stored, DK] of some Google binaries, whose average text size is 50 MB, by up to 7%." -- We should settle the issue by updating the D spec to explicitly allow functions to have the same address. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 05 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9655 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccIn regards to: http://d.puremagic.com/issues/show_bug.cgi?id=9623 Related C++ article "Can Two Functions Have the Same Address?" http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=561 This quote pretty much sells me: -- Additionally, Google's compiler team have experimented with Identical Code Folding (ICF) and reported that "[d]etailed experiments on the x86 platform show that ICF can reduce the text size [the program section in which functions' code is stored, DK] of some Google binaries, whose average text size is 50 MB, by up to 7%." -- We should settle the issue by updating the D spec to explicitly allow functions to have the same address.1) What are the downsides of such folding in D? 2) Since recently, LLVM (used by LDC) folds identical functions if you use a compiler switch. IF you use such switch, where the compiler sees two identical functions, replaces one of them with just a jump to the other. So their address is distinct, but the amount of wasted space in the binary is minimal. 3) Often templates generate not just identical functions, but functions that differ only in a small part, for only few asm instructions. So a good D compiler could try to split those functions in virtual chunks (maybe if the parts are not inside a loop), keep only one copy of the shared part. I presume this is not easy to do in general. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 06 2013