Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 26, 2014 Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
The language reference on functions [1] says: "If a FunctionLiteral is immediately called, its inlining would be enforced normally." How is this to be interpreted? [1] http://dlang.org/function |
July 26, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Saturday, 26 July 2014 at 17:55:55 UTC, Marc Schütz wrote:
> The language reference on functions [1] says:
>
> "If a FunctionLiteral is immediately called, its inlining would be enforced normally."
>
> How is this to be interpreted?
>
> [1] http://dlang.org/function
I would interpret that as saying it's a pretty fair bet that it will be inlined by an optimising compiler. Especially with LDC or GDC. DMD I think is often lacking in optimisations, but I use it during development pretty excessively due to its compilation speed and DMD always being the first to support all recent language features.
|
July 26, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marc Schütz | On Saturday, 26 July 2014 at 17:55:55 UTC, Marc Schütz wrote:
> The language reference on functions [1] says:
>
> "If a FunctionLiteral is immediately called, its inlining would be enforced normally."
>
> How is this to be interpreted?
>
> [1] http://dlang.org/function
I can't PR but there were one by Kenji that did inline of such calls in the frontend providing 100% gurantee whatever backend is used.
|
July 26, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Saturday, 26 July 2014 at 22:24:40 UTC, Dicebot wrote:
> On Saturday, 26 July 2014 at 17:55:55 UTC, Marc Schütz wrote:
>> The language reference on functions [1] says:
>>
>> "If a FunctionLiteral is immediately called, its inlining would be enforced normally."
>>
>> How is this to be interpreted?
>>
>> [1] http://dlang.org/function
>
> I can't PR but there were one by Kenji that did inline of such calls in the frontend providing 100% gurantee whatever backend is used.
Nice, that's a pretty good guarantee to have.
|
July 27, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On 26 July 2014 23:24, Dicebot via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Saturday, 26 July 2014 at 17:55:55 UTC, Marc Schütz wrote:
>>
>> The language reference on functions [1] says:
>>
>> "If a FunctionLiteral is immediately called, its inlining would be enforced normally."
>>
>> How is this to be interpreted?
>>
>> [1] http://dlang.org/function
>
>
> I can't PR but there were one by Kenji that did inline of such calls in the frontend providing 100% gurantee whatever backend is used.
I'd be the sceptic of that. Which file exactly did he change? (hint: It may be ignored by other compilers).
|
July 27, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | On Sunday, 27 July 2014 at 00:43:41 UTC, Iain Buclaw via Digitalmars-d wrote: > I'd be the sceptic of that. Which file exactly did he change? (hint: > It may be ignored by other compilers). Oh crap it is still open :D (and judging by comments there you should more aware of what does than me) : https://github.com/D-Programming-Language/dmd/pull/2483 |
July 27, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot Attachments:
| On 27 Jul 2014 02:10, "Dicebot via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: > > On Sunday, 27 July 2014 at 00:43:41 UTC, Iain Buclaw via Digitalmars-d wrote: >> >> I'd be the sceptic of that. Which file exactly did he change? (hint: It may be ignored by other compilers). > > > Oh crap it is still open :D (and judging by comments there you should more aware of what does than me) : https://github.com/D-Programming-Language/dmd/pull/2483 Oh yes, I think I recall that. As per my old comments, it uses frontend inlining to fix the issue. As per mine and David's old comments, frontend inlining is bad for GDC and LDC. It almost always results in strange codegen, or triggers asserts for internal tree checking, or just ICE's the compiler. Iain. |
July 27, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | "Dicebot" wrote in message news:xpjsskmamagclzoiwtxb@forum.dlang.org... > I can't PR but there were one by Kenji that did inline of such calls in the frontend providing 100% gurantee whatever backend is used. There is no 100% guarantee, the frontend's inliner is not capable of inlining the majority of function calls. The only guarantee is that it will try to inline the lambda whether or not the -inline switch is used. |
July 27, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Sunday, 27 July 2014 at 07:01:52 UTC, Daniel Murphy wrote:
> "Dicebot" wrote in message news:xpjsskmamagclzoiwtxb@forum.dlang.org...
>
>> I can't PR but there were one by Kenji that did inline of such calls in the frontend providing 100% gurantee whatever backend is used.
>
> There is no 100% guarantee, the frontend's inliner is not capable of inlining the majority of function calls. The only guarantee is that it will try to inline the lambda whether or not the -inline switch is used.
Too bad... If it was guaranteed, there would then be a compiler independent way to force inlining. Is there a chance that the limits to inlining in DMD will ever be removed?
|
July 27, 2014 Re: Inlining of immediately called function literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Sunday, 27 July 2014 at 01:06:43 UTC, Dicebot wrote:
> On Sunday, 27 July 2014 at 00:43:41 UTC, Iain Buclaw via Digitalmars-d wrote:
>> I'd be the sceptic of that. Which file exactly did he change? (hint:
>> It may be ignored by other compilers).
>
> Oh crap it is still open :D (and judging by comments there you should more aware of what does than me) : https://github.com/D-Programming-Language/dmd/pull/2483
Ok, so the documentation changes went in before the actual feature was merged. I think they need to be more clear, anyway. It should at least explain why there is no guarantee, or better yet, describe which subset of functions is guaranteed to be inlined.
|
Copyright © 1999-2021 by the D Language Foundation