Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Re: Final kick at the "Merced Guessing Game"
  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-07  4:00 ` Nick Maclaren
  2 siblings, 1 reply; 15+ messages in thread
From: Shankar Unni @ 1997-10-07  4:00 UTC (permalink / raw)



Robert Harley wrote:

> ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes:
> >There is precisely *one* construction present in C which is not
> >supported as well or better by Fortran, and that is pointer arithmetic.
> 
> That sounds suspiciously like "There is precisely *one* thing present
> on car X which is not on car Y, and that is wheels".

Yo, Robert (and you, too, "boo@somethingorother.umn.edu"):

Richard and Nick have probably forgotten more C than you'll ever learn
in your lifetime, OK? Give it a rest; listen and learn. There's a few
lifetimes of actual working experience behind these opinions..

We see this sort of crazed C cheerleading about the start of every
semester. We've all programmed in C (and in C++). We are painfully aware
of almost every strength and weakness in both C and C++.

No one's slamming C as the worst of all languages. I'll still write an
OS, if I have to, in C or C++, but after breaking my ankles on all the
gopher holes, I'll be real careful where I put my foot the next time.

But if I'm doing numerical analysis or linear regressions, I'll pick
Fortran almost any day. No, I won't do it in C++, even if I can make a
"Matrix" class ("look, Mommy! I made a Matrix!"). If you don't
understand why, you need to take a *real* "Numerical Analysis with C++"
class.

-- 
Shankar Unni                       Powertel Global, Inc.
(650) 259-1700                     shankar@powertelglobal.com
(650) 259-1702 (fax)               shankar@webnexus.com



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
@ 1997-10-07  4:00 Robert Harley
  1997-10-07  4:00 ` Martin Rodgers
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Robert Harley @ 1997-10-07  4:00 UTC (permalink / raw)



ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes:
>There is precisely *one* construction present in C which is not
>supported as well or better by Fortran, and that is pointer arithmetic.

That sounds suspiciously like "There is precisely *one* thing present
on car X which is not on car Y, and that is wheels".


>[... FUD deleted...]

Hey, if some people are under the delusion that C sucks but
Fortran/Lisp/etc are great, that's just fine.  But please resist the
urge to barge into every thread and yammer on about it.

-- R.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  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-07  4:00 ` Nick Maclaren
  2 siblings, 0 replies; 15+ messages in thread
From: Nick Maclaren @ 1997-10-07  4:00 UTC (permalink / raw)




In article <61cqkc$9r@news-rocq.inria.fr>,
harley@pauillac.inria.fr (Robert Harley) writes:
|> ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) writes:
|> >There is precisely *one* construction present in C which is not
|> >supported as well or better by Fortran, and that is pointer arithmetic.
|> 
|> That sounds suspiciously like "There is precisely *one* thing present
|> on car X which is not on car Y, and that is wheels".

Are you aware of the facts (a) that unchecked pointer arithmetic
is the source of most of the foulest bugs in existing software,
(b) that many software engineering experts believe that it is
impossible to use safely and (c) that a vast amount of experience
shows that it can usually be omitted with little hassle to the
programmer?

Your analogy is more than a little inappropriate.

|> Hey, if some people are under the delusion that C sucks but
|> Fortran/Lisp/etc are great, that's just fine.  But please resist the
|> urge to barge into every thread and yammer on about it.

The original question was "what effect do you think that the amazing
new features will have", and I answered "very little, because of the
loathesome coding style (and language properties) of many standard
applications."  You may regard that as irrelevant, but you would be
wrong.


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  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-07  4:00 ` Nick Maclaren
  2 siblings, 0 replies; 15+ messages in thread
From: Martin Rodgers @ 1997-10-07  4:00 UTC (permalink / raw)



Robert Harley wheezed these wise words:

> Hey, if some people are under the delusion that C sucks but
> Fortran/Lisp/etc are great, that's just fine.  But please resist the
> urge to barge into every thread and yammer on about it.

