comp.lang.ada
 help / color / mirror / Atom feed
From: mark_lundquist@my-deja.com
Subject: Re: Help with Atomic_Components and whole array assignment
Date: Mon, 22 Jan 2001 14:16:00 GMT
Date: 2001-01-22T14:16:00+00:00	[thread overview]
Message-ID: <94hfaq$h3n$1@nnrp1.deja.com> (raw)
In-Reply-To: 3A6C2CDD.67FD79DC@baesystems.com

In article <3A6C2CDD.67FD79DC@baesystems.com>,
  Stuart Palin <stuart.palin@baesystems.com> wrote:
> r_c_chapman@my-deja.com wrote:
>
> > [...]
> > all fine so far.  When we initialise this array, thus:
> >
> >   A := Byte_Array'(others => 0);
> >
> > compiler A generates 1 Word-sized store and 1 Byte-sized store.
> > (Target is PowerPC by the way.)
> > Compiler B (or should that be "G" :-) ) generates similar code on
IA32.
> >
> > Can anyone confirm this is indeed acceptable behaviour?
>
> Yes it is (from a language specification point of view) - a deja news
> search should throw up several discussions on the topic.
>
> The pragma volatile has been observed, because the operation is on
> object (not some locally cached version of it).
>
> The pragma atomic_components has been observed because each component
is
> indivisibly updated (within the bounds of an architecture assumption
> that the word write is not divisible).
>
> --# hide;
> Ultimate answer seems to be package MACHINE_CODE is the way to go if
the
> there is a specific way memory has to be accessed.

Or, just access the array one element at a time (no whole array or
slices).  If instead of

   A := Byte_Array'(others => 0);

you write

   for I in A'range loop
      A (I) := 0;
   end loop;

you'll get 1-byte writes, guaranteed.  It's hard to imagine a compiler
wanting to generate anything but simply a 1-byte write for each
element, but if it did want to, RM C.6(20) would not allow it
(violation of sharing properties of the other components).

> [...]
> Personally; this seems to be a recurrent embedded systems problem
(that
> is either
> agonized over or [in]conveniently swept under the carpet).  It would
be
> nice if it were addressed at the next language revision.

I agree, it would be very nice not to have to work around this.

Here's another embedded systems issue I'd like to see taken up: I'd
like to see bit order fixed, i.e. the ability to write endian-
independent record representation clauses.

---------------
Mark Lundquist
Rational Software



Sent via Deja.com
http://www.deja.com/



  reply	other threads:[~2001-01-22 14:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-22 11:22 Help with Atomic_Components and whole array assignment r_c_chapman
2001-01-22 12:51 ` Stuart Palin
2001-01-22 14:16   ` mark_lundquist [this message]
2001-01-22 16:09     ` Pat Rogers
2001-01-22 16:29     ` Robert Dewar
2001-01-22 19:52       ` Mark Lundquist
2001-01-30 15:54       ` Tucker Taft
2001-01-30 18:20         ` Robert Dewar
2001-01-31  5:08           ` DuckE
2001-01-31  5:57             ` Robert Dewar
2001-02-01  3:31               ` DuckE
2001-02-02 21:38               ` Mark Lundquist
2001-02-02 23:08                 ` Robert Dewar
2001-02-03  1:39                 ` tmoran
2001-01-22 16:21 ` Robert Dewar
2001-01-22 16:39   ` r_c_chapman
2001-01-30 15:57     ` Tucker Taft
2001-01-30 18:26       ` Robert Dewar
2001-01-30 21:30         ` Simon Wright
2001-02-01  6:11           ` Robert Dewar
2001-02-06  0:32         ` Richard Kenner
2001-02-06  3:15           ` Robert Dewar
2001-01-31 10:09       ` Rod Chapman
2001-01-31 21:41         ` Tucker Taft
2001-02-01  5:33           ` Robert Dewar
2001-02-01  9:42           ` Rod Chapman
2001-02-01 18:10             ` Robert Dewar
2001-02-01 13:14           ` SPARK flow analysis (was Help with Atomic_Components and whole array assignment) Stuart Palin
2001-02-01 23:38           ` Help with Atomic_Components and whole array assignment Nick Roberts
2001-02-02  3:45             ` Robert Dewar
2001-02-07 21:40           ` Nick Williams
replies disabled

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