home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / arch / 8862 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  2.7 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!sun-barr!news2me.ebay.sun.com!exodus.Eng.Sun.COM!rbbb.Eng.Sun.COM!chased
  2. From: chased@rbbb.Eng.Sun.COM (David Chase)
  3. Newsgroups: comp.arch
  4. Subject: Re: 32 => 64 Transition
  5. Message-ID: <l8j0qkINNikb@exodus.Eng.Sun.COM>
  6. Date: 12 Aug 92 21:32:04 GMT
  7. References: <342@moene.indiv.nluug.nl> <1992Aug10.220711.38122@cs.cmu.edu> <l8gi9jINNaad@exodus.Eng.Sun.COM> <1992Aug12.155317.27437@bcars64a.bnr.ca>
  8. Organization: Sun Microsystems, Mt. View, Ca.
  9. Lines: 56
  10. NNTP-Posting-Host: rbbb
  11.  
  12. chased@rbbb.Eng.Sun.COM (David Chase) writes:
  13.  
  14. >>Howsabout the *debuggers* do it [map page zero not readable],
  15. >>not the OS?  (I don't see anyone clamoring to have the OS check
  16. >>all array indices for validity.  What's the difference?)
  17. >>There are some completely dandy optimizations that
  18. >>rely on being able to read zeros from page zero.  
  19.  
  20. schow@bqneh3.bnr.ca (Stanley T.H. Chow) writes:
  21.  
  22. >Is there a language standard that specifies this (zeros from page zero)?
  23. >Seems like a rather curious spec.
  24.  
  25. No, it's not a language spec, it's an implementation technique.  Sort
  26. of like have an "add" instruction on your machine -- helpful, but not
  27. required.  This lets you do a slightly better job of pipelining loops
  28. of the form
  29.  
  30.    while (p != 0 && p -> data != K) p = p -> next;
  31.  
  32. Again, see the paper by Hendren and Hummel in this year's PLDI.
  33.  
  34. >Even if you specify that only the compiler is allowed to make this
  35. >assumption, how do you prevent user code from doing this? 
  36.  
  37. You don't.  Compilers compile all manner of stupid buggy programs
  38. without complaint -- why should an exception be made for this bug?
  39.  
  40. >How about user code that inadverdently do this?
  41.  
  42. You don't.  See above.
  43.  
  44. >Don't you want the user code to trap?
  45.  
  46. No, not if it makes the code run significantly slower.  Again, compare
  47. this with array indexing tests (which, by-the-way, can often be nicely
  48. optimized in the compiler to reduce their cost).  If I want tests, I
  49. ask for them, and I expect them to be done.  If I want speed, I ask
  50. for it, and I expect to get it.  If I want both, I expect to get some
  51. compromise.  In practice, most of the programs that I run don't
  52. indirect through zero, so I'd rather that they ran faster.  Even when
  53. they do indirect through zero, my first reaction is not
  54.  
  55.       "Wow, I'm sure glad my window-system fell over."
  56.  
  57. (Yes, I'm aware of the dangers of continuing to run in a damaged
  58. state.  Which is, of course, why we all write programs in C, right?
  59. :-) Checking is important, but we have clearly chosen to compromise
  60. some amount of checking for speed and convenience.)
  61.  
  62. I'd much rather that the people writing the program use better tools
  63. and take more care; after that, I'm not really interested in
  64. discovering their bugs.
  65.  
  66. David Chase
  67. Sun
  68.