skip to main content
article
Free Access

Optimizing array bound checks using flow analysis

Published:01 March 1993Publication History
Skip Abstract Section

Abstract

Bound checks are introduced in programs for the run-time detection of array bound violations. Compile-time optimizations are employed to reduce the execution-time overhead due to bound checks. The optimizations reduce the program execution time through elimination of checks and propagation of checks out of loops. An execution of the optimized program terminates with an array bound violation if and only if the same outcome would have resulted during the execution of the program containing all array bound checks. However, the point at which the array bound violation occurs may not be the same. Experimental results indicate that the number of bound checks performed during the execution of a program is greatly reduced using these techniques.

References

  1. Ago, A. V., SETHI, R., AND ULLMAN, J.D. 1986. Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading, Mass. Google ScholarGoogle Scholar
  2. BANERJEE, U. 1988. Dependence Analysis for Supercomputing. Kluwer Academic Publishers, Boston, Mass. Google ScholarGoogle Scholar
  3. CALLAHAN, D., COOPER, K. D., KENNEDY, K., AND TORCZON, L. 1986. Interprocedural constant propagation. In Proceedings 14th ACM Symposium on Principles of Programming Languages. (St. Petersburg Beach, Fla., Jan. 13-15). ACM, New York, 152-161. Google ScholarGoogle Scholar
  4. CHOW, F. 1983. A portable machine-independent global optimizer--Design and measurements. Tech. Rep. 83-254, Ph.D. thesis, Computer Systems Lab, Stanford Univ., Calif. Google ScholarGoogle Scholar
  5. GUPTA, R. 1990. A fresh look at optimizing array bound checking. In Procee&ngs ACM SIGPLAN 90 Conference on Programming Language Design and Implementation (White Plains, N.Y., June 20-22). ACM, New York, 272-282. Google ScholarGoogle Scholar
  6. GUPTA, R., A~D SPEZIALETTI, M. 1991. Loop monotonic computations: An approach for the efficient run-time detection of races. In Proceedings of the SIGSOFT Symposium on Testing, Analysis, and Verification. (Victoria, B.C., Oct. 8-10). ACM, New York, 98-111. Google ScholarGoogle Scholar
  7. HARRISON, W. 1977. Compiler analysis of the value ranges for variables. IEEE Trans. Softw. Eng. 3, 3 (May), 243-250.Google ScholarGoogle Scholar
  8. MARKSTEIN, V., COCKE, J., AND MARKSTEIN, P. 1982. Optimization of range checking. In Proceedings of SIGPLAN 82 Symposium on Compiler Construction. (Boston, Mass., June 23-25). ACM, New York, 114-119. Google ScholarGoogle Scholar
  9. SUZUKI, N., AND ISHIHATA, K. 1977. Implementation of array bound checker. In Proceedings 4th ACM Symposium on Principles of Programming Languages. ACM, New York, 132-143. Google ScholarGoogle Scholar
  10. WEGMAN, M. N., AND ZADECK, F.K. 1984. Constant propagation with conditional branches. In Proceedings 12th ACM Symposium on Princtples of Programming Languages. (Salt Lake City, Ut., Jan. 15-18). ACM, New York, 152-161. Google ScholarGoogle Scholar

Index Terms

  1. Optimizing array bound checks using flow analysis

      Recommendations

      Reviews

      Kathleen H. V. Booth

      One of the most frequent sources of run-time errors in such languages as C and C++ arises from over running array bounds, particularly when pointers are used. The author points out that most compilers do nothing to insure that adequate checks are provided and that the inclusion of such checks, without adequate optimization, can slow the operation of a program by factors of two or more. The paper discusses methods by which optimization can be achieved and shows, by actual examples, the sort of savings which can be achieved. The results are impressive although there is an error in the last line of Table 1.

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!