[fpc-pascal] Inline function parameters

Sven Barth pascaldragon at googlemail.com
Tue Nov 9 07:09:51 CET 2021


Am 09.11.2021 um 02:45 schrieb Ryan Joseph via fpc-pascal:
>
>> On Nov 8, 2021, at 11:20 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> I don't know what you mean with "new function body". If a function is inlined its code is contained within the surrounding function and if it's not inlined then nothing changes.
>>
> I mean if in theory you were to inline that function variables code into the function it would need to generate a new function (I guess the name also, so the entire thing) because the function being passed in could change on per-call basis (like a normal generic function).
No, because the function that is called with a function pointer needs to 
be inlined itself (thus becoming part of its caller) so that constant 
propagation works at all for the parameters. If a function isn't inlined 
then there won't be any change and the passed in function variable will 
be called as usual.

Regards,
Sven


More information about the fpc-pascal mailing list