comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: What is a Display ? (was: Subverting 'Access for Sub-programs)
Date: 1999/08/06
Date: 1999-08-06T00:00:00+00:00	[thread overview]
Message-ID: <7odhag$b8v$1@nnrp1.deja.com> (raw)
In-Reply-To: t7907pbwwc.fsf@calumny.jyacc.com

In article <t7907pbwwc.fsf@calumny.jyacc.com>,
  Hyman Rosen <hymie@prolifics.com> wrote:

> kilgallen@eisner.decus.org (Larry Kilgallen) writes:
> > What is a Display ?
>
> Since such access
> tends to be rare, static links are probably better.

Well this is arguable, and in my experience it is not unusual
for Ada programs to violate this rule.

But more to the point, consider the following categories:

1. Calls to global procedures not containing nested procedures
2. Calls to global procedures containing nested procedures
3. Calls to nested procedures not containing nested procedures
4. Calls to nested procedures containing nested procedures

For static links, 1,2 involve no overhead on the call, but 3,4
do require the overhead of setting up the static link.

For displays 1,3 involve no overhead on the call, but 2,4 do
require the overhead of updating the display.

Now obviously if you have no nested procedures, then you are in
case 1 all the time, and neither approach causes any overhead.

If you have nested procedures, the question is which is better.
I think it is clear that displays come off better -- why? Well
for displays we only pay overhead on a call to a procedure that
contains nested procedures, but in such cases, almost surely
there will be significantly more calls to leaves (i.e. to the
nested procedures), than to the procedure containing them. But
in the static link case, you pay for calls to ALL non-global
subprograms.

This analysis does not however include the impact of general
procedure pointers without the ADa 95 restrictions. In that
case, you would find displays so much less efficient for the
case of calling subprograms via an access pointer, that you
would almost surely choose static links.

With the rules of Ada 95, which are carefully designed so that
this extra impact on display implementations does not occur, it
is probably the case that a per-task display represents the most
efficient handling of non-local references.

Consider for example, a not uncommon case, where you have a
large procedure that contains a large number of nested
procedures (e.g. look at Analyze_Attribute in the GNAT sources).

There is one call to Analyze_Attribute (that would involve call
overhead for the display case, but not for the static link case)

But then when the analysis call makes a sequence of calls to
the nested procedures, which often call one another, the display
approach would have zero overhead for all such calls, whereas
the static link case would have to update the link on each call.

Robert Dewar


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-08-06  0:00 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-03  0:00 Subverting 'Access for Sub-programs Anton Gibbs
1999-08-03  0:00 ` David C. Hoos, Sr.
1999-08-05  0:00   ` Robert A Duff
1999-08-03  0:00 ` Michael F. Yoder
1999-08-03  0:00 ` Brian Rogoff
1999-08-03  0:00 ` Steve Doiel
1999-08-03  0:00 ` tmoran
1999-08-03  0:00 ` Ted Dennison
1999-08-04  0:00 ` Anton Gibbs
1999-08-04  0:00   ` Jean-Pierre Rosen
1999-08-04  0:00     ` Brian Rogoff
1999-08-05  0:00       ` Jean-Pierre Rosen
1999-08-05  0:00         ` adam
1999-08-05  0:00           ` Robert Dewar
1999-08-05  0:00             ` What is a Display ? (was: Subverting 'Access for Sub-programs) Larry Kilgallen
1999-08-05  0:00               ` Hyman Rosen
1999-08-06  0:00                 ` Robert Dewar [this message]
1999-08-06  0:00               ` Robert Dewar
1999-08-05  0:00           ` Subverting 'Access for Sub-programs adam
1999-08-06  0:00             ` Robert A Duff
1999-08-06  0:00               ` adam
1999-08-09  0:00                 ` Mark Biggar
1999-08-09  0:00                 ` Robert A Duff
1999-08-05  0:00         ` Robert A Duff
1999-08-05  0:00           ` tmoran
1999-08-06  0:00             ` Robert A Duff
1999-08-05  0:00           ` Brian Rogoff
1999-08-06  0:00             ` Robert Dewar
1999-08-09  0:00               ` Tucker Taft
1999-08-10  0:00                 ` Robert Dewar
1999-08-11  0:00                   ` Dmitry A. Kazakov
1999-08-11  0:00                     ` Richard D Riehle
1999-08-11  0:00                     ` Robert Dewar
1999-08-12  0:00                       ` Dmitry A. Kazakov
1999-08-14  0:00                         ` Robert Dewar
1999-08-16  0:00                           ` Dmitry A. Kazakov
1999-08-11  0:00                   ` Robert A Duff
1999-08-11  0:00                     ` Robert Dewar
1999-08-11  0:00                   ` Tucker Taft
1999-08-13  0:00                     ` Robert Dewar
1999-08-13  0:00                       ` Brian Rogoff
1999-08-13  0:00                     ` Robert Dewar
1999-08-05  0:00           ` Robert Dewar
1999-08-06  0:00         ` Brian Rogoff
1999-08-07  0:00           ` Gautier
1999-08-05  0:00     ` Robert A Duff
1999-08-05  0:00       ` Robert Dewar
1999-08-05  0:00         ` Brian Rogoff
1999-08-04  0:00   ` Robert A Duff
1999-08-04  0:00     ` Brian Rogoff
1999-08-05  0:00       ` tmoran
1999-08-05  0:00         ` Robert Dewar
1999-08-05  0:00           ` Ray Blaak
1999-08-06  0:00             ` Robert Dewar
1999-08-06  0:00               ` Robert A Duff
1999-08-08  0:00                 ` Brian Rogoff
1999-08-09  0:00                   ` Robert A Duff
1999-08-10  0:00                     ` Brian Rogoff
1999-08-09  0:00                 ` Tucker Taft
1999-08-06  0:00             ` Jean-Pierre Rosen
1999-08-06  0:00               ` Hyman Rosen
1999-08-07  0:00                 ` Florian Weimer
1999-08-05  0:00         ` Aidan Skinner
1999-08-05  0:00     ` Anton Gibbs
1999-08-05  0:00   ` Steve Quinlan
1999-08-04  0:00 ` Robert Dewar
1999-08-04  0:00   ` Robert A Duff
1999-08-04  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