Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!sun-barr!newstop!exodus!rbbb.Eng.Sun.COM!chased From: chased@rbbb.Eng.Sun.COM (David Chase) Newsgroups: comp.object Subject: Re: Re: C++ and garbage collection (long, but interesting :->) Message-ID: <1098@exodus.Eng.Sun.COM> Date: 2 Oct 90 00:35:46 GMT References: <-283749998@hpcupt1.HP.COM> Sender: news@exodus.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 37 In article <-283749998@hpcupt1.HP.COM> thomasw@hpcupt1.HP.COM (Thomas Wang) writes: >/ hpcupt1:comp.object / chased@rbbb.Eng.Sun.COM (David Chase) / 2:45 pm Sep 26, 1990 / >>One thing I haven't noticed yet is mention of transformations applied >>to pointers by an optimizing compiler. >...But in today's world, where memory is relatively cheap, there is no reason why >a pointer cannot be encapsulated into an abstract data type that understands >operations on garbage collection. ... >I assume every GC pointer is root, until they become not root. For GC pointers >inside a structure, the constructor for that structure will turn all its >GC pointers to non-root. > >The result is a non-conservative C++ collector that is also portable. Can you elaborate on this somewhat? Is this a compacting collector, a non-compacting collector, or a conservatively (Bartlett-style) compacting collector? Do you believe that your code is safe in a preemptively scheduled multi-threaded system (if you don't say "volatile" somewhere, I'll claim that it isn't.) Do you deal with the full language, or do you impose restructions on casting or use of reference parameters (operations that can generate internal offset pointers). Sorry to seem like such a nay-sayer -- I really do like garbage collection -- but I get the impression that many proponents of garbage collection in C++ haven't put enough effort into generation of pathological counter-examples, or (informal) proofs of correctness against the language *as it is specified* (as opposed to how it is impemented today). Remember that eventually all that fancy syntax turns into pointer arithmetic and dereferencing, and that optimizing compilers are free to take great liberties in reordering these operations. David Chase Sun Microsystems