Abstract
We present a high-level approach to array bound check optimization that is neither hampered by recursive functions, nor disabled by the presence of partially redundant checks. Our approach combines a forward analysis to infer precise contextual constraint at designated program points, and a backward method for deriving a safety pre-condition for each bound check. Both analyses are formulated with the help of a practical constraint solver based on Presburger formulae; resulting in an accurate and fully automatable optimization. The derived pre-conditions are also used to guide bound check specialization, for the purpose of eliminating partially redundant checks.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
A.V. Aho, R. Sethi, and J.D. Ullman. Compilers, Principles, Techniques, and Tools. Addison-Wesley, 1986.
F. Benoy and A. King. Inferring argument size relationships with CLP(R). In Logic Programming Synthesis and Transformation, Springer-Verlag, August 1997.
R. Bodik, R. Gupta, and V. Sarkar. ABCD: Eliminating array bounds checks on demand. In ACM SIGPLAN Conf. on Programming Language Design and Implementation, pages 321–333, 2000.
W.N. Chin and S.C. Khoo. Calculating sized types. In 2000 ACM Workshop on Partial Evaluation and Semantics-Based Program Manipulation, pages 62–72, Boston, Massachusetts, United States, January 2000.
P. Cousot and N. Halbwachs. Automatic discovery of linear restraints among variables of a program. In Symposium on Principles of Programming Languages, pages 84–96. ACM Press, 1978.
F. Fioravanti, A. Pettorossi, and M. Proietti. Rules and stratigies for contextual specialization of constraint logic programs. Electronic Notes in Theoretical Computer Science, 30(2), 1990.
R. Gupta. A fresh look at optimizing array bound checking. In ACM SIGPLAN Conf. on Program Lang. Design and Impl., pages 272–282, New York, June 1990.
R. Gupta. Optimizing array bound checks using flow analysis. ACM Letters Program Lang. Syst., 2(1-4):135–150, Mar-Dec 1994.
N. Halbwachs. Synchronous Programming of Reactive Systems. Kluwer Academic Pub., 1993.
N. Halbwachs. About synchronous programming and abstract interpretation. Science of Computer Programming, Special Issue on SAS’94, 31(1), May 1998.
N. Halbwachs, Y.E. Proy, and P. Roumanoff. Verification of real-time systems using linear relation analysis. Formal Methods in System Design, 11(2):157–185, 1997.
W. H. Harrison. Compiler analysis for the value ranges for variables. IEEE TOSE, SE-3(3):243–250, May 1977.
P. Kelly, V. Maslov, W. Pugh, E. Rosser, T. Shpeisman, and D. Wonnacott. The Omega Library Version 1.1.0 Interface Guide. Technical report, University of Maryland, College Park, November 1996. http://www.cs.umd.edu/projects/omega.
A. King, K. Shen, and F. Benoy. Lower-bound time-complexity analysis of logic programs. In Jan Maluszynski, editor, International Symposium on Logic Programming, pages 261–276. MIT Press, November 1997.
P Kolte and M Wolfe. Elimination of redundant array subscript range checks. In ACM Conference on Programming Language Design and Implementation, pages 270–278. ACM Press, June 1995.
L. Lafave and J. Gallagher. Constraint-based partial evaluation of rewritingbased functional logic programs. In Program Synthesis and Transformation, LOPSTR’ 97, pages 70–82, LNCS 1463, 1997.
V. Markstein, J. Cooke, and P. Markstein. Optimization of range checking. In ACM SIGPLAN Symp. on Compiler Construction, pages 114–119, June 1982.
S.P. Midkiff, J.E. Moreira, and M. Snir. Optimizing bounds checking in Java programs. IBM Systems Journal, 37(3):409–453, 1998.
G. Necula. Proof-carrying code. In ACM Principles of Programming Languages, pages 106–119, 1997.
G Necula and P. Lee. The design and implementation of a certifying compiler. In ACM SIGPLAN Conf. on Programming Language Design and Implementation, pages 333–344, 1998.
L. Plumer. Termination proofs for logic programs. In Lecture Notes in Artificial Intelligence, volume 446. Springer Verlag, 1990.
W. Pugh. The Omega Test: A fast practical integer programming algorithm for dependence analysis. Communications of ACM, 8:102–114, 1992.
R. Rugina and M. Rinard. Symbolic bounds analysis of pointers, array indices, and accessed memory regions. In ACM SIGPLAN Conf. on Programming Language Design and Implementation, pages 182–195. ACM Press, June 2000.
N. Suzuki and K. Ishihata. Implementation of array bound checker. In ACM Principles of Programming Languages, pages 132–143, 1977.
J.D. Ullman and A. Van Gelder. Efficient tests for top-down termination of logical rules. Journal of ACM, 35(2):345–373, 1988.
H. Xi and F. Pfenning. Eliminating array bound checking through dependent types. In ACM Conference on Programming Language Design and Implementation, pages 249–257. ACM Press, June 1998.
Z. Xu, B.P. Miller, and T. Reps. Safety checking of machine code. In ACM SIGPLAN Conf. on Programming Language Design and Implementation, pages 70–82. ACM Press, June 2000.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Chin, WN., Khoo, SC., Xu, D.N. (2001). Deriving Pre-conditions for Array Bound Check Elimination. In: Danvy, O., Filinski, A. (eds) Programs as Data Objects. PADO 2001. Lecture Notes in Computer Science, vol 2053. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44978-7_2
Download citation
DOI: https://doi.org/10.1007/3-540-44978-7_2
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-42068-2
Online ISBN: 978-3-540-44978-2
eBook Packages: Springer Book Archive