comp.lang.ada
 help / color / mirror / Atom feed
From: firth@sei.cmu.edu (Robert Firth)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Date: Mon, 5 Dec 1994 15:59:13 EST
Date: 1994-12-05T15:59:13-05:00	[thread overview]
Message-ID: <1994Dec5.155913.14005@sei.cmu.edu> (raw)
In-Reply-To: hbakerD07221.1C0@netcom.com

In article <hbakerD07221.1C0@netcom.com> hbaker@netcom.com (Henry G. Baker) writes:

>You should be prepared for huge overheads when updating reference
>counts on shared objects in a multiple-threaded (multiple-tasked)
>program.

Not necessarily.  The PE3200, for example, has an "add to memory"
insturction that seems tailor made for this problem.

	AM reg, mem

In practice, the constants +1 and -1 were so often used as the
addend that I simply had the compiler permanently allocate two
registers to them, so any reference counting became a single
atomic instruction.

Well, things are now riscier.  So here's another way: make the
reference counting a sequence of instructions:

	L reg, mem
	AI reg, 1
	S reg, mem

In the task context switch, check whether you interrupted that
sequence *and the memory address points into the shared heap*
(trivial on a risc machine with essentially one memory address
mode), and simply slave whatever didn't get done.  On some
machines, it may be cheaper always to slave rather than even
bother checking the address.



  reply	other threads:[~1994-12-05 20:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D06r8x.JBy@inmet.camb.inmet.com>
1994-12-02 17:32 ` Reference Counting (was Re: Searching Method for Incremental Garbage Collection) Henry G. Baker
1994-12-05 20:59   ` Robert Firth [this message]
1994-12-06 14:15     ` Robert Dewar
1994-12-04  1:06 ` Rick Busdiecker
1994-12-04 18:57   ` R. William Beckwith
     [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         ` R. William Beckwith
1994-11-30  2:27           ` 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-02 23:41             ` Bob Duff
1994-12-03  8:16               ` Bill Birch
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
1994-12-12  9:36                     ` Robb Nebbe
1994-12-13 16:12                     ` Henry G. Baker
     [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
replies disabled

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