comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada-Comment proposals (version 3)
Date: Sun, 13 Jul 2014 20:53:31 +0300
Date: 2014-07-13T20:53:31+03:00	[thread overview]
Message-ID: <c2fvciFm8uiU1@mid.individual.net> (raw)
In-Reply-To: <lpudki$1ll$1@dont-email.me>

On 14-07-13 19:54 , Simon Clubley wrote:
> I've restructured issue 1 to turn it into a general partial aggregates
> proposal. The atomic updating of device register bitfields discussion
> is still pretty much the same but the additional comments and examples
> from Niklas make it a more general proposal.
> 
> Niklas, since I have included your words and examples directly, can you
> make sure you are happy with what I have included please ?

Quite ok, thanks. I have just one additional comment:

> For an Atomic record, the compiler would generate a Read-Modify-Write
> sequence

I'm afraid that saying "Read-Modify-Write" may be misunderstood to mean
a fully atomic update, not just an atomic read followed by an atomic
write of a new value, where other accesses to the record variable can
occur between the read and the write. Wikipedia defines
"read-modify-write" as an atomic update, giving the "test-and-set"
instruction type as one example.

It would be safer to write something like this: "the compiler would
generate an atomic read of the whole record variable into a
compiler-created temporary (perhaps a register), followed by an update
of the temporary according to the component updates listed in the
partial aggregate, and ending by an atomic write of the whole updated
value into the record variable".

This brings to mind an interesting question: if the processor has some
fully atomic read-modify-write instructions, and the semantics of one of
these instructions matches the way the record variable is updated with a
partial aggregate, is the compiler allowed to use that read-modify-write
instruction? I don't know if such instructions always work with
memory-mapped peripheral registers -- for example, their timing in terms
of clocks between the read and the write may be different.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .


  reply	other threads:[~2014-07-13 17:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-13 16:54 Ada-Comment proposals (version 3) Simon Clubley
2014-07-13 17:53 ` Niklas Holsti [this message]
2014-07-13 18:16   ` Simon Clubley
2014-07-13 21:05     ` Niklas Holsti
2014-07-13 23:45       ` Simon Clubley
2014-07-14  0:24 ` Simon Clubley
2014-07-15 17:20   ` Simon Clubley
2014-07-15 22:11     ` Randy Brukardt
2014-07-15 23:15       ` Simon Clubley
2014-07-15 23:39         ` Adam Beneschan
2014-07-15 23:50           ` Adam Beneschan
2014-07-16  0:05             ` Simon Clubley
2014-07-21 22:02             ` Randy Brukardt
2014-07-21 22:09               ` Simon Wright
2014-07-22  0:26                 ` Randy Brukardt
2014-07-15 23:53           ` Simon Clubley
2014-07-21 22:20             ` Randy Brukardt
2014-07-21 23:06               ` Simon Clubley
2014-07-22  0:24                 ` Randy Brukardt
replies disabled

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