Let's ask the C/C++ if they could please follow the same advise. When 
I started reading UseNet, for the first 3 years I saw massed attacks 
from C/C++ programmers, massively crossposting, attacking Lisp.

If C++ is such a fine language, then do so many of its supporters 
express their support by "dumping" on other languages? What are they 
trying to prove? Ditto for C.

Now, can anyone tell me what was significant about 1995 that caused 
those massed attacks (mentioned above) to cease? I think that the form 
of those attacks may offer a wee clue: garbage collection. Is there no 
stronger argument against Lisp than GC? It appears not, judging by the 
post-95 nature of attacks on Lisp.

Surely there're better arguments for using C/C++ than kicking some 
other language? I appreciate good intentions, but I'm puzzled by the 
frequency with which I find people on UseNet (and elsewhere) trying to 
convince a group of people that they shouldn't be using the tools that 
they are in fact using. Even if we do all need saving from ourselves, 
could there not be a better way of doing it than the "hard sell"?

Richard's comments look to me like a reasonable response to a hard 
sell. It's a popular one, and it goes like this, "Thanks for your 
time, but I'm perfectly happy with what I'm currently using." Some 
people go as far as hanging up the phone or closing the door, rather 
than continue an argument that has no end.

Of course, I could be wrong about Richard's comments. I can't 
speak for him! I'll get my coat.
-- 
<URL:http://www.wildcard.demon.co.uk/> You can never browse enough
              Please note: my email address is gubbish
                         assert(got(coat)).



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  1997-10-07  4:00 ` Shankar Unni
@ 1997-10-08  4:00   ` boo
  1997-10-09  4:00     ` Patrick F. McGehearty
  0 siblings, 1 reply; 15+ messages in thread
From: boo @ 1997-10-08  4:00 UTC (permalink / raw)



Shankar Unni wrote:

> But if I'm doing numerical analysis or linear regressions, I'll pick
> Fortran almost any day. 

Hahahah! linear regressions!! I can do those on my watch calculator!!
Hey, that is some high level stuff you are doing there, thank God
you have Fortran to help you out! I agree, with advanced (heh) stuff
like that, you need to have a specialized numerical language.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  1997-10-08  4:00   ` boo
@ 1997-10-09  4:00     ` Patrick F. McGehearty
  1997-10-10  4:00       ` Richard A. O'Keefe
  0 siblings, 1 reply; 15+ messages in thread
From: Patrick F. McGehearty @ 1997-10-09  4:00 UTC (permalink / raw)



In article <343C1030.4A86F6D6@tonys.ecology.umn.edu>,
boo  <boo@tonys.ecology.umn.edu> wrote:
>Shankar Unni wrote:
>
>> But if I'm doing numerical analysis or linear regressions, I'll pick
>> Fortran almost any day. 
>
>Hahahah! linear regressions!! I can do those on my watch calculator!!
>Hey, that is some high level stuff you are doing there, thank God
>you have Fortran to help you out! I agree, with advanced (heh) stuff
>like that, you need to have a specialized numerical language.

If you think that you can handle serious numerical analysis on your
watch calculator, you have no understanding of current issues in
high end technical computing.  Data set sizes often run to Gigabytes, and
compute times on high end servers (that run in excess of 10Gflops) runs to
days or weeks.  The problem sizes will continue to grow as compute power per
dollar grows to allow larger problems to be attacked.

The problems are not just of academic interest.  Most every major
manufacturing company uses computer simulation before they start "bending
iron" (actually its seldom iron these days).  Technical computing
applications include: simulation of the whole airplane to improve fuel
economy and quietness, crash simulation of cars to improve occupant
surviability, flow analysis of air filters for better durability and
effectiveness, seismic data analysis to improve drilling success rates,
modeling of chemical interactions to reduce time to market for new
treatments for illnesses, and many others.

The overwhelming majority of existing code in these market areas is in
Fortran and C.  New development is moving to C++ and Fortran90.  In most of
these areas, the common method of programming is to the computationally
interesting part of the code in Fortran and the human interface part of the
code in C.  That method works because each language has areas where it is
strongest.  Some developers chose to forgo the advantages of using both
languages in order to have only one development language, but they also pay
a penalty, either in performance if they use only C or ease of development
of elaborate data structures if they use only Fortran.

