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,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e93f73587e2bc1c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!open-news-network.org!news.ett.com.ua!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: Sharing generic bodies across instantiations. Date: Wed, 28 Jul 2010 11:16:24 +0000 (UTC) Organization: ETT newsserver Message-ID: References: <4c4e2d69$0$2378$4d3efbfe@news.sover.net> Reply-To: anon@anon.org NNTP-Posting-Host: dialup-4.225.175.227.dial1.dallas1.level3.net X-Complaints-To: usenet@news.ett.com.ua X-Notice: Filtered by postfilter v. 0.6.1 X-Newsreader: IBM NewsReader/2 2.0 Xref: g2news1.google.com comp.lang.ada:12626 Date: 2010-07-28T11:16:24+00:00 List-Id: In , Keith Thompson writes: >anon@att.net writes: >[...] >> The Replication versus the Sharing of Generic code was initial based on the >> Ada Optimize pragma statement. That is, when the users define the option >> of "Time" the Generic code would be replicated, but the "Space" option >> would cause the compiler to share the code body. Not using the pragma >> statement or the Ada 95 "off" option allowed the designer to set an >> implementation default. > >I don't believe the definition of pragma Optimize was ever that >specific; as far as I know, it was always intended merely as a vague >hint. > >Here's the description from the Ada 83 reference manual: > > OPTIMIZE Takes one of the identifiers TIME or SPACE as the single > argument. This pragma is only allowed within a declarative part > and it applies to the block or body enclosing the declarative > part. It specifies whether time or space is the primary > optimization criterion. > >Using it to control generic code sharing would certainly be reasonable, >but it's not required. > >-- >Keith Thompson (The_Other_Keith) kst-u@mib.org >Nokia >"We must do something. This is something. Therefore, we must do this." > -- Antony Jay and Jonathan Lynn, "Yes Minister" Besides Ada 83 chapter B on pragmas, a little more detail can be found in 10.3, 10.6, 11.6. There are many forms of Optimizations. Sharing vs replicated and removing dead or unused code are some of the easiest to implement. Altering algorithms and expressions can be coslty. If the optimization criterion is set to "Space" then using shared generic code reduces the memory but may increase time for the program to execute those routines. As well as when the criterion is set to "Time" replicated code may be faster at the cost of using more memory. So, the Ada Optimize pragma statement does not limited it self to only expressions it also includes the way generic codes are generated and used. For Ada 95 RM 2.8 Pragmas 27 A pragma Optimize takes one of the identifiers Time, Space, or Off as the single argument. This pragma is allowed anywhere a pragma is allowed, and it applies until the end of the immediately enclosing declarative region, or for a pragma at the place of a compilation_unit, to the end of the compilation. It gives advice to the implementation as to whether time or space is the primary optimization criterion, or that optional optimizations should be turned off. It is implementation defined how this advice is followed. also check out D.12 Other Optimizations and Determinism Rules