Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: David Chase <chase@world.std.com>
Subject: Re: WAS Re: Final kick at the "Merced Guessing Game"
Date: 1997/10/18	[thread overview]
Message-ID: <3448BA41.7603@world.std.com> (raw)
In-Reply-To: 62a0f5$9p8$1@lyra.csx.cam.ac.uk


Nick Maclaren wrote:

> Yes, and I regard this whole mess as a tragedy of the first water.  The
> point is that there are TWO aspects here:
> 
>     1) Are ALL pointer operations checked?
> 
>     2) Is there a semi-automatic way of recovering dead space?
> 
> The confusion that caused the Maclaren-O'Keefe explosion was due to a
> misunderstanding over this.  I was stating that I did not like the second
> and had never seen a good one - but I was NOT stating that I did not want
> the first!  What I actually want is a language where all pointer uses are
> checked, and I get an error when I get it wrong, but where the system
> does not do unspeakable things to my data storage behind my back.

The difficulty here is that without garbage collection, you may
accidentally do unspeakable things to the type-correctness of your
program, and the cost of checking all pointer operations goes up in an
alarming way.  For the case of

  foo * f = foo_list -> head;

if you knew that foo_list had not been freed and reallocated then you
could trust its static type.  But, you do not know that in general.
And, you need to know that the pointer stored in the head field has
not been freed and reallocated as well.  To determine this with
certainty, since any subroutine call (or, perish the thought, thread)
might free and reallocate a piece of storage, you will need to check
the allocation state and type of foo_list and the allocation state and
type of the pointer stored in its head field.  This is still not a
100% guarantee of program sanity, since it is possible that a piece
of storage was freed and reallocated as the same type; the result is
type-correct in the narrowest interpretation of the word, but the
any program that does this is very fragile.

I implemented the runtime for something that did this for C and C++ in
my previous job (C++Expert at CenterLine), and you can check most of
this stuff, but you would never call it fast unless you were comparing
it to other products performing a similar function.  And yes, there's
clever tricks you can perform to make it go faster, and we used a few
of them, and it is still nowhere near as fast as unchecked C and C++.
You could make it go a little faster if you used an unorthodox
representation for pointers but then you'd be in your own closed
little world and unable to interoperate with the operating system.

Once you've decided that bounds and type-checking are not optional,
garbage collection is the biggest optimization around, because you can
dispense with boatloads of checking.

-- 
David Chase, chase@world.std.com



  parent reply	other threads:[~1997-10-18  4:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-07  4:00 Final kick at the "Merced Guessing Game" Robert Harley
1997-10-07  4:00 ` Martin Rodgers
1997-10-07  4:00 ` Shankar Unni
1997-10-08  4:00   ` boo
1997-10-09  4:00     ` Patrick F. McGehearty
1997-10-10  4:00       ` Richard A. O'Keefe
1997-10-15  4:00         ` David Chase
1997-10-16  4:00           ` William Clodius
1997-10-17  4:00             ` WAS " David Chase
1997-10-18  4:00               ` Nick Maclaren
1997-10-18  4:00                 ` [Reposted due to Enlow UCE cancel]: " David Chase
1997-10-19  4:00                   ` Nick Maclaren
1997-10-22  4:00                     ` pointer checking (WAS Re: Final kick at the "Merced Guessing Game") Hans-Juergen Boehm
1997-10-18  4:00                 ` David Chase [this message]
1997-10-07  4:00 ` Final kick at the "Merced Guessing Game" Nick Maclaren
read-only archive

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