[dmd-internals] Is there a reason that inlining happens so early?

Don Clugston dclugston at gmail.com
Tue Nov 27 08:11:31 PST 2012


On 27 November 2012 11:36, Walter Bright <walter at digitalmars.com> wrote:
> On 11/27/2012 8:00 PM, Don Clugston wrote:
>>
>> One of the main reasons that implementing CTFE is difficult, is that
>> inlining happens so early.
>> It sometimes happens that CTFE gets run on a function BEFORE it is
>> inlined, and then the same function gets run again AFTER inlining.
>> Then the same function has a different number of variables, and all
>> kinds of evil transformations. This makes it very difficult to
>> pre-anaylze CTFE functions, before running them. (I've done
>> experiments which show that a minimal "compile" which merely allocates
>> variable numbers, can significantly increase CTFE speed).
>>
>> Is there any reason why all the inlining couldn't be done after the
>> semantic3 pass has completed, instead of happening within it?
>>
>
>
> But it does happen after semantic3.

Oooh, you're right.
EXCEPT:
expression.c 5411: FuncExp's get inlined during the semantic3 pass
expression.c 5618: DeclarationExps get inlined during the semantic3 pass.

So, is there anything stopping us from moving these guys into the inliner pass?


More information about the dmd-internals mailing list