comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Overlay allowability
Date: 2000/05/03
Date: 2000-05-03T00:00:00+00:00	[thread overview]
Message-ID: <8epqhg$hqa$1@nnrp1.deja.com> (raw)
In-Reply-To: 3910514D.13BF2DE1@Raytheon.com

In article <3910514D.13BF2DE1@Raytheon.com>,
  "Samuel T. Harris" <samuel_t_harris@Raytheon.com> wrote:

> Many times the need for such overlays is a continual need
> throughout a section of code. Several calls to unchecked_conversion
> is simply to slow and does present a consistency problem
> associated with having two separate objects instead of two
> overlayed objects. This consistency problem can be exploited
> in a tasking environment and cause unpredictable results.

Quite true. But what about unchecked-converting access types, like I was
referring to? In that case, there is only *one* object, and that fact is
quite clear to both the compiler and the reader. It certianly isn't
significatnly slower to work this way. An optimizer might even be able
to remove the extra dereferences, making the speed the same. You don't
have to worry about initilization issues, as only the original object's
initialzations get applied (just like one would expect).


I think the tasking issue is a red herring. In a tasking environment,
you have a consistency problem with *any* object (as each task may keep
register copies of it). There ways to prevent or work around it in Ada
of course. But I'd be very worried to add overlays into the mix. (eg:
Does "pragma Atomic" work for both views of an overlaid object, or just
the one?. Do synchronization points update my overlay's view of the
object, if my task uses only the overlay and some other task uses only
the original object?

In fact, I'd be a bit worried about this whole thing in general. In Ada
83 doing this was defined as erronious. I figured that was because a
chunk of code working on an object might temporarily save the object's
value in a register, which would make the view from the other overlay
invalid. If its safe to do that with the current version of Ada, how do
Ada compilers ensure consistency between the overlaid views?

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~2000-05-03  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-01  0:00 Overlay allowability Marc A. Criley
2000-05-01  0:00 ` Tucker Taft
2000-05-01  0:00   ` mark_biggar
2000-05-01  0:00   ` Keith Thompson
2000-05-08  0:00     ` Tucker Taft
2000-05-03  0:00   ` Robert I. Eachus
2000-05-01  0:00 ` Ted Dennison
2000-05-03  0:00   ` Samuel T. Harris
2000-05-03  0:00     ` Robert A Duff
2000-05-03  0:00     ` Ted Dennison [this message]
2000-05-04  0:00     ` Robert Dewar
2000-05-08  0:00       ` Samuel T. Harris
2000-05-08  0:00         ` Robert Dewar
2000-05-09  0:00           ` Samuel T. Harris
2000-05-09  0:00             ` Ted Dennison
2000-05-10  0:00               ` Marc A. Criley
2000-05-11  0:00                 ` tmoran
2000-05-12  0:00                   ` tmoran
2000-05-01  0:00 ` tmoran
2000-05-02  0:00 ` Robert I. Eachus
2000-05-03  0:00   ` Marc A. Criley
replies disabled

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