CVS difference for ais/ai-00259.txt

Differences between 1.2 and version 1.3
Log of other versions for file ais/ai-00259.txt

--- ais/ai-00259.txt	2001/02/16 05:08:17	1.2
+++ ais/ai-00259.txt	2002/04/26 20:15:17	1.3
@@ -1,5 +1,7 @@
-!standard  C.6 (20)                                    01-02-12  AI95-00259/00
+!standard  C.6 (20)                                    02-04-19  AI95-00259/01
+!standard  C.6 (21)
 !class ramification 01-02-12
+!status work item 02-04-19
 !status received 01-02-12
 !qualifier Omission
 !priority Medium
@@ -8,11 +10,66 @@
 
 !summary
 
+Implementation advice is added to encourage implementations to implement
+accesses to atomic operations as single instructions which only access the
+particular bits in question.
+
 !question
 
+Consider the following program:
+
+   X : Byte;
+   pragma Atomic (X);
+   Y : Byte;
+   pragma Atomic (Y);
+
+   X := ...;
+   Y := ...;
+
+Can the memory writes to atomic objects X and Y be combined into a single
+store operation?
+
 !response
 
+Atomic objects are intended (among other uses) to support communication
+between Ada programs and non-Ada software or hardware devices. Some hardware
+devices require access in particular ways. For example, some devices must be
+accessed with a byte operation; a word operation does not work.
+
+If memory reads and writes of atomic objects are combined into a single
+operation, it is not possible to write Ada code which can safely access such
+a device. Even if it works on the current version of a compiler, a newer
+compiler with better optimizations may break the program.
+
+However, it is not possible to specify this as a language requirement, as it
+is not possible to determine the difference between a combined write and a
+pair of writes at the level of Ada semantics. Moreover, any attempt to do so
+uses machine level terms not part of the Ada model.
+
+Therefore, we adopt implementation advice to do the correct thing. As with
+all implementation advice, an implementation must document when it is not
+followed. Thus, users can determine whether or not their implementation
+will handle Atomic objects as intended.
+
+!corrigendum C.06(21)
+
+@dinsa
+If a pragma Pack applies to a type any of whose subcomponents are atomic, the
+implementation shall not pack the atomic subcomponents more tightly than that
+for which it can support indivisible reads and updates.
+@dinst
+@s8<@i<Implementation Advice>>@hr
+
+A load or store of an atomic object should, where possible,
+be implemented by a single load or store instruction which
+accesses exactly the bits of the object and no others. The
+implementation should document those instances in which
+it is not possible to follow this advice.
+
 !ACATS test
+
+This is implementation advice which is not testable without examining the
+generated code (which is prohibited by the ACATS charter).
 
 !appendix
 

Questions? Ask the ACAA Technical Agent