Resumen
A useless variable is one whose value contributes nothing to the final outcome of a computation. Such variables are unlikely to occur in human-produced code, but may be introduced by various program transformations. We would like to eliminate useless parameters from procedures and eliminate the corresponding actual parameters from their call sites. This transformation is the extension to higher-order programming of a variety of dead-code elimination optimizations that are important in compilers for first-order imperative languages. Shivers has presented such a transformation. We reformulate the transformation and prove its correctness. We believe that this correctness proof can be a model for proofs of other analysis-based transformations. We proceed as follows: We reformulate Shivers' analysis as a set of constraints; since the constraints are conditional inclusions, they can be solved using standard algorithms. We prove that any solution to the constraints is sound: that two computations that differ only on variables marked as useless give the same answer up to useless variables, and hence the same answer when the answer is a constant. We observe that this notion of soundness is too weak to support the transformation of the analyzed program. We add additional closure conditions to the analysis and show that any solution to the new set of constraints justifies the transformation. The proof is by tree surgery: we show that from any computation of the original program, we can construct a computation of the transformed program that yields an answer related to the original, and the same answer when the original answer is a constant.
Idioma original | Inglés |
---|---|
Páginas (desde-hasta) | 291-302 |
Número de páginas | 12 |
Publicación | Conference Record of the Annual ACM Symposium on Principles of Programming Languages |
Estado | Publicada - 1999 |
Publicado de forma externa | Sí |
Evento | Proceedings of the 1999 26th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Language, POPL'99 - San Antonio, TX, USA Duración: 20 ene. 1999 → 22 ene. 1999 |