home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / compiler / 1893 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  3.1 KB

  1. Path: sparky!uunet!ogicse!das-news.harvard.edu!spdcc!iecc!compilers-sender
  2. From: sasdrf@unx.sas.com (Dave Frederick)
  3. Newsgroups: comp.compilers
  4. Subject: Re: And speaking of fast compilers...
  5. Keywords: performance, Ada, design, comment
  6. Message-ID: <92-11-084@comp.compilers>
  7. Date: 16 Nov 92 16:03:07 GMT
  8. Article-I.D.: comp.92-11-084
  9. References: <92-11-057@comp.compilers>
  10. Sender: compilers-sender@iecc.cambridge.ma.us
  11. Reply-To: sasdrf@unx.sas.com (Dave Frederick)
  12. Organization: SAS Institute Inc.
  13. Lines: 46
  14. Approved: compilers@iecc.cambridge.ma.us
  15.  
  16. pardo@cs.washington.edu (David Keppel) writes:
  17. |[comparing Ada compilers, compiler X was faster than compilers Y and Z
  18. |even though X used C as an intermediate language.]
  19.  
  20. Not knowing any details of the compilers being used, but knowing a bit
  21. about Ada from my previous job working on the global optimizer for an Ada
  22. compiler (now there's an oxymoron :-), let me pose the following:
  23.  
  24. You say Compiler X is an Ada preprocessor for a C compiler. Has it passed
  25. an Ada validation suite? Certainly, C does not perform the rigorous type
  26. checking that Ada requires. Declaring i as a range (1..10) could make i
  27. incompatible with an integer type. If the preprocessor simply checks
  28. syntax, and then declares i as an integer in the C program, one loses
  29. whatever power the Ada language offers. If C implements i as an integer,
  30. but inserts code to test i at every assignment to determine if it is
  31. within range, then the compile may be fast, but the runtime of the program
  32. would be unendureable. 
  33.  
  34. Most of the optimizations an Ada compiler performs are compile-time range
  35. and bounds checking. If it can be determined during the compile that i
  36. will always be in range, all assertion tests can safely be removed. If no
  37. range errors are possible within the scope of an exception handler, this
  38. code is dead and can be removed, as well.  Similarly, if the compiler can
  39. determine that a particular assignment will cause an exception, the
  40. compiler can replace the assignment with a jump directly to the exception
  41. handler. When performing such tests for all ranges, subranges, and array
  42. indices, one can see how an explosion in compile time can occur.
  43.  
  44. One of the hot topics when I last worked on an Ada compiler was doing the
  45. above range and bounds checking optimization across procedures in a
  46. package. Interprocedural analysis is quite helpful for determining the
  47. possibility of these errors on var parameters. Of course, with a 7000-line
  48. package of page-sized procedures, we could be talking about 200-300
  49. procedures on which to perform inter-procedural analysis. This could be a
  50. week's worth of work.
  51.  
  52. Then again, perhaps the Brand X compiler was written in C, and Brand Y in
  53. Ada. This could explain the difference, as well :-)
  54.  
  55. Dave Frederick                              sasdrf@unx.sas.com
  56. [Compiling into C isn't any worse than compiling into assembler -- the Ada
  57. compiler can do the same compile-time checking and emit run-time checking
  58. either way. -John]
  59. -- 
  60. Send compilers articles to compilers@iecc.cambridge.ma.us or
  61. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  62.