comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Subverting 'Access for Sub-programs
Date: 1999/08/09
Date: 1999-08-09T00:00:00+00:00	[thread overview]
Message-ID: <wccaes1m258.fsf@world.std.com> (raw)
In-Reply-To: 7of1ju$d0m$1@nnrp1.deja.com

adam@irvine.com writes:

> After I wrote the above post, I actually did think of a simple way
> that this type of runtime check could be implemented efficiently.
> Suppose you have a subprogram P that contains nested subprograms Q1,
> Q2, etc.  If Q1'ACCESS is used, the compiler allocates a global counter
> for P (Q1's parent); the access value for Q1'ACCESS would contain the
> address of P's global counter, and the current value of the counter.
> When P exits, it increments the global counter just before returning.
> Now, any access-subprogram type that has this property will have a
> counter address (possibly null) and a current counter value; so when
> dereferencing, the program would look up the pointed-to counter and see
> if its value matches the value stored in the access-subprogram type.  If
> not, the dereference is illegal.  (A null counter address would indicate
> a global subprogram, or perhaps any subprogram that is statically not
> deeper than the type, so that the check would be unnecessary.)

This is sort of like the "generation count" scheme, which we use in the
AdaMagic run-time system to detect dangling task id's.  You can use this
to detect dangling pointers in general, but it's rather expensive for
smallish things -- doubles the size of all the pointers, and increases
the number of memory references.  I'd rather have full garbage
collection.

> P's counter would also have to be incremented when its execution is
> abandoned due to an exception; this may add a little complication in
> some implementations, but not too much.

Or an abort statement or ATC.

>...Tasking probably complicates
> things.

Yeah.  I guess you would need a per-task count (and per-task data is
expensive on some systems).  Your scheme could work, but I still stand
by my statement, "Such a feature would be difficult to implement
efficiently."

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




  reply	other threads:[~1999-08-09  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 ` Brian Rogoff
1999-08-03  0:00 ` Michael F. Yoder
1999-08-03  0:00 ` tmoran
1999-08-03  0:00 ` Steve Doiel
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           ` adam
1999-08-06  0:00             ` Robert A Duff
1999-08-06  0:00               ` adam
1999-08-09  0:00                 ` Robert A Duff [this message]
1999-08-09  0:00                 ` Mark Biggar
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
1999-08-06  0:00               ` Robert Dewar
1999-08-05  0:00         ` Subverting 'Access for Sub-programs Robert A Duff
1999-08-05  0:00           ` Robert Dewar
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                     ` 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                     ` Richard D Riehle
1999-08-11  0:00                   ` Tucker Taft
1999-08-13  0:00                     ` Robert Dewar
1999-08-13  0:00                     ` Robert Dewar
1999-08-13  0:00                       ` Brian Rogoff
1999-08-11  0:00                   ` Robert A Duff
1999-08-11  0:00                     ` Robert Dewar
1999-08-05  0:00           ` tmoran
1999-08-06  0:00             ` Robert A Duff
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