ABSTRACT
Compilers for dynamically and statically typed languages ensure safe execution by verifying that all operations are performed on appropriate values. An operation as simple as car in Scheme and hd in SML will include a run time check unless the compiler can prove that the argument is always a non-empty list using some type analysis. We present a demand-driven type analysis that can adapt the precision of the analysis to various parts of the program being compiled. This approach has the advantage that the analysis effort can be spent where it is justified by the possibility of removing a run time check, and where added precision is needed to accurately analyze complex parts of the program. Like the k-cfa our approach is based on abstract interpretation but it can analyze some important programs more accurately than the k-cfa for any value of k. We have built a prototype of our type analysis and tested it on various programs with higher order functions. It can remove all run time type checks in some nontrivial programs which use map and the Y combinator.
- G. Agrawal. Simultaneous demand-driven data-flow and call graph analysis. In Proceedings of International Conference on Software Maintenance, pages 453--462, sep 1999. Google ScholarDigital Library
- J. M. Ashley and R. K. Dybvig. A practical and flexible flow analysis for higher-order languages. ACM Transactions on Programming Languages and Systems, 20(4):845--868, jul 1998. Google ScholarDigital Library
- D. Dubé. Demand-Driven Type Analysis for Dynamically-Typed Functional Languages. PhD thesis, Université de Montréal, 2002. Available at: http://www.iro.umontreal.ca/~dube.Google Scholar
- D. Dubé and M. Feeley. Demand-driven type analysis: an introduction. In Proceedings of the Workshop on Scheme and Functional Programming 2001, pages 21--32, sep 2001.Google Scholar
- E. Duesterwald, R. Gupta, and M. L. Soffa. Demand-driven computation of interprocedural data flow. In Symposium of Principles of Programming Languages, pages 37--48, jan 1995. Google ScholarDigital Library
- N. Heintze and O. Tardieu. Demand-driven pointer analysis. In Proceedings of SIGPLAN 2001 Conference on Programming Languages Design and Implementation, ACM SIGPLAN Notices. ACM Press, jun 2001. Google ScholarDigital Library
- S. Jagannathan and S. Weeks. A unified treatment of flow analysis in higher-order languages. In 22nd ACM Symposium on Principles of Programming Languages, pages 392--401, jan 1995. Google ScholarDigital Library
- O. Shivers. Control flow analysis in Scheme. In Proceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation, pages 164--174, jun 1988. Google ScholarDigital Library
- O. Shivers. The semantics of Scheme control-flow analysis. In Proceedings of the Symposium on Partial Evaluation and Semantics-based Program Manipulation, pages 190--198, jun 1991. Google ScholarDigital Library
Index Terms
- A demand-driven adaptive type analysis
Recommendations
A demand-driven adaptive type analysis
Compilers for dynamically and statically typed languages ensure safe execution by verifying that all operations are performed on appropriate values. An operation as simple as car in Scheme and hd in SML will include a run time check unless the compiler ...
Demand-driven alias analysis for C
POPL '08This paper presents a demand-driven, flow-insensitive analysisalgorithm for answering may-alias queries. We formulate thecomputation of alias queries as a CFL-reachability problem, and use this formulation to derive a demand-driven analysis algorithm. ...
Demand-driven alias analysis for C
POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThis paper presents a demand-driven, flow-insensitive analysisalgorithm for answering may-alias queries. We formulate thecomputation of alias queries as a CFL-reachability problem, and use this formulation to derive a demand-driven analysis algorithm. ...
Comments