Executable assertions and separate compilation
The use of executable assertions is widely recognised as a useful programming technique for complex systems. In many cases static analysis of programs allows such assertions to be removed at compile time, thus removing the overhead of the test. The use of interprocedural analysis would often allow a larger number of such tests to be statically removed; intermodular analysis could even improve overall safety of the system. In general, however, such analysis is antithetical to separate compilation and extensible systems.
In this paper we offer a partial solution to this dilemma: We propose that preconditions become part of the interface definition of an encapsulated object. The implementation consequences of this technique are explored.
KeywordsExecutable assertions separate compilation value propagation elimination of redundant checks
Unable to display preview. Download preview PDF.
- 1.Diane Corney and John Gough. Type test elimination using typeflow analysis. In Jürg Gutknecht, editor, Proceedings Int. Confr. Programming Languages and System Architectures, volume 782 of Lecture Notes in Computer Science, pages 137–150. Springer Verlag, 1994.Google Scholar
- 2.Régis Crelier. Separate Compilation and Module Extension. PhD thesis, Swiss Federal Institute of Technology, Zürich, Switzerland, 1994. Diss. ETH No. 10650.Google Scholar
- 3.K John Gough and Herbert Klaeren. Eliminating range checks using static single assignment form. In Proceedings ACSC19, Melbourne, Australia. Australian Computer Science Society, 1996.Google Scholar
- 4.Rajiv Gupta. A fresh look at optimizing array bound checking. In Proc. ACM SIGPLAN'90 Confr. Programming Language Design and Implementation, volume 25(6) of SIGPLAN Notices, pages 272–282, 1990.Google Scholar
- 5.Rajiv Gupta. Optimizing array bound checks using flow analysis. ACM Letters on Programming Languages and Systems, 2(1–4):135–150, 1993.Google Scholar
- 6.ISO. Information Technology — Programming Languages — Modula-2. IS 10154-1. International Standards Organisation, June 1996.Google Scholar
- 7.Victoria Markstein, John Cocke, and Peter Markstein. Optimization of range checking. In Proc. of ACM '82 Symposium on Compiler Construction, pages 114–119, 1982.Google Scholar
- 8.Bertrand Meyer. Eiffel: The Language. Englewood Cliffs, 1991.Google Scholar
- 9.Bertrand Meyer. Applying “Design by Contract”. IEEE Computer, 25(10):40–51, 1992.Google Scholar
- 10.QUT. Gardens Point Modula Home Page. http://www.fit.qut.edu.au/CompSci/PLAS/GPM. Information on gardens point compilers, their availability, and documentation.Google Scholar
- 11.Rob Strom. Do programmers need seat belts? SIGPLAN Notices, 31(3):6–7, 1996.Google Scholar
- 12.N. Wirth and C. A. R. Hoare. A contribution to the development of Algol. Communications of the ACM, 9:413–431, 1966.Google Scholar
- 13.Niklaus Wirth. Programming in Modula-2. Springer, 3rd edition, 1985.Google Scholar