Jump to page: 1 2
Thread overview
pragma(inline, true) not very useful in its current state?
Sep 24, 2015
David Nadlinger
Sep 24, 2015
John Colvin
Sep 26, 2015
Manu
Sep 24, 2015
Jack Stouffer
Sep 24, 2015
Walter Bright
Sep 26, 2015
Iain Buclaw
Sep 26, 2015
Manu
Sep 26, 2015
Dmitry Olshansky
Sep 26, 2015
Jacob Carlborg
Sep 26, 2015
Marco Leise
Sep 26, 2015
Johannes Pfau
Sep 26, 2015
Artur Skawina
Sep 27, 2015
Marco Leise
Sep 27, 2015
Artur Skawina
Sep 27, 2015
Marco Leise
Sep 26, 2015
Jacob Carlborg
Sep 27, 2015
Marco Leise
Sep 26, 2015
Iain Buclaw
September 24, 2015
Hi all,

I'm not even referring to the multitude of restrictions in the DMD frontend inliner here. When looking into the remaining 2.068 test failures for LDC, I was surprised to find out that DMD only honors pragma(inline, true) when -inline is actually passed on the command line.

This seems to be completely against what many people I spoke to (including, of course, our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans) cite as one of the primary use cases for the feature, which is to force inlining of certain functions even in debug builds.

What were the reasons behind this decision?

 — David
September 24, 2015
On Thursday, 24 September 2015 at 15:47:45 UTC, David Nadlinger wrote:
> Hi all,
>
> I'm not even referring to the multitude of restrictions in the DMD frontend inliner here. When looking into the remaining 2.068 test failures for LDC, I was surprised to find out that DMD only honors pragma(inline, true) when -inline is actually passed on the command line.
>
> This seems to be completely against what many people I spoke to (including, of course, our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans) cite as one of the primary use cases for the feature, which is to force inlining of certain functions even in debug builds.
>
> What were the reasons behind this decision?
>
>  — David

Can't ldc and gdc just be sane and let dmd carry on being (ahem) odd.
September 24, 2015
On Thursday, 24 September 2015 at 15:47:45 UTC, David Nadlinger wrote:
> which is to force inlining of certain functions even in debug builds.

I don't understand what the problem is. Just pass -inline in your debug build.
September 24, 2015
On 9/24/2015 8:47 AM, David Nadlinger wrote:
> What were the reasons behind this decision?

The trouble is the compiler does inlining as a top down traversal, whereas forcing inline with no -inline would be a bottom up thing. The compiler could always do the top down traversal, but it would make compilations slower, whether any force inlines exist or not.
September 26, 2015
On 25 September 2015 at 04:10, John Colvin via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Thursday, 24 September 2015 at 15:47:45 UTC, David Nadlinger wrote:
>>
>> Hi all,
>>
>> I'm not even referring to the multitude of restrictions in the DMD frontend inliner here. When looking into the remaining 2.068 test failures for LDC, I was surprised to find out that DMD only honors pragma(inline, true) when -inline is actually passed on the command line.
>>
>> This seems to be completely against what many people I spoke to (including, of course, our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans) cite as one of the primary use cases for the feature, which is to force inlining of certain functions even in debug builds.
>>
>> What were the reasons behind this decision?
>>
>>  — David
>
>
> Can't ldc and gdc just be sane and let dmd carry on being (ahem) odd.

This. Please.

September 26, 2015
On 25 September 2015 at 01:47, David Nadlinger via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> Hi all,
>
> [...]
> our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans

Bah, I'm not sure what this means. If you mean I advocate for things
that are perfect how they are in C/C++, precedented by decades of use
and millions of developers, remaining as people expect them to be...
then yes.
C++ didn't get *everything* wrong, otherwise D wouldn't be so much
like C++ to begin with. __forceinline in C++ is exactly what people
want here. The behaviour is useful, and well understood; compiler will
always inline if possible, and warn if it can't. There's nothing wrong
with C++ in this case, and I wish D would just be the same.

I'm happy for DMD to not inline anything in debug if it's technically impossible due to compiler architecture, but it's not useful as an error, that just forces you to remove it from your code if you want it to compile. We don't have any tools in D at all to control whether attributes like inline should or shouldn't be present between different build configurations. We _really_ need attribute aliasing in some form, especially since LDC/GDC have compiler-specific attributes that DMD doesn't recognise.
September 26, 2015
On 26 Sep 2015 6:27 am, "Manu via Digitalmars-d" < digitalmars-d@puremagic.com> wrote:
>
> On 25 September 2015 at 01:47, David Nadlinger via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> > Hi all,
> >
> > [...]
> > our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans
>
> Bah, I'm not sure what this means. If you mean I advocate for things
> that are perfect how they are in C/C++, precedented by decades of use
> and millions of developers, remaining as people expect them to be...
> then yes.
> C++ didn't get *everything* wrong, otherwise D wouldn't be so much
> like C++ to begin with. __forceinline in C++ is exactly what people
> want here. The behaviour is useful, and well understood; compiler will
> always inline if possible, and warn if it can't. There's nothing wrong
> with C++ in this case, and I wish D would just be the same.
>
> I'm happy for DMD to not inline anything in debug if it's technically impossible due to compiler architecture, but it's not useful as an error, that just forces you to remove it from your code if you want it to compile.

Not sure of oddness of dmd, but there should be only a few reasons why a function is uninlinable, all of them being low level things such as inline assembly, calls to alloca.  Assuming that the function body is available at compile-time too. ;-)


September 26, 2015
On 24 Sep 2015 9:46 pm, "Walter Bright via Digitalmars-d" < digitalmars-d@puremagic.com> wrote:
>
> On 9/24/2015 8:47 AM, David Nadlinger wrote:
>>
>> What were the reasons behind this decision?
>
>
> The trouble is the compiler does inlining as a top down traversal,
whereas forcing inline with no -inline would be a bottom up thing. The compiler could always do the top down traversal, but it would make compilations slower, whether any force inlines exist or not.

Isn't this just a problem with dmd's inliner/inlining strategy? (Mixed in
with its need for speed)


September 26, 2015
On 26-Sep-2015 07:27, Manu via Digitalmars-d wrote:
> On 25 September 2015 at 01:47, David Nadlinger via Digitalmars-d
> <digitalmars-d@puremagic.com> wrote:
>> Hi all,
>>
>> [...]
>> our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans
>
> Bah, I'm not sure what this means. If you mean I advocate for things
> that are perfect how they are in C/C++,

> precedented by decades of use
> and millions of developers,

Technically millions could be wrong as easily as a single individual, in fact more likely so due to collective bias.

> remaining as people expect them to be...
> then yes.

> C++ didn't get *everything* wrong, otherwise D wouldn't be so much
> like C++ to begin with. __forceinline in C++ is exactly what people
> want here. The behaviour is useful, and well understood; compiler will
> always inline if possible, and warn if it can't. There's nothing wrong
> with C++ in this case, and I wish D would just be the same.
>


Agreed.


-- 
Dmitry Olshansky
September 26, 2015
On 2015-09-26 06:27, Manu via Digitalmars-d wrote:

> We _really_ need attribute aliasing in
> some form, especially since LDC/GDC have compiler-specific attributes
> that DMD doesn't recognise.

I'm not sure how much this helps but can't you use a dummy UDA on DMD for the GDC/LDC attributes?

-- 
/Jacob Carlborg
« First   ‹ Prev
1 2