Thread overview
[Bug 205] Add pragma(inline) to the grammar
Jan 31, 2016
Daniel Murphy
Jan 31, 2016
Iain Buclaw
Jan 31, 2016
Iain Buclaw
Jan 31, 2016
Iain Buclaw
Jun 08, 2016
Iain Buclaw
January 29, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

thomas.bockman@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from thomas.bockman@gmail.com ---
I figured out an acceptable workaround for this problem, although it is just a little bit silly. This:

pragma(inline, true) {
}

Can be replaced with this:

redundant_attribute { pragma(inline, true);
}

Where redundant_attribute is some attribute that belongs on the contained declarations anyway, such as `public` or `@safe`.

It doesn't look very nice, but it works. I presume the real fix will be added naturally during the upgrade to 2.068, so I'm closing this as "RESOLVED - INVALID".

Sorry for the noise.

-- 
You are receiving this mail because:
You are watching all bug changes.

January 29, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

thomas.bockman@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |---
             Status|RESOLVED                    |NEW

--- Comment #2 from thomas.bockman@gmail.com ---
Nevermind - although it compiles, it turns out that my workaround doesn't actually control inlining on DMD.

So, I still need
    pragma(inline, true):
Or
    pragma(inline, true {
    }
Added to the GDC grammar to be able to share one code base across all the major
compilers.

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

Daniel Murphy <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com

--- Comment #3 from Daniel Murphy <yebblies@gmail.com> ---
(In reply to thomas.bockman from comment #2)
> Nevermind - although it compiles, it turns out that my workaround doesn't actually control inlining on DMD.
> 
> So, I still need
>     pragma(inline, true):
> Or
>     pragma(inline, true {
>     }
> Added to the GDC grammar to be able to share one code base across all the
> major compilers.

What about moving the pragma inside the function?

void func()
{
    version (DigitalMars)
    {
        pragma(inline, true);
    }
}

void main()
{
    func();
}

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

--- Comment #4 from thomas.bockman@gmail.com ---
> What about moving the pragma inside the function?

That way does work, although only with the `version` guard.

Adding such a block to every. single. function. that needs to be inlined is actually more disruptive to my work than just commenting out the group label when compiling with GDC, though.

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

--- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Every function?  That says there's something more wrong going on about you than the compiler.

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

--- Comment #6 from thomas.bockman@gmail.com ---
> That says there's something more wrong going on about you than the compiler.

Let me fix that for you:

> That says there's something more wrong going on about DMD than GDC.

For checkedint I achieved approximately a 10x speedup on DMD by thorough application of pragma(inline, ...) throughout the code base.

(5x comes from pragma(inline, true) helping me figure out how to tweak each
trivial function until DMD finally admits that it's inlinable. This is
basically impossible to reliably do blind, because of nonsense like this:
    https://issues.dlang.org/show_bug.cgi?id=15483

2x comes from marking two specific, tiny error handling functions that throw as
pragma(inline, false); otherwise they inline, but then the caller (everything
else, basically) usually doesn't.)

This is completely unnecessary on GDC, whose inliner is nowhere near as easily confused. But, as I said in my original request, I want this so that I don't have to maintain a separate version of the code just for GDC.

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

--- Comment #7 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Well, I can make it a candidate for 2.067

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

--- Comment #8 from thomas.bockman@gmail.com ---
> Well, I can make it a candidate for 2.067

That would be appreciated.

Don't bother if it looks like it will be too much work though; I only filed this because I figured that just adding it to the grammar would be quick and easy since it doesn't need to actually *do* anything.

Either way, you're going to support pragma(inline, ...) for real in 2.068,
right?

-- 
You are receiving this mail because:
You are watching all bug changes.

January 31, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

--- Comment #9 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to thomas.bockman from comment #8)
> > Well, I can make it a candidate for 2.067
> 
> That would be appreciated.
> 
> Don't bother if it looks like it will be too much work though; I only filed this because I figured that just adding it to the grammar would be quick and easy since it doesn't need to actually *do* anything.
> 
> Either way, you're going to support pragma(inline, ...) for real in 2.068,
> right?

Yes, though there is a matter of getting cross-module inlining to work first before I can say that "proper" support should be added.

-- 
You are receiving this mail because:
You are watching all bug changes.

June 08, 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=205

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #10 from Iain Buclaw <ibuclaw@gdcproject.org> ---
This is done in master, as 2.068 frontend has been pulled in.  But it's currently ignored.

-- 
You are receiving this mail because:
You are watching all bug changes.