From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!post02.fr7!fx06.fr7.POSTED!not-for-mail From: Brian Drummond Subject: Re: Forcing GNAT to use 32-bit load/store instructions on ARM? Newsgroups: comp.lang.ada References: <0e0b9ac2-e793-4cc5-8d8d-d3441ca28a58@googlegroups.com> <1j7b0m3yptffy$.1cztnkty8elrv$.dlg@40tude.net> User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID: NNTP-Posting-Host: 62.49.20.82 X-Complaints-To: abuse@demon.net X-Trace: 1404809459 62.49.20.82 (Tue, 08 Jul 2014 08:50:59 UTC) NNTP-Posting-Date: Tue, 08 Jul 2014 08:50:59 UTC Date: Tue, 08 Jul 2014 08:50:59 GMT X-Received-Body-CRC: 3075173636 X-Received-Bytes: 2836 Xref: number.nntp.dca.giganews.com comp.lang.ada:187446 Date: 2014-07-08T08:50:59+00:00 List-Id: On Mon, 07 Jul 2014 17:38:54 -0500, Randy Brukardt wrote: > "MatthiasR" wrote in message > news:lpcck1$vtv$1@dont-email.me... >> That is not really elegant, because records with representation >> clauses, directly mapped onto hardware registers, look like the most >> natural way to access these registers. > > That *is* the most natural way to access those registers. But you can > never access a *part* of a register, you always have to read or write > the entire register at a time. Ada makes you make that explicit in your > code, thus a temporary is required (pending new syntax). There are exceptions to this. Some embedded CPUs (and even the old Z80) have atomic "bit test, set, clear" instructions. Where a register is represented in Ada as a packed array of booleans, setting one component of the array does actually compile down to a single "bit set" instruction. (I do not have a worked example with a record of packed booleans, but would expect the same). (Except for bit 7 on the MSP430 gcc4.9 back end where you get a shift instead, which expands to about 30 instructions! Must report that one...) But the bit access exception doesn't fundamentally change the argument : there are no access levels between the bit and the byte (or 32-bit word on some architectures) so there are no general hardware means for atomically accessing arbitrary sizes or alignments of record components. And thus, I see no way to coherently offer such facility in Ada with a guarantee of atomicity. One of Ada's strengths is that, however abstract the syntax and semantics may be, it is always close to the hardware in terms of the underlying operations it offers. - Brian