From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,8e3b3db66f3b0061 X-Google-Attributes: gid1014db,public X-Google-Thread: f4fd2,8e3b3db66f3b0061 X-Google-Attributes: gidf4fd2,public X-Google-Thread: 109fba,8e3b3db66f3b0061 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,474d28ddf953b3c1 X-Google-Attributes: gid103376,public X-Google-Thread: fd443,8e3b3db66f3b0061 X-Google-Attributes: gidfd443,public X-Google-ArrivalTime: 1994-12-13 08:12:33 PST Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp,comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!news.edu.tw!news.cc.nctu.edu.tw!nctuccca.edu.tw!howland.reston.ans.net!agate!darkstar.UCSC.EDU!news.hal.COM!decwrl!netcomsv!netcom.com!hbaker From: hbaker@netcom.com (Henry G. Baker) Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection) Message-ID: Organization: nil References: <3bo43b$61v@news.parc.xerox.com> Date: Tue, 13 Dec 1994 16:12:33 GMT Xref: nntp.gmd.de comp.lang.c:72105 comp.lang.c++:82771 comp.lang.lisp:9591 comp.lang.ada:17508 Date: 1994-12-13T16:12:33+00:00 List-Id: In article bobduff@dsd.camb.inmet.com (Bob Duff) writes: >In article , >Henry G. Baker wrote: >>I just wanted to point out again that objects whose reference counts >>are always one, and the programmer/compiler knows this, avoid the >>usual overheads of reference counting. > >But it seems to me that in a language like Ada, if a given object only >has one reference pointing to it, and that fact is known at compile >time, then you would almost always declare that object as a normal >stack-allocated object. So it would not be in the heap in the first >place, so reference counting would never occur. > >In other words, the optimization you mention seems useful in a language >like Lisp, where everything's a pointer, but it seems irrelevant to Ada. >Or, to put it differently, Ada compiler's already do this optimization >-- the way you invoke it is to use an object instead of a >pointer-to-object. This optimization is quite useful in Ada -- perhaps more useful than in Lisp because of the existence of multiple threads/tasks. Whereas stack-allocated objects are constrained by LIFO behavior, the objects I describe have no such constraints. Secondly, and probably much more important in Ada, is the fact that an object whose reference count is exactly one can be referenced by only one task/thread, and therefore need _not_ be protected by a semaphore or protected record. Therefore, these objects are ideal objects to be sent in messages from one task/thread to another. (I didn't come up with this stuff, but I highly recommend it. The "NIL" and "Hermes" languages for distributed computations out of IBM Yorktown deal nearly exclusively with singly-referenced objects of this sort.) 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.)