I figured that virtual methods would be no-go and that this would only
apply to static methods. It seems a shame to dismiss it completely
though because there's a huge number of procedures that compile to the
same code, especially when generics come into play, and I have
identified a fair number in the compiler itself (at least when compiled
under x86_64-win64).
I guess it would be something that would have to be showcased and
thoroughly tested. I can only try!
Gareth aka. Kit
On 16/10/2021 19:21, Jonas Maebe via fpc-devel wrote:
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
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel