comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Adjust bug? re-post
Date: 1997/07/21
Date: 1997-07-21T00:00:00+00:00	[thread overview]
Message-ID: <EDnEEo.6EE.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 33D26588.7247@bix.com


Tom Moran (tmoran@bix.com) wrote:

: A second problem, unrelated to access pointers, is that Initialize and
: Adjust become superfluous.  Since you can't assume that either has been
: called for a particular object, every routine that uses an object must
: first detect whether it was Initialized/Adjusted and if not, do the
: appropriate things.  

I think you are jumping to conclusions.  An object is initialized
one of three ways, by default initialization (calls Initialize),
by copy (calls Adjust), or by component-by-component initialization
(i.e. via an aggregate -- only possible where full definition is visible).  

The optimization in this case was that the object was *moved*, 
not that it was created without one of the above 3 actions.
If you see movement as inherently creating a new object, 
then you need to use limited types, or make one of the 
subcomponents aliased.  Normally, however, it shouldn't matter
where an object is, so long as it only exists in one place at a given
time.  It might live in a register for a while, and then in memory for
awhile.  It might be passed across a network, and then be passed back
later.

: ... But that means the sole effect of coding an
: Initialize/Adjust is a (probably slight) advance in the time at which
: the object will Initialized/Adjusted.

I think you have missed the nature of the optimization.  Compilers are
free to move controlled objects around, in general, just like a garbage
collector is allowed to "compactify" in some languages.  You have to
work a little harder if you want to prevent this movement (by making
one of the subcomponents aliased).  The purpose of "Adjust" is to 
accommodate the case when there are now two copies of the same
value, instead of just one.  By contrast, when an object moves,
there is still only one value, not two.

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-19  0:00 Adjust bug? re-post Tom Moran
1997-07-19  0:00 ` Robert Dewar
1997-07-19  0:00   ` Tom Moran
1997-07-20  0:00   ` Tom Moran
1997-07-21  0:00     ` Tucker Taft [this message]
1997-07-20  0:00 ` Tucker Taft
replies disabled

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