digitalmars.D - Inlining of immediately called function literals
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (5/5) Jul 26 2014 The language reference on functions [1] says:
- w0rp (7/12) Jul 26 2014 I would interpret that as saying it's a pretty fair bet that it
- Dicebot (4/9) Jul 26 2014 I can't PR but there were one by Kenji that did inline of such
- w0rp (2/14) Jul 26 2014 Nice, that's a pretty good guarantee to have.
- Iain Buclaw via Digitalmars-d (4/16) Jul 26 2014 I'd be the sceptic of that. Which file exactly did he change? (hint:
- Dicebot (5/8) Jul 26 2014 Oh crap it is still open :D (and judging by comments there you
- Iain Buclaw via Digitalmars-d (11/16) Jul 26 2014 wrote:
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (6/14) Jul 27 2014 Ok, so the documentation changes went in before the actual
- Daniel Murphy (4/6) Jul 27 2014 There is no 100% guarantee, the frontend's inliner is not capable of
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (4/13) Jul 27 2014 Too bad... If it was guaranteed, there would then be a compiler
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (5/20) Jul 27 2014 IIRC the core reason is that expression nodes in the AST cannot
- Daniel Murphy (4/7) Jul 27 2014 Sure, but that would be horrible (from an implementation point of view)....
- Andrei Alexandrescu (4/12) Jul 27 2014 Ionno. There are a few high-level constructs in D that are amenable to
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
Jul 26 2014
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/functionI 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.
Jul 26 2014
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/functionI 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.
Jul 26 2014
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:Nice, that's a pretty good guarantee to have.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/functionI 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.
Jul 26 2014
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:I'd be the sceptic of that. Which file exactly did he change? (hint: It may be ignored by other compilers).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/functionI 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.
Jul 26 2014
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
Jul 26 2014
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-dwrote: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.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
Jul 26 2014
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: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.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
Jul 27 2014
"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.
Jul 27 2014
On Sunday, 27 July 2014 at 07:01:52 UTC, Daniel Murphy wrote:"Dicebot" wrote in message news:xpjsskmamagclzoiwtxb forum.dlang.org...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?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.
Jul 27 2014
On Sunday, 27 July 2014 at 07:48:18 UTC, Marc Schütz wrote:On Sunday, 27 July 2014 at 07:01:52 UTC, Daniel Murphy wrote:IIRC the core reason is that expression nodes in the AST cannot contain statements. Isn't it possible to create a "bridge" node type that is allowed to appear in expressions, but may also contain statements?"Dicebot" wrote in message news:xpjsskmamagclzoiwtxb forum.dlang.org...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?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.
Jul 27 2014
"Marc Schütz" " wrote in message news:gefktpkzfnlryljvwmqa forum.dlang.org...IIRC the core reason is that expression nodes in the AST cannot contain statements. Isn't it possible to create a "bridge" node type that is allowed to appear in expressions, but may also contain statements?Sure, but that would be horrible (from an implementation point of view). The better way is to use an ir/backend inliner, ie use gdc or ldc.
Jul 27 2014
On 7/27/14, 1:35 AM, Daniel Murphy wrote:"Marc Schütz" " wrote in message news:gefktpkzfnlryljvwmqa forum.dlang.org...Ionno. There are a few high-level constructs in D that are amenable to front-end inlining - doing so in the backend entails quite a bit of assembling the cow back from the burger. -- AndreiIIRC the core reason is that expression nodes in the AST cannot contain statements. Isn't it possible to create a "bridge" node type that is allowed to appear in expressions, but may also contain statements?Sure, but that would be horrible (from an implementation point of view). The better way is to use an ir/backend inliner, ie use gdc or ldc.
Jul 27 2014