[fpc-devel] [Suggestion] Enumeration range-check intrinsic

J. Gareth Moreton gareth at moreton-family.com
Sun Jul 14 04:08:34 CEST 2019


Just a thought that I'd chuck in on this... I did wonder how practical 
it would be to store checksums of all compiled procedures and the like 
and to look for collisions.  When studying how the compiler is built, I 
noticed a lot of the internal methods, due to conditional defines, would 
compile into identical code, so merging them would reduce the binary 
size if the linker is able to strip out procedures that are never 
called.  Granted, I haven't done research on how Free Pascal does Whole 
Program Optimisation yet, especially as it requiring a separate 
compilation pass has always put me off.  I would have thought that the 
linker should be able to handle it right there and then because it has 
all the information it needs.

Gareth aka. Kit

On 14/07/2019 02:01, Sven Barth via fpc-devel wrote:
> Ben Grasset <operator97 at gmail.com <mailto:operator97 at gmail.com>> 
> schrieb am Sa., 13. Juli 2019, 21:52:
>
>     On Sat, Jul 13, 2019 at 3:47 PM Michael Van Canneyt
>     <michael at freepascal.org <mailto:michael at freepascal.org>> wrote:
>
>         No doubt, but this will lead to a bloated binary. I want less
>         code (both
>         source and assembler), not more.
>
>
>     Well, it would be one instantiation per unique type it was used on.
>
>
> Not necessarily. If you have two units that don't know about each 
> other that specialize the function with the same enum then you'd have 
> two specializations already.
>
> This would need either a WPO pass or COMDAT support. Both are on my 
> ToDo list, especially as the former is needed if the output format 
> does not support the idea of COMDATs (e.g. PE/COFF and ELF do).
>
> Regards,
> Sven
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190714/95441d0d/attachment-0001.html>


More information about the fpc-devel mailing list