All high-end vendors that I know of offer reasonable (and semi-portable)
ways to mix Fortran and C.  For example, Fortran arrays are column-major and
C arrays are row-major.  You mix them by being sure to reverse the order of
array indices when going from one language to the other.  If you want
portable code, you avoid passing certain kinds of data structures between
the Fortran and C portions of your (large) application.  Character strings
in particular tend to have non-uniform representations between vendors.
But vectors of float (real*4) and double (real*8) tend to work the same on
almost all vendors between C and Fortran.

All this "my language is best because it is all I know" discussion is not
very enlightening.  Let's get back on the "language features which will
aid/hender future architectures generate fast applications" topic.

- Patrick McGehearty
patrick@convex.hp.rsn



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  1997-10-09  4:00     ` Patrick F. McGehearty
@ 1997-10-10  4:00       ` Richard A. O'Keefe
  1997-10-15  4:00         ` David Chase
  0 siblings, 1 reply; 15+ messages in thread
From: Richard A. O'Keefe @ 1997-10-10  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5582 bytes --]


Patrick F. McGehearty <patrick@convex.COM> writes:
>All this "my language is best because it is all I know" discussion is not
>very enlightening.  Let's get back on the "language features which will
>aid/hender future architectures generate fast applications" topic.

Given my respect for David Chase, my awareness from the literature that
the kinds of transformations he is talking about _are_ used and _do_
pay off (indeed, I have a student doing a minor thesis on neural nets
trying to see if he can beat Sun's C compiler -- alas, he was unwilling
to learn Fortran --), and also given my strong liking for functional
programming languages like Haskell and Clean, I'm worried.

People in the functional programming community have put a _lot_ of work
into trying to implement functional languages really well.  For example,
on the pseudoknot benchmark, Clean-compiled code ran as fast as C.

There are techniques like loop unrolling that can be applied in functional
languages as well.  Let's take the well-known `member' function:

    member :: a [a] -> Bool | == a
	/* This declaration means that member is a function that will
	   accept homogeneous lists with any element type, as long as
	   that element type has an equality operation, and returns a
	   Boolean result.
	*/
    member x [e:es] = x == e || member x es
    member x []     = False

Clean is a lazy language, but the Clean compiler is able to infer that
this function is strict.  In fact, in the context of the definition

    Start = member 3 [4,1,3,2,5]

the Clean compiler will make an instance member (int) and infer, without
any declarations at all

    member (int) :: Int ![Int] -> Bool

where ! means strict.  So the code that is generated is perfectly ordinary
call-by-value stuff.  In fact, it's pretty much the equivalent of

    template <class T>
    bool member(T const x, list<T> es) {
	for (; es != NULL; es = es->tail)
	    if (es->head == x) return true;
	return false;
    }

This is precisely the kind of code that David Chase decries as intrinsically
inefficient.

There _are_ things that can be done here, and they can be done precisely
because these languages have no mutable data structures and are fairly
straightforward to analyse.  One thing I'd like to discuss _has_ been
implemented, but _not_ as far as I know in the Clean compiler.  That is,
loop unrolling.

Instead of having
    :: list a = Nil | Cons a (list a)
you unroll the type.  Unrolling by 3 would give

    :: list3 a = Nil3 | Cons31 a | Cons32 a a | Cons33 a a a (list3 a)

This would economise on space as well, taking an average of 4/3rds of a
word per element instead of 2 words per element.  A compiler can automatically
rewrite the member function to

    member3 x Cons33 e1 e2 e3 es = x == e1 || x == e2 ||
                                   x == e3 || member3 x es
    member3 x Cons32 e1 e2       = x == e1 || x == e2
    member3 x Cons31 e1          = x == e1
    member3 x Nil3               = False

