comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Releasing Aliased Variables
Date: Thu, 08 Mar 2001 09:52:05 -0500
Date: 2001-03-08T14:52:05+00:00	[thread overview]
Message-ID: <3AA79C95.9B9F2D6D@averstar.com> (raw)
In-Reply-To: 87bsrcs8a3.fsf@deneb.enyo.de

Florian Weimer wrote:
> 
> Robert A Duff <bobduff@world.std.com> writes:
> 
> > In code-generation terms, it causes X to allocated at an addressable
> > location (eg, not in a register).  It is unlikely that "aliased"
> > controls whether X is allocated on the stack versus the heap (but of
> > course compilers can do what they like).
> 
> Some time ago, there was a thread in which someone explained (I think
> Robert Dewar) that 'aliased' does not provide any help to the compiler
> regarding alias detection, register allocation etc. because the
> compiler has to be able to determine this kind of information anyway
> if an Address attribute is used.
> 
> So in code-generation terms, 'aliased' is a no-op.

The rules on 'Address are pretty tricky, and the compiler has
to make several assumptions about "normal" use of 'Address to
deal with it reasonably.  In particular, it generally assumes that there
is no use of 'Address if it can't "see" the use of 'Address.

Furthermore, unless an object is marked aliased 
(or the object is of a by-ref type or had its address
specified), there is no requirement for 'Address to work at all.
See RM95 13.3(16).

On the other hand, "aliased" has very well defined semantics, and
compilers that do any sort of optimization treat aliased objects
quite differently than non-aliased objects.  Any store through a
pointer of a general access type which might legitimately be pointing
to the aliased object is presumed to kill the aliased object.  
Compilers are not that pessimistic about other objects that might
somewhere have had their address taken (perhaps because their address
was "captured" by calling a function which took 'Address of a
formal and then stored the value in some global pointer).

So *do* use "aliased" if you want reliable results... 

-- 
-Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
Chief Technology Officer, AverCom Corporation (A Titan Company) 
Burlington, MA  USA (AverCom was formerly the Commercial Division of AverStar:
http://www.averstar.com/services/ebusiness_applications.html)



  parent reply	other threads:[~2001-03-08 14:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-07 19:57 Releasing Aliased Variables Byron Kauffman
2001-03-07 20:44 ` tmoran
2001-03-07 21:12 ` Robert A Duff
2001-03-08 13:24   ` Florian Weimer
2001-03-08 14:37     ` Pat Rogers
2001-12-27 12:26       ` Florian Weimer
2001-03-08 14:52     ` Tucker Taft [this message]
2001-03-08 16:57     ` Robert A Duff
2001-03-09 15:08       ` Using COM Interfaces (was: Releasing Aliased Variables) Byron Kauffman
2001-03-09 17:01         ` Robert A Duff
2001-03-09 21:08         ` tmoran
2001-03-12 18:45     ` Releasing Aliased Variables Richard Kenner
2001-03-07 21:31 ` Florian Weimer
replies disabled

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