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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.99.148.1 with SMTP id m1mr90011pge.28.1485495545294; Thu, 26 Jan 2017 21:39:05 -0800 (PST) X-Received: by 10.157.20.145 with SMTP id d17mr481476ote.18.1485495545216; Thu, 26 Jan 2017 21:39:05 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!r185no560934ita.0!news-out.google.com!15ni11822itm.0!nntp.google.com!r185no554825ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 26 Jan 2017 21:39:04 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:5985:2c17:9409:aa9c; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:5985:2c17:9409:aa9c References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Extend slices for n dimensional arrays for Ada 202X From: Robert Eachus Injection-Date: Fri, 27 Jan 2017 05:39:05 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:33185 Date: 2017-01-26T21:39:04-08:00 List-Id: Whoops! I apologize an editing error made this sound nasty... On Thursday, January 26, 2017 at 8:54:53 PM UTC-5, Robert Eachus wrote: > On Thursday, January 26, 2017 at 1:29:07 PM UTC-5, Randy Brukardt wrote: >=20 > > So I don't see this happening - it doesn't make sense in the context of= Ada=20 > > implementation strategies. >=20 > Randy, I hope you are confused. ...about how your compiler deals with copying complex objects. About 30 ye= ars ago, Dave Emery found that the Verdix compiler was moving strings a byt= e at a time and wrote a (32-bit) word at a time routine (in Ada) which did = all the messy misalignment stuff, and did go byte at a time for short strin= gs. Verdix asked permission to put the code in their run-time. So Dave wr= ote it up--I don't remember if it was for Ada Letters or Ada Europe, but an= yway made it public domain. AS far as I knew all the Ada compilers picked = it up, it about doubled Dhrystone scores. ;-) =20 It would be nice to have one-dimensional slices of two dimensional arrays. = But supporting Fortran interfaces messes that up, unless someone could fig= ure out a way to make the situation work for the easy cases and illegal for= the difficult cases. I do have code which maps a series of vectors onto a= matrix. It is not too difficult, but tends to end up with theoretically n= on-portable code. (You need to know the size of the descriptor at the star= t of an unconstrained array. I suspect it is the same for all compilers fo= r the normal cases, but no guarantee. I guess you could use the same (Unchecked_Conversion) method to put (constr= ained) records on top of an array if you want to step through the columns. = But as I said above, on modern hardware it just pays too well to do the tr= anspose. You do the transpose several rows at a time, sized based on cache= s. Figuring the 'right' size for a given machine takes work, best if you c= an do it is to read from multiple rows and put together one cache line in t= he output.