comp.lang.ada
 help / color / mirror / Atom feed
From: stt@henning.camb.inmet.com (Tucker Taft)
Subject: Subunits of packages vs. subunits of subprograms
Date: 1996/07/11
Date: 1996-07-11T00:00:00+00:00	[thread overview]
Message-ID: <DuDx0J.F5q.0.-s@inmet.camb.inmet.com> (raw)


[NOTE: This is a continuation of the discussion of subunits, but I couldn't
bear to see "separate" misspelled yet again.  I would think that
Ada programmers, of all people, would know that "separate" has two "a"s.
Perhaps the misspelling just proves that subunits are no longer being 
used as much in Ada 95 ;-).]

In any case, our AdaMagic(tm) front end implements the approach Robert 
mentions, namely that subunits nested only in packages are "truly"
separately compiled, whereas subunits nested in any non-package are
"inlined" at the point of the stub.  If the subunit is not available
when this "inlining" would take place, we issue a warning that the enclosing
unit will need to be recompiled when the subunit is available.  We don't
consider this an error, and the (pre)linker will by default perform
the needed recompilation if necessary.

Interestingly, when we retargeted AdaMagic to generate Java byte codes
(our "AppletMagic(r)" product), we had to shift to fully "inlining"
all subunits, as well as generating code for package specs only when
encountering the package body (presuming there is one).  This was necessary
because, given our Ada => Java mapping, all code for a single Ada package 
needs to be in the same Java ".class" file.  In fact, the whole 
source->object model breaks down a bit with Java byte codes, because Java
"object modules" (.class files) are required to be one-to-one with Java 
classes, which relate to Ada entities, not to Ada source files.

So our front end now supports both approaches, fully "inlined" 
subunits, and separate compilation of package-enclosed subunits, 
depending on the target.

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Cambridge, MA  USA




             reply	other threads:[~1996-07-11  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-11  0:00 Tucker Taft [this message]
1996-07-11  0:00 ` Subunits of packages vs. subunits of subprograms Robert Dewar
1996-07-11  0:00 ` David Morton
1996-07-11  0:00   ` Robert Dewar
1996-07-13  0:00   ` Michael Feldman
1996-07-21  0:00     ` Robert A Duff
1996-07-15  0:00 ` James A. Squire
1996-07-21  0:00   ` Robert A Duff
1996-07-24  0:00   ` JamesS1889
replies disabled

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