[fpc-pascal] Feature announcement: implicit generic function specializations

Sven Barth pascaldragon at googlemail.com
Sat Apr 23 10:26:37 CEST 2022


Am 23.04.2022 um 00:42 schrieb Martin Frb via fpc-pascal:
> Possible one more / Though more of an optimization.
>
> If the code has multiple
>     Add(Int64(0), Int64(0));
> then they will all use the same procedure (just break in the debugger 
> and check the CRC).
>
> But if  one specialization is explicit and the other implicit then 2 
> identical (as far as I can tell with -al ) functions (with diff CRC) 
> are created.

I would need to check why it generates two then. Please report this as well.

> There is however a subtle difference in the generate asm.
> The explicit specialization has comment for the source code
> # [6] begin
> ...
> # [7] Result := aArg1 + aArg2;
> ...
>
> The implicit does not have those.
> Actually I checked that a bit deeper. The comment occur in (and only 
> in) the first specialization (implicit or explicit).
> All other specialization are without comments for the source.

I had that issue in a different context already and it's related to the 
assembler writer and when it decides a line should be written again 
(cause at the basic level it would write the line comment for each 
instruction of that line and thus it needs to be reset correctly, but 
across functions that should be reset completely of course). I already 
have a fix for that, but as it's buried in a different branch it will be 
a little while longer. ;)

Regards,
Sven


More information about the fpc-pascal mailing list