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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee82e0a06c8bbead X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.233.69 with SMTP id tu5mr691295pbc.6.1334006076843; Mon, 09 Apr 2012 14:14:36 -0700 (PDT) Path: r9ni37855pbh.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: A Gnother Gnasty bug Date: Mon, 9 Apr 2012 14:09:00 -0700 (PDT) Organization: http://groups.google.com Message-ID: <16824531.853.1334005741021.JavaMail.geo-discussion-forums@ynbv36> References: <22193583.1528.1333759470339.JavaMail.geo-discussion-forums@vbdn7> <87mx6nvlwo.fsf@ludovic-brenta.org> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1334006076 17000 127.0.0.1 (9 Apr 2012 21:14:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 9 Apr 2012 21:14:36 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-04-09T14:09:00-07:00 List-Id: On Saturday, April 7, 2012 6:55:29 AM UTC-7, Robert A Duff wrote: > There are at least two ways to implement it: >=20 > Call F(42), putting the result in a temp. > Call Allocate with the size and alignment of that temp. > Copy the temp into the newly-allocated object, > with adjustment/finalization if controlled. >=20 > Call F, passing it a hidden thunk, which does > the allocation. > At the point where F does "return", call the thunk, > passing this size and alignment. > Store the result of F at the address returned by > the thunk. >=20 > If the designated type is limited, the second way is > necessary, because the first way won't work (it involves > a copy, which won't work for limited types). That last isn't really true, I think. The language says there's no *assign= ment* for limited types; the assignment operation is defined by the languag= e, and that operation involves finalization, adjustment, maybe some constra= int checks, maybe some other things. But there's no rule saying that the c= ompiler can't implement things by doing a byte copy "under the hood", as lo= ng as it doesn't result in any additional Adjust/Finalizes being called. T= he language specifies how things look semantically, not how they're impleme= nted. The tricky case is where the result of F contains self-references (possibly= in a component); now, if the compiler generates code to do a byte copy, it= has to make sure any self-references are fixed. I don't think that genera= ting code like this violates any language semantics, though. (In fact, see= AARM 7.6(17.q-17.v); I think those say that the "intended implementation" = is that the address of J.all is the same as the address of the return objec= t when F is called, but that's not a requirement and alternative implementa= tions are theoretically possible.) -- Adam