comp.lang.ada
 help / color / mirror / Atom feed
From: edm@vrdxhq.verdix.com (Ed Matthews)
Subject: Re: Use of "is separate" and compilatio
Date: 28 Nov 89 17:40:58 GMT	[thread overview]
Message-ID: <23960@vrdxhq.verdix.com> (raw)
In-Reply-To: 20600021@inmet

I pretty much agree with Tucker.  I used to really like separate subunits,
but now that I have switched to the compiler development side of the
world, it's easy to see that separate subunits is one of those issues
that gives compiler and optimizer writers nightmares.

In article <20600021@inmet> stt@inmet.inmet.com writes:

>When making a change or trying to understand a particular
>feature of the system, it is generally only necessary to
>look at the single medium-size package which implements it.

On the whole, Tuck makes some persuasive arguments, but I disagree here.
This argument is an artifact of the editors of the past.  With modern
editor technology and windowing, the entirety of a package, whether it
be one package of 2500 lines, or 25 subunits of 100 lines, can be 
easily viewed.  Further, in editors with syntactic and semantic
navigation, understanding a unit is equally easy no matter how the
program is structured.

>Furthermore, most of the candidates for low-level, small-chunk-of-code
>reuse, are within a single package.

I agree here -- reuse at the small-chunk-of-code level may be obscured
by subunits.  This is another another topic, but I wonder how much value
small-chunk-of-code reuse represents on the reuse continuum.  I do a lot
of reuse at this level.

>Thirdly, subunits cause havoc with sophisticated optimizers,
>especially subunits within subprograms.  When calling a separately-compiled
>subunit the compiler must assume the worst: that the subunit
>accesses and/or updates all objects it can see, meaning that
>all local variables visible to the subunit must be stored back
>into memory from registers before the call, and reloaded afterward.

Furthermore, the compiler has to assume that the subunit may contain tasks
and then it has to generate code to check for task termination etc.

Two guidelines to think about when using separate subunits:

1. Separate subunits should be declared in package bodies, not in
subprograms.

2. Nest subunits only one layer deep.  A reasonable relaxation might
allow separate package bodies inside separate package bodies.
-- 

Ed Matthews                                                edm@verdix.com
Verdix Corporation Headquarters                            (703) 378-7600
Chantilly, Virginia

  reply	other threads:[~1989-11-28 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-11-27 20:29 Use of "is separate" and compilatio stt
1989-11-28 17:40 ` Ed Matthews [this message]
1989-11-29 20:16 ` arny.b.engelson
1989-12-01 18:29   ` Leonard Vanek
1989-12-04 16:52     ` Michael Schwartz
1989-12-06 12:54       ` Mike Walsh
1989-12-07 23:32     ` Fred Stluka
  -- strict thread matches above, loose matches on Subject: below --
1989-11-29 17:43 stt
replies disabled

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