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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.112.161.135 with SMTP id xs7mr4716346lbb.3.1384550484549; Fri, 15 Nov 2013 13:21:24 -0800 (PST) Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!r7no7629703wik.0!news-out.google.com!ub20ni1817wib.1!nntp.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: GNAT 4.8 atomic access to 64-bit objects Date: Fri, 15 Nov 2013 22:19:15 +0100 Organization: cbb software GmbH Message-ID: References: <1neco99j6szmk$.ayjyo0uds8a5.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: Ws8cDh6KC0dYMbHlsA0RIw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Original-Bytes: 2179 Xref: number.nntp.dca.giganews.com comp.lang.ada:183891 Date: 2013-11-15T22:19:15+01:00 List-Id: On Fri, 15 Nov 2013 20:08:54 +0100, Stefan.Lucks@uni-weimar.de wrote: > On Thu, 14 Nov 2013, Dmitry A. Kazakov wrote: > >> Is there a way to change this without machine code insertions? > > I guess, putting your 64-bit object into a protected object is not an > option? It is supposed to be lock-free. Using protected object would be very last resort [*]. I was considering: procedure Load ( Ptr : in out T; Ret : in out T; Model : int := ATOMIC_RELAXED ); pragma Import (Intrinsic, Load, "__atomic_load"); The problem with this is that GNAT's implementation of intrinsic import seems incapable to deal with overloaded GCC built-ins. Unfortunately, all __atomic_* built-ins are sort of templates. -------------------------- * I wonder why RM does not mandate pragma Atomic always legal. After all, the compiler could always implement it using a hidden protected object. Except when access occurs on the context of a protected action. Which is statically known (or else program is erroneous). Within a protected action it already atomic. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de