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

Michael Van Canneyt michael at freepascal.org
Tue Jul 16 16:31:48 CEST 2019



On Tue, 16 Jul 2019, Ben Grasset wrote:

> On Tue, Jul 16, 2019 at 5:28 AM Sven Barth via fpc-devel <
> fpc-devel at lists.freepascal.org> wrote:
>
>> The output will then be two different addresses, thus showing that the
>> code had been generated twice.
>>
>> However the compiler/linker is good at leaving out unused code and in this
>> case only the two Assign specializations are kept as their addresses are
>> taken, everything else is discarded. If you'd change one of the two to
>> another non-virtual method then Assign of the one specialization and the
>> other method of the other specialization would be kept.
>>
>> If you use virtual methods inside generics then things are less likely to
>> be removed.
>>
>
> Ah, I understand now.
>
> I guess my point overall was that, in my experience at least, while there's
> indeed probably room for improvement in that area via something like WPO /
> COMDAT support / e.t.c. as you'd suggested, the overall effect of generics
> in FPC on binary size is not *unreasonable*.
>
> I use Delphi only semi-regularly, but it does seem to be somewhat more of
> an actual issue there (as frankly binary size in recent Delphis is in
> general, with generics or not, when compared to FPC.)

I suspect this is also in part due to the liberal and generous use of extended RTTI.

Michael.



More information about the fpc-devel mailing list