comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada202X: Easy to use "UML private"-like components
Date: Tue, 25 Jun 2013 14:37:48 -0500
Date: 2013-06-25T14:37:48-05:00	[thread overview]
Message-ID: <kqcrig$mod$1@loke.gir.dk> (raw)
In-Reply-To: wcctxknt2r7.fsf@shell01.TheWorld.com

"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
news:wcctxknt2r7.fsf@shell01.TheWorld.com...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
...
>> Janus/Ada doesn't do inlining at all, ...
>
> Well, there goes (run-time) efficiency.  Seriously, I don't see how
> "don't do inlining" is a reasonable implementation of inlining.

It's unclear to me that inlining makes enough difference for the 
implementation earthquake that it would have represented in Janus/Ada 
(several man-years of work). Since Janus/Ada compiles statements directly 
from their syntax, the largest program structure that it can store is an 
expression tree (and that was a later change, necessitated by the 
requirements of Ada resolution - the original design was purely 
syntax-driven). That would allow inlining of expression functions (and 
functions that are similar to expression functions), but little larger. (One 
could imagine converting if statements into if expressions to allow a bit 
more inlining.)

>>...other than of things visible in
>> specifications (expression functions make a significant expansion of what
>> can be inlined -- one of the reasons the idea was invented in the first
>> place, many years ago). If it ever does do inlining of subprograms, it 
>> would
>> do it at bind-time, (and mostly automatically).
>
> "mostly automatically" is good.
>
> But I don't see how bind time (i.e. link time) helps.  It's a reasonable
> approach, but it takes just as long to generate code at link time as it
> does at compile time, for the same generated code.  If you modify the
> procedure body being inlined, you have to regenerate code at all call
> sites, either way.

Doing this at bind-time allows inlining stuff that neither the user nor the 
compiler really know might be inlined, and it also allows partial evaluation 
of calls based on what is actually present in the program (think about the 
second parameter to New_Line -- it's hardly ever used; code shared generics 
have a similar parameter for sharing information, of course). (It also 
allows other cross-procedural optimizations.)

Final code generation obviously has to occur after those optimizations, so 
it would always be done at bind-time in that scenario. So there wouldn't be 
any incremental cost to inlining (other than the cost of actually doing it). 
This wasn't a practical implementation in 1995 (which is why we didn't do it 
then), but it was always the intended end-game for Janus/Ada. (That code 
generation can be parallelized, and much of the cost of binding disappears 
if the code generation is delayed, so on a modern multi-core I wouldn't 
expect the binding time to grow that much.)

Anyway, if I spent less time writing about this implementation and more time 
creating it, we could see how well it works. ;-)

                                       Randy.




  reply	other threads:[~2013-06-25 19:37 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21  8:43 Ada202X: Easy to use "UML private"-like components Martin
2013-06-21  9:23 ` Dmitry A. Kazakov
2013-06-21  9:33   ` Martin
2013-06-21 10:14     ` G.B.
2013-06-21 11:19       ` Martin
2013-06-21 14:51     ` Dmitry A. Kazakov
2013-06-22 11:16       ` Martin
2013-06-22 12:10         ` Dmitry A. Kazakov
2013-06-21 18:36 ` Robert A Duff
2013-06-22 16:41   ` Niklas Holsti
2013-06-22 19:05     ` Dennis Lee Bieber
2013-06-22 22:57       ` Niklas Holsti
2013-06-23  3:26         ` Dennis Lee Bieber
2013-06-23  7:32           ` Niklas Holsti
2013-06-23 13:12             ` Robert A Duff
2013-06-23 14:06               ` Dmitry A. Kazakov
2013-06-23 15:15                 ` Robert A Duff
2013-06-23 18:52                   ` Dmitry A. Kazakov
2013-06-23 23:38                     ` Robert A Duff
2013-06-24  7:16                       ` Dmitry A. Kazakov
2013-06-24 20:11                         ` Randy Brukardt
2013-06-25  7:21                           ` Dmitry A. Kazakov
2013-06-25 19:06                             ` Randy Brukardt
2013-06-24 20:07                 ` Randy Brukardt
2013-06-23 14:40               ` Shark8
2013-06-23 15:28                 ` Robert A Duff
2013-06-23 18:14                   ` Bill Findlay
2013-06-23 23:43                     ` Robert A Duff
2013-06-23 23:48                       ` Bill Findlay
2013-06-24 20:16                   ` Randy Brukardt
2013-06-24 20:05               ` Randy Brukardt
2013-06-25  1:09                 ` Robert A Duff
2013-06-25 19:37                   ` Randy Brukardt [this message]
2013-06-23 12:28         ` Robert A Duff
2013-06-24 20:20           ` Randy Brukardt
2013-06-24 21:40             ` Niklas Holsti
2013-06-25  0:43               ` Robert A Duff
2013-06-25 19:23                 ` Randy Brukardt
2013-06-25 19:19               ` Randy Brukardt
2013-07-09 11:24   ` Martin
2013-07-09 14:39     ` Simon Wright
2013-07-10  7:03       ` Martin
2013-07-09 21:43     ` Robert A Duff
2013-07-10  6:34       ` Martin
2013-07-10  8:24         ` Dmitry A. Kazakov
2013-07-10 13:06           ` Martin
2013-07-10 16:12     ` Simon Wright
2013-07-10 18:22       ` Martin
2013-07-10 19:41         ` Simon Wright
2013-07-11 18:28           ` Martin
2013-07-11 19:37             ` Simon Wright
2013-07-11 20:43               ` Martin
2013-07-12  6:57                 ` Simon Wright
2013-07-12  8:05                   ` Martin
replies disabled

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