comp.lang.ada
 help / color / mirror / Atom feed
From: anon@att.net
Subject: Re: Sharing generic bodies across instantiations.
Date: Wed, 28 Jul 2010 11:16:24 +0000 (UTC)
Date: 2010-07-28T11:16:24+00:00	[thread overview]
Message-ID: <i2p3i7$2a13$1@news.ett.com.ua> (raw)
In-Reply-To: lnvd80xw5l.fsf@nuthaus.mib.org

In <lnvd80xw5l.fsf@nuthaus.mib.org>, Keith Thompson <kst-u@mib.org> 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  <http://www.ghoti.net/~kst>
>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




      parent reply	other threads:[~2010-07-28 11:16 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27  0:51 Sharing generic bodies across instantiations Peter C. Chapin
2010-07-27  3:01 ` Gene
2010-07-27  6:55 ` AdaMagica
2010-07-27 11:29   ` Ludovic Brenta
2010-07-27 14:10     ` Tero Koskinen
2010-07-27 10:51 ` Martin
2010-07-27 20:06 ` anon
2010-07-27 22:23   ` Peter C. Chapin
2010-07-28  7:59     ` Maciej Sobczak
2010-07-28  9:28       ` Dmitry A. Kazakov
2010-07-28 12:55         ` Maciej Sobczak
2010-07-28 13:16           ` Dmitry A. Kazakov
2010-07-28 19:48             ` Maciej Sobczak
2010-07-29  8:03               ` Dmitry A. Kazakov
2010-07-29 14:02                 ` Maciej Sobczak
2010-07-29 14:40                   ` Dmitry A. Kazakov
2010-07-29 20:27                     ` Maciej Sobczak
2010-07-30  9:09                       ` Dmitry A. Kazakov
2010-07-30 12:31                         ` Maciej Sobczak
2010-07-30 14:59                           ` Dmitry A. Kazakov
2010-08-03  3:02                           ` Randy Brukardt
2010-08-03 14:37                             ` Robert A Duff
2010-08-03  2:47                         ` Randy Brukardt
2010-07-28 20:01             ` Keith Thompson
2010-07-29  7:46               ` Dmitry A. Kazakov
2010-07-28 11:27       ` Peter C. Chapin
2010-07-28 13:10         ` Maciej Sobczak
2010-07-28 16:32           ` Peter C. Chapin
2010-07-28 19:30             ` Robert A Duff
2010-07-28 20:03             ` Maciej Sobczak
2010-07-28 11:47     ` anon
2010-08-03  2:38     ` Randy Brukardt
2010-08-03 14:31       ` Robert A Duff
2010-07-28  0:55   ` Keith Thompson
2010-07-28  8:42     ` Markus Schoepflin
2010-07-28 11:16     ` anon [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox