What does 'inline' mean?

9il ilyayaroshenko at gmail.com
Tue Jun 9 06:53:23 UTC 2020


On Monday, 8 June 2020 at 06:14:44 UTC, Manu wrote:
> 1. I only want the function to be present in the CALLING 
> binary. I do not want an inline function present in the local 
> binary where it was defined (unless it was called internally). 
> I do not want a linker to see the inline function symbols and 
> be able to link to them externally. [This is about linkage and 
> controlling the binary or distribution environment]

Yes!

> 2. I am unhappy that the optimiser chose to not inline a 
> function call, and I want to override that judgement. [This is 
> about micro-optimisation]

Yes!

> 3. I want to treat the function like an AST macro; I want the 
> function inserted at the callsite, and I want to have total 
> confidence in this mechanic. [This is about articulate 
> mechanical control over code-gen; ie, I know necessary facts 
> about the execution context/callstack that I expect to maintain]

Yes!!!

> I think these are the 3 broad categories of behaviour I have 
> ever wanted
> control over.

The same for me.

I have the same experience. Moreover, non-AST inlining has the 
worst optimization abilities comparing with AST. Even if a 
function is inlined it is often inlined badly ignoring some 
optimization attributes, local SIMD and FMA instructions, and 
better loop unrolling patterns (better doesn't mean larger).

AST-like inlining is a critical and killer feature.


More information about the Digitalmars-d mailing list