[fpc-devel] Merging identical procedure proposals

Jonas Maebe jonas at freepascal.org
Sat Oct 16 20:21:41 CEST 2021


On 16/10/2021 19:59, J. Gareth Moreton via fpc-devel wrote:
> Sounds like "procvar = @myproc" would be -O4 at best due to the 
> side-effects,

That's not a kind of side-effect that would be acceptable at any 
optimisation level. That is an explicit, valid comparison in code that 
would suddenly behave wrongly.

> otherwise I would wonder if it's possible to track such 
> references, especially with units that are pre-compiled.

It is possible to track whether the address gets taken of a procedure 
and store that if the ppu file if you would be so inclined. This means 
it will be impossible to apply the optimisation for any virtual method 
though, since all of their addresses get implicitly taken.

For the reason mentioned in my previous message, I don't think it's a 
good optimisation to implement in a compiler though.


Jonas


More information about the fpc-devel mailing list