[fpc-devel] Progress on pure functions
Sven Barth
pascaldragon at googlemail.com
Thu Dec 15 22:39:12 CET 2022
Am 14.12.2022 um 12:15 schrieb J. Gareth Moreton via fpc-devel:
>
> To better explain how purity analysis currently works (I'm sure
> there's a better name than "purity analysis"), it takes a copy of the
> unoptimised node tree (this is the same as the tree used for inline,
> and for a space saving, they share the same field), adds explicit
> definitions for the formal parameters so they equal the constants
> passed in, and then tries to collapse the node tree down to a single
> assignment to the result. This is done by running the following
> operations in this order:
>
What do you mean with “share the same field”? A pure function might
still be called and inlined like a normal function and for that you
shouldn't transform the node tree needlessly as that might influence the
debugging experience. So you should have two different copies, one for
inlining and one for pure related transformations.
Regards,
Sven
More information about the fpc-devel
mailing list