comp.lang.ada
 help / color / mirror / Atom feed
From: hbaker@netcom.com (Henry G. Baker)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Date: Tue, 20 Dec 1994 05:24:34 GMT
Date: 1994-12-20T05:24:34+00:00	[thread overview]
Message-ID: <hbakerD13GCy.3z@netcom.com> (raw)
In-Reply-To: D0x53v.FxE@inmet.camb.inmet.com

In article <D0x53v.FxE@inmet.camb.inmet.com> bobduff@dsd.camb.inmet.com (Bob Duff) writes:
>In article <hbakerD0oM3E.7s3@netcom.com>,
>Henry G. Baker <hbaker@netcom.com> wrote:
>>Another common example is a function that returns an object of
>>arbitrary size.  You don't know how much space to allocate for it
>>on the stack, and if you simply redefine the stack frame to include
>>the object (which was stack-allocated by the called function), then
>>you may waste huge amounts of space on the stack.  So you're better
>>off allocating it in a heap, but remembering that you have only
>>one pointer to it.
>
>Some Ada compilers allocate those things on the heap.  However, others
>(most, I believe) allocate those things on the stack.  When the function
>returns, the result object is copied from wherever it is down to where
>it belongs.  There are numerous complicated optimizations that can be
>done to avoid the copying in many cases.  Some compilers use the normal
>run-time stack, whereas others have a secondary stack for these kinds of
>things, but either way, the principle is the same.

(There must be some sort of an echo in these newsgroups.  We keep
posting the same information over and over again.  I'll try again.)

I'm aware of the usual schemes for allocating objects on the stack and
the heap.  Below are some papers that cover some of these issues, and
reference many other papers on the same subject.

"Structured Programming with Limited Private Types in Ada".  ACM Ada
Letters and ftp://ftp.netcom.com/pub/hb/hbaker/LPprogram.ps.Z.

"CONS Should not CONS its Arguments".  ACM Sigplan Notices and
ftp://ftp.netcom.com/pub/hb/hbaker/LazyAlloc.ps.Z.

Stack allocation of arbitrary-sized objects is too inflexible and/or
too inefficient (due to excess copying) for many uses in a
multi-threaded environment where processes pass objects among
themselves -- precisely the environment the Ada implementor finds
himself.  Unfortunately, heap allocation from a global heap has its
own set of problems in this environment -- e.g., the need to
constantly check and set locks, which becomes a major problem in its
own right.

It is in environments like these that 'linear' objects are most
useful.  (Linear objects are essentially the same as those in
NIL/Hermes.)  Linear objects never need locks and don't have to be
copied.  (More precisely, you can copy them if you want, but you don't
have to worry about leaving a forwarding address, because there's only
one pointer to the object, so no one is in a position to know that it
has been moved!)

See "'Use-Once' Variables and Linear Objects--Storage Management,
Reflection and Multi-Threading".  Siglan Notices, to appear.  Also,
ftp://ftp.netcom.com/pub/hb/hbaker/Use1Var.ps.Z.

This paper references a number of other papers that are also available
on the network.

Henry Baker
Read (192.100.81.1) ftp.netcom.com:/pub/hb/hbaker/README for ftp-able papers.
WWW archive: ftp://ftp.netcom.com/pub/hb/hbaker/home.html
************* Note change of address ^^^        ^^^^
(It _is_ accessible, but Netcom is loaded; keep trying.)




  parent reply	other threads:[~1994-12-20  5:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CzHCvp.9rM@rheged.dircon.co.uk>
     [not found] ` <TFB.94Nov21091959@burns.cogsci.ed.ac.uk>
     [not found]   ` <RFB.94Nov27213114@cfdevx1.lehman.com>
     [not found]     ` <3be0mh$1p7@gamma.ois.com>
     [not found]       ` <3bfprn$okr@scipio.cyberstore.ca>
1994-11-29 21:27         ` Reference Counting (was Re: Searching Method for Incremental Garbage Collection) R. William Beckwith
1994-11-30  2:27           ` Henry G. Baker
1994-11-30 18:59           ` Hans Boehm
1994-12-01  3:20             ` R. William Beckwith
1994-12-01  3:51               ` R. William Beckwith
1994-12-01 13:59               ` Henry G. Baker
1994-12-02  4:26                 ` R. William Beckwith
1994-12-02 21:37               ` Hans Boehm
1994-12-03 15:17                 ` Henry G. Baker
1994-12-09 22:07                   ` Bob Duff
1994-12-11 23:59                     ` Gary McKee
1994-12-12  5:04                       ` Henry G. Baker
1994-12-12 12:46                         ` R. William Beckwith
1994-12-16 19:35                         ` Bob Duff
1994-12-17 20:36                           ` Robert Dewar
1994-12-20  5:24                           ` Henry G. Baker [this message]
1994-12-12  9:36                     ` Robb Nebbe
1994-12-13 16:12                     ` Henry G. Baker
     [not found]           ` <DAG.94Nov30090717@bellman.control.lth.se>
1994-11-30 16:39             ` David Weller
1994-11-30 17:58               ` Erik Naggum
1994-11-30 23:14                 ` Michael Feldman
1994-12-09 14:19                 ` Ada 95 is the name Tucker Taft
1994-12-09 22:33                   ` Pat Rogers
1994-12-11 18:59                     ` Jean D. Ichbiah
1994-12-11 20:05                       ` Pat Rogers
1994-12-16  1:01                         ` Bob Duff
1994-12-12 14:50                       ` Garlington KE
1994-12-13 21:48                         ` Tucker Taft
1994-12-14 12:44                         ` Gentle
1994-12-14 17:34                         ` Jean D. Ichbiah
1994-12-10 10:10                   ` Marc Wachowitz
1994-12-11 21:37                     ` Bob Duff
1994-12-02 23:41             ` Reference Counting (was Re: Searching Method for Incremental Garbage Collection) Bob Duff
1994-12-03  8:16               ` Bill Birch
     [not found]     ` <3be0mh$1p7@ga <3bii2g$kn2@news.parc.xerox.com>
1994-12-01  4:58       ` Kevin Warne
1994-12-02 21:58         ` Hans Boehm
     [not found] <D06r8x.JBy@inmet.camb.inmet.com>
1994-12-02 17:32 ` Henry G. Baker
1994-12-05 20:59   ` Robert Firth
1994-12-06 14:15     ` Robert Dewar
1994-12-04  1:06 ` Rick Busdiecker
1994-12-04 18:57   ` R. William Beckwith
replies disabled

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