A method for determining the side effects of procedure calls
暂无分享,去创建一个
The presence of procedures and procedure calls in a programming language can give rise to various kinds of side effects. Calling a procedure can cause unexpected references and modifications to variables (variable side effects) and non-obvious transfers of control (exit side effects). In addition procedure calls and parameter passing mechanisms can cause several different variable names to refer to the same location thus making them aliases. This in turn causes all of these variables to be accessed whenever one of the variables is modified or referenced. Determining the aliases of variables and the exit and variable side effects of procedure calls is important for a number of purposes including the generation of optimized code for high level languages. This paper presents a method of determining exit and variable side effects and gives an algorithm for determining the aliases of variables. The principal advantage over previous methods is that only one pass over a program is used to gather the information needed to compute certain variable side effects precisely, even in the presence of recursion and reference parameters. In addition, these methods can be extended to cover programs with a number of features including procedure and label parameters. -ii An abstract model of block-structured programs is developed and used to prove that the methods given yield approximations which are safe for use in program optimization and, for certain side effects, are at least as precise as those given by any previous method. The implementation of these methods is discussed in general and a particular implementation for the programming language PASCAL is described. Finally, the results of an _empirical study of side effects and aliases in a collection of PASCAL programs are presented.
[1] Mark N. Wegman,et al. A Fast and Usually Linear Algorithm for Global Flow Analysis , 1976, J. ACM.
[2] Thomas C. Spillman,et al. Exposing Side-Effects in a PL/I Optimizing Compiler , 1971, IFIP Congress.