[fpc-devel]Re: fpc-devel digest, Vol 1 #1035 - 2 msgs

Peter Vreman peter at freepascal.org
Tue Oct 30 10:30:39 CET 2001


> Hello all,
> 
> IMHO, there are exists some reason, to make cutting out unused old-style objects
methods.
An argument for it -
> the popularity of KOL (I hoped to port it to FPC but now that seems to be senseless, at
least while unused
> methods are keeping in executable). I'm not sure that introducing of this feature must
cause very big compiler
> alteration. Maybe, a possible way would be:
> 1) for old-style objects: not saving in VMT direct addresses of virtual methods but
reserving space (pointer variables)
> for every virtual method;
> 2) at building PASCALMAIN-contained module: creating in initialization code assignments
of
addresses of used methods
> to these placeholders. If methods were not used, theirs placeholders in VMT will remain
nil. This way will cause small
> slowing down of virtual methods calling, will also increase size of PASCALMAIN-contained
module and initialization time

Startup time is also very important, see the KDE project for discussions about startup
time of c++ applications

> but it can help to essentially reduce size of executables which use old object
libraries.
I think, 4 bytes for empty placeholder
> is better than linked dead code which can be much larger.
> 
> I send this idea to weigh it together.

It looks simple as you write it here, but adding support for it is not that simple.
Because it is now easily know which virtual method is called. Only a call with an index
value is generate and not a reference to the method itself.

And for the final result it'll not be a very big improvement. Having better shared library
support working reduces size of executables a lot more. Also having an internal linker is
much more needed as it'll simplify also cross platform compiling.







More information about the fpc-devel mailing list