Static Analysis of Aliases and Side Effects in Higher-Order Languages
In recent years, there has been substantial interest in the development of programming languages for new parallel architectures. A basic design conflict arises because languages with simple semantics tend to use storage inefficiently, whereas languages allowing the programmer to access storage explicitly are difficult to analyze. We present a compile-time estimation scheme for determining whether an expression in an imperative language either uses or updates the store. We also determine the aliasing behavior of expressions and in general, we can tell whether the evaluation of two expressions interfere. Current interprocedural dataflow techniques for aliasing and side effect inference are valid for first-order languages. Our inference schemes provide information about aliasing and side effects in a higher-order expression language with call-by-value semantics. The higher order character of the language represents only a partial obstacle. On the other hand, the presence of l-valued expressions has the consequence that aliasing information must be computed for all expressions, and cannot be represented as a relation among identifiers. Furthermore, the introduction of pointers make aliasing and side effects flow-dependent properties. Abstract interpretation techniques allow us to define compositional static inference schemes for aliasing and side effects, which can be proved sound with respect to the standard semantics by structural induction. The abstract interpretation functions are easy to modify, in case a different type of information is requested. We also discuss how different language features may affect the static analyses, simplifying them or making them untractable. The abstract interpretation functions implicitly define static inference algorithms, which can easily be implemented by an attribute grammar, or any other tool capable of performing computations on the abstract syntax tree. The accuracy of these algorithms is better than for the dataflow ones, because we make use of control flow information. Our algorithms also compare favorably in complexity, but the dataflow approach is probably cheaper in most practical settings. In addition, our schemes can give information even in the presence of dynamically allocated data structures.
computer science; technical report
Previously Published As