[fpc-devel] Proposal/discussion: Simple nested functions and 'outlining'
J. Gareth Moreton
gareth at moreton-family.com
Thu Oct 1 23:22:44 CEST 2020
In a way, yes, but not quite the same, since multiple calls to the
nested function would still redirect to the same block of code rather
than being inlined at each call. I suppose more similar to the old
GOSUB; RETURN combination in old versions of Basic, and the nested
routine slotted either at the end of the parent function or, if the
compiler is intelligent enough, right after one of the function calls
(in effect, inlining it at this point) so the peephole optimizer can
then remove a zero-distance jump.
Gareth aka. Kit
On 01/10/2020 22:10, Ryan Joseph via fpc-devel wrote:
>
>> On Oct 1, 2020, at 10:37 AM, J. Gareth Moreton via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
>>
>> In situations where a nested function has no parameters, is it feasible and beneficial to programmatically merge it into the main procedure
> What do you mean by "merge"? Like inlining?
>
> Regards,
> Ryan Joseph
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
More information about the fpc-devel
mailing list