I must repeat, the Clean compiler does NOT do this transformation, but
there has been published work on a compiler for another functional language
that does.  So this kind of loop unrolling _is_ something that can be
applied to pointer chasing, *provided* the language is a high level one
which makes it impossible for a program to notice any difference, except
in performance.

In pure functional languages, speculative loading in such loops ought to
work very well.  So that's another thing that should help.

The thing that has me worried is that fantastic improvements have been
made in compiler technology for functional languages, but the big money
is in compilers for C, C++, Fortran, and Java, so those languages are
always likely to enjoy a lead that relates to their popularity, not
their potential.  This in turn means that such languages will continue
to predominate in benchmarks, which means that computer architects will 
continue to bias their designs towards such languages, which means that
functional language implementors will have even more catching up to do.
The reason this is sad is that lifecycle costs can be reduced when you
have a language which is otherwise sufficiently expressive but in which
a large proportion of common errors _can't_ be expressed.  (Ericsson
believe this.  They have adopted a mostly-functional language of their
own design called Erlang, sacrificing performance in the interests of
time-to-market and reliability.)

Once upon a time, people used to advocate specialised hardware for
symbolic languages.  The phenomenal price-performance improvements
of commodity hardware have made that a thing of the past, and I expect
that to remain true (although there were some seriously interesting
ideas in the LMI K machine which might still be useful).  These days
systems like Clean and O'CAML and SISAL get _fine_ performance on
stock hardware.  My impression, which is not completely up to date
(I'm trying to get through fifty papers this week, phew!), is that
the limiting factor for functional languages is memory.  (For example,
Clean directly supports arrays of unboxed numbers.)

What I'm wondering, and here I go way beyond any expertise I might
possibly claim, is whether (a) there are patterns of memory use in
functional languages that hardware designers might exploit, without
adverse effect on more conventional languages?  and (b) whether the
hardware designers see any point in worrying about this?

-- 
John �neas Byron O'Keefe; 1921/02/04-1997/09/27; TLG,TLTA,BBTNOTL.
Richard A. O'Keefe; RMIT Comp.Sci; http://www.cs.rmit.edu.au/%7Eok



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  1997-10-10  4:00       ` Richard A. O'Keefe
@ 1997-10-15  4:00         ` David Chase
  1997-10-16  4:00           ` William Clodius
  0 siblings, 1 reply; 15+ messages in thread
From: David Chase @ 1997-10-15  4:00 UTC (permalink / raw)



Richard A. O'Keefe wrote:

> Given my respect for David Chase, my awareness from the literature that
> the kinds of transformations he is talking about _are_ used and _do_
> pay off (indeed, I have a student doing a minor thesis on neural nets
> trying to see if he can beat Sun's C compiler -- alas, he was unwilling
> to learn Fortran --), and also given my strong liking for functional
> programming languages like Haskell and Clean, I'm worried.

You've got to be careful here.  Blocking seems to be very hard,
though I would not be surprised if someone's compiler somewhere
did it.  There are algorithms that are intrinsically unblockable,
so I am told my the true experts in the field.  An example of this
is QR factorization using Householder transformations -- you have
to use Givens rotations instead.  No compiler is going to do that
for you.

The advantage of Fortran here is that by-hand cache blocking is
probably sufficient, and the compiler will behave relatively
well with that.  With C, it is likely that you will need to
carry out more extensive by-hand transformations to get the
same performance.

Also, your gradual student had better watch out for what might
euphemistically be termed "targeted optimizations", undiplomatically 
known as benchmark cheating.  Avoid industry-standard benchmarks.

> What I'm wondering, and here I go way beyond any expertise I might
> possibly claim, is whether (a) there are patterns of memory use in
> functional languages that hardware designers might exploit, without
> adverse effect on more conventional languages?  and (b) whether the
> hardware designers see any point in worrying about this?

(a) maybe and (b) not much, though I did loan what I considered
my interesting GC papers to a hardware designer at one time.
I think he was interested in doing no harm, as opposed to actually
helping.

For the time being, I think it makes sense to concentrate on making
functional language implementations resemble Fortran under the hood.
For instance, you could write a garbage collector to take advantage
of the ability to load-w/o-faulting (load first, ask questions about
null pointers later) and also perhaps to prefetch (certainly, in a
copying GC, it would make sense to prefetch/zero cache lines that you
knew you were about to write).

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Final kick at the "Merced Guessing Game"
  1997-10-15  4:00         ` David Chase
@ 1997-10-16  4:00           ` William Clodius
  1997-10-17  4:00             ` WAS " David Chase
  0 siblings, 1 reply; 15+ messages in thread
From: William Clodius @ 1997-10-16  4:00 UTC (permalink / raw)



David Chase wrote:
> 
> Richard A. O'Keefe wrote:
> <snip>
> > What I'm wondering, and here I go way beyond any expertise I might
> > possibly claim, is whether (a) there are patterns of memory use in
> > functional languages that hardware designers might exploit, without
> > adverse effect on more conventional languages?  and (b) whether the
> > hardware designers see any point in worrying about this?
> 
> (a) maybe and (b) not much, though I did loan what I considered
> my interesting GC papers to a hardware designer at one time.
> I think he was interested in doing no harm, as opposed to actually
> helping.
> 
> <snip>

A minor point, but one aspect in which conventional languages are
starting to resemble functional languages is in the presence of garbage
collectors. While I don't know of any C or C++ implementations that
provide it, the availabiltiy of the Boehm collector and the commercial
add ons is starting to impact the C/C++ community. Several Fortran 90
implementations, (but as far as I know only those from UK vendors) now
provide garbage collection. Java is also having an impact here. However,
whether or not they have a significant impact on architecture design
probably requires the development of a benchmark that benefits from GC,
otherwise the bechmarks will be run with GC turned off.

-- 

William B. Clodius		Phone: (505)-665-9370
Los Alamos Nat. Lab., NIS-2     FAX: (505)-667-3815
PO Box 1663, MS-C323    	Group office: (505)-667-5776
Los Alamos, NM 87545            Email: wclodius@lanl.gov



^ permalink raw reply	[flat|nested] 15+ messages in thread

* WAS Re: Final kick at the "Merced Guessing Game"
  1997-10-16  4:00           ` William Clodius
@ 1997-10-17  4:00             ` David Chase
  1997-10-18  4:00               ` Nick Maclaren
  0 siblings, 1 reply; 15+ messages in thread
From: David Chase @ 1997-10-17  4:00 UTC (permalink / raw)



William Clodius wrote:

> A minor point, but one aspect in which conventional languages are
> starting to resemble functional languages is in the presence of garbage
> collectors. While I don't know of any C or C++ implementations that
> provide it, the availabiltiy of the Boehm collector and the commercial
> add ons is starting to impact the C/C++ community. Several Fortran 90
> implementations, (but as far as I know only those from UK vendors) now
> provide garbage collection. Java is also having an impact here. However,
> whether or not they have a significant impact on architecture design
> probably requires the development of a benchmark that benefits from GC,
> otherwise the bechmarks will be run with GC turned off.

There's some problems here, at least with respect to C.  Fortran 90
is somewhat saner with its pointers than is C, at least in its
specification.  Working only within the C specification, it is
possible for the programmer to create pointers anywhere within the
interior of a structure or an array, or to the first address after
such an object.  In practice, C programmers commit vastly more
disgusting sins (my favorite -- out-of-bounds pointer arithmetic
from a freed pointer.  How to report this in C++ Expert was a
real head-scratcher, especially since the code works ok, at least
on Unix workstations, and is rather widely used).  Given what I
know of how compilers might mutilate code, and how programmers
sometimes do mutilate code, the Boehm-Weiser collector is
startlingly robust (and perhaps a bit lucky as well).

Where this difference would be more apparent is if anyone attempted
to build a system using (for instance) a fully-copying garbage
collector (for instance, one of the non-treadmill "real-time"
collectors, or an Ungar-style generational collector).  This is
practical in Fortran-90 AS SPECIFIED, though perhaps not as practiced,
because of the restrictions on what may be done with pointers (it
would require some interesting and entertaining custom optimizer work,
but the optimizer is part of the system, at least if I am designing
it).  There are some stunts employed in F77 programs to get the
effect of pointers; these stunts would not work with a compacting
garbage collector.  What this points out, perhaps, is the need to
adhere to the language specification when writing programs.

For C, however, such a system is probably not practical.
Though there is clearly a specification-satisfying way of implementing
it, the performance is likely to be atrocious, and it would certainly
not behave the way that C programmers usually expect (people are
rather lax about converting pointers to integers and back again, or
about comparing unrelated pointers -- both are bad ideas in a compacting
garbage collector).

(*) to deal with garbage like "i = (p - unrelated_p)", it is a simple
matter of tagging i with the expression (expressed as a difference of
pointers) that generated it, and recomputing this expression after a
garbage collection.  Piece-o-cake, in a performance-independent world.
Or, if the value must be preserved, the existing (live)
pointer-difference
expressions can be used as constraints on how the garbage collector may
move data.  It's crap like this which makes me doubt that C++ will ever
really have garbage collection.

However, I believe you are quite correct in the "resembling functional
languages" assertion.  Initially, this will not be very true, since
C programmers will continue to program in the data-modifying style
that they know and love.  However, use of a garbage collector allows
much more complicated sharing patterns, and pretty soon side-effects
to data will be regarded as a risky programming style because you
don't know what other parts of the program are sharing the data, or not.

Extensive use of threads tends to contribute to this as well.

I first had this experience working on a Modula-3 backend written in
C; the guys working on the front-end requested that I quit changing
(or else undo all my changes) the AST during code generation, because
they had plans to reuse it in a "compiler server".  The hack solution
was to remember all changes, and back them out at the end of code
generation.  Not reentrant, but good enough at the time.

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: WAS Re: Final kick at the "Merced Guessing Game"
  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-18  4:00                 ` WAS Re: Final kick at the "Merced Guessing Game" David Chase
  0 siblings, 2 replies; 15+ messages in thread
From: Nick Maclaren @ 1997-10-18  4:00 UTC (permalink / raw)



In article <3447D55B.1CDE@world.std.com>,
David Chase  <chase@world.std.com> wrote:
>William Clodius wrote:
>
>> A minor point, but one aspect in which conventional languages are
>> starting to resemble functional languages is in the presence of garbage
>> collectors. While I don't know of any C or C++ implementations that
>> provide it, the availabiltiy of the Boehm collector and the commercial
>> add ons is starting to impact the C/C++ community.  ...
>
>There's some problems here, at least with respect to C.  Fortran 90
>is somewhat saner with its pointers than is C, at least in its
>specification.  Working only within the C specification, it is
>possible for the programmer to create pointers anywhere within the
>interior of a structure or an array, or to the first address after
>such an object.  In practice, C programmers commit vastly more
>disgusting sins (my favorite -- out-of-bounds pointer arithmetic
>from a freed pointer.  ...

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.

I have a fair amount of experience in attempting to debug problems in
large programs (not mine) with unchecked pointers AND garbage collection,
and it has almost always been a complete disaster.  The effect of an error
is that it is rarely detected near where it occurs, and the garbage
collector has destroyed all the evidence by the time the program falls
over.  I have several times had to resolve this problem in cases where the
authors of the code admitted defeat, and it took AGES.

Hence my position.  If don't really WANT garbage collection, but I will
put up with it (for most programs) ONLY if all pointer operations are
checked.  If that is not so, I don't want to know.


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: WAS Re: Final kick at the "Merced Guessing Game"
  1997-10-18  4:00               ` Nick Maclaren
  1997-10-18  4:00                 ` [Reposted due to Enlow UCE cancel]: " David Chase
@ 1997-10-18  4:00                 ` David Chase
  1 sibling, 0 replies; 15+ messages in thread
From: David Chase @ 1997-10-18  4:00 UTC (permalink / raw)



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



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Reposted due to Enlow UCE cancel]: Re: WAS Re: Final kick at the "Merced Guessing Game"
  1997-10-18  4:00               ` Nick Maclaren
@ 1997-10-18  4:00                 ` David Chase
  1997-10-19  4:00                   ` Nick Maclaren
  1997-10-18  4:00                 ` WAS Re: Final kick at the "Merced Guessing Game" David Chase
  1 sibling, 1 reply; 15+ messages in thread
From: David Chase @ 1997-10-18  4:00 UTC (permalink / raw)



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
========= WAS CANCELLED BY =======:

Rogue cancel from Michael Enlow, X-Cancelled-by etc. are forged.

Control: cancel <3448BA41.7603@world.std.com>
Newsgroups: comp.arch
Path: ...!news.hn.netlink.co.nz!canterbury.ac.nz!southpower.co.nz!nobody
From: rra@eyrie.org,sw@eyrie.org,rgm@eyrie.org
Subject: cmsg cancel <3448BA41.7603@world.std.com>
Approved: rra@eyrie.org,sw@eyrie.org,rgm@eyrie.org
Message-ID: <cancel.3448BA41.7603@world.std.com>
X-No-Archive: Yes
Sender: news@world.std.com (Mr Usenet Himself)
X-Cancelled-By: rra@eyrie.org,sw@eyrie.org,rgm@eyrie.org
Organization: Southpower Ltd
Date: Sun, 19 Oct 1997 05:27:12 GMT
Lines: 2


The article was canceled on 10/19/97 at 1:17:23 AM with the Usenet Cancel Engine (UCE).



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Reposted due to Enlow UCE cancel]: Re: WAS Re: Final kick at the "Merced Guessing Game"
  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
  0 siblings, 1 reply; 15+ messages in thread
From: Nick Maclaren @ 1997-10-19  4:00 UTC (permalink / raw)



In article <REPOST-4156.8731384277344.3448BA41.7603@world.std.com>,
David Chase  <chase@world.std.com> wrote:
>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.  ...

Um.  That isn't entirely true.  There are two major points:

    1) Yes, doing what I propose in most existing languages is a pretty
fair disaster.  But it IS possible to do the checking efficiently, using
use counts or otherwise, IF you design the language with that in mind,
and keep it in mind.

    2) One of the reasons that garbage collection is faster than what I
want is it does so much less checking!  In particular, a great many user
errors will lead to indefinite storage leaks, which are the utterly foul
failures that I was ranting against.

I hope that we are agreed that garbage collection WITHOUT pointer checking
is a recipe for chaos, sooner or later :-)


Nick Maclaren,
University of Cambridge Computer Laboratory,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679



^ permalink raw reply	[flat|nested] 15+ messages in thread

* pointer checking (WAS Re: Final kick at the "Merced Guessing Game")
  1997-10-19  4:00                   ` Nick Maclaren
@ 1997-10-22  4:00                     ` Hans-Juergen Boehm
  0 siblings, 0 replies; 15+ messages in thread
From: Hans-Juergen Boehm @ 1997-10-22  4:00 UTC (permalink / raw)



Nick Maclaren wrote:
> 
> I hope that we are agreed that garbage collection WITHOUT pointer checking
> is a recipe for chaos, sooner or later :-)
> 
Agreed.  But so is explicit deallocation without pointer checking.  In
my experience, more so.  Not only can I introduce memory addressing
errors that don't show up until much later, but I can also introduce
deallocation errors with the same symptoms.  And I often have a harder
time using higher level linked data structures that might get me away
from the dangerous low-level pointer manipulations.

Perhaps a more interesting question is whether test-time pointer
checking techniques that are run only during testing (e.g. Purify, or C
pointer-arithmetic-checking as described for example in my 1996 PLDI
paper) are good enough, or whether you need the expense of full-time
pointer checking.  It probably depends on the circumstances. 

-- 
Hans-Juergen Boehm
boehm@mti.sgi.com



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~1997-10-22  4:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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                 ` WAS Re: Final kick at the "Merced Guessing Game" David Chase
1997-10-07  4:00 ` Nick Maclaren

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