[Issue 10848] New: Compiler should always try to inlining a direct lambda call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 18:50:34 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10848

           Summary: Compiler should always try to inlining a direct lambda
                    call
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: performance, spec
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-08-18 18:50:33 PDT ---
Example code:

  void main() @safe {
    int n;
    auto p = (ref n)@trusted{ return &n; }(n);
  }

Command line:

  dmd test.d

does not inline the immediate lambda call. It would make performance penalty.

And, such lambda call is sometimes necessary for marking specific system
operation as @trusted.

---

I think the D spec should mention about the case like as follows:

"If a function literal is immediately called, compiler always try to inline the
call expression in-place."

-- 
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