comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Re: Looking for a smart linker for GNAT/DOS
Date: 1997/04/21
Date: 1997-04-21T00:00:00+00:00	[thread overview]
Message-ID: <335B6E77.4CC6@elca-matrix.ch> (raw)
In-Reply-To: dewar.861372455@merv


>    P.S. GNAT already does something about Text_IO. In GNAT, packages
>    like Integer_IO, Float_IO etc are implemented as child units (which
>    is how they should have been defined in the first place if we were
>    not constrained by Ada 83 compatibility), so they are only loaded
>    if needed. This implementation is transparent to a user (interested
>    people may enjoy looking at the routine Text_IO_Kludge in rtsfind
>    in the GNAT sources to see how this is done :-)

The subpackages in Text_IO are all generic, and GNAT implements generics
via macro expansion, so I don't see what this wins in exe size when
these generics are not instantiated. Or am I missing something ?

>    Certainly we have decided that we cannot count on smart linkers for
>    elimination of unused subprograms, which is why we have decided on
>    a source based approach to solve this problem. Basically our approach
>    works as follows:
> 
>      There is a configuration pragma which declares that a certain
>      subprogram is unused. In the presence of the pragma, the compiler
>      (a) stubs out the subprogram, and (b) makes sure it is not called.

One of the situations where I would like dead code elimination in the
linker or compiler is in generic instances. It often happens that a
generic unit (e.g. AVL trees with set operations, iterators, etc.) is
instantiated very often with only a small subset of its operations being
used (e.g. Insert, Member and Remove) and all the other stuff is unused.
The compilers/linkers I have used so far do not eliminate this kind of
dead code. (I know I can split the generic using generic children, but
the code exists (Ada 83) and I don't want to do this).

Even if the new GNAT pragma approach seems to make this possible (if I
understand it correctly, and assuming that the pragma is allowed for
subprograms created via generic instantiation), the process will be
manual. Is there any chance of having this done automatically ?




  parent reply	other threads:[~1997-04-21  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1997Apr15.202909.5879@news>
1997-04-16  0:00 ` Looking for a smart linker for GNAT/DOS Samuel Tardieu
1997-04-16  0:00   ` Gautier
1997-04-18  0:00     ` Robert Dewar
1997-04-19  0:00       ` Geert Bosch
1997-04-22  0:00         ` Robert Dewar
1997-04-28  0:00         ` Larry Kilgallen
1997-04-19  0:00       ` Fergus Henderson
1997-04-21  0:00         ` Robert Dewar
1997-04-21  0:00           ` Gautier
1997-04-23  0:00             ` Robert Dewar
1997-04-24  0:00               ` Gautier
1997-04-26  0:00                 ` Robert Dewar
1997-04-27  0:00                 ` Geert Bosch
1997-04-29  0:00                   ` Gautier
1997-04-21  0:00       ` Gautier
1997-04-21  0:00       ` Mats Weber [this message]
1997-04-23  0:00         ` Robert Dewar
     [not found] ` <dewar.861173085@merv>
1997-04-17  0:00   ` Gautier
1997-04-17  0:00     ` Robert Dewar
1997-04-18  0:00       ` Gautier
1997-04-19  0:00         ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox