Nothing Special   »   [go: up one dir, main page]

skip to main content
article

A demand-driven adaptive type analysis

Published: 17 September 2002 Publication History

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.

References

[1]
G. Agrawal. Simultaneous demand-driven data-flow and call graph analysis. In Proceedings of International Conference on Software Maintenance, pages 453--462, sep 1999.
[2]
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.
[3]
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.
[4]
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.
[5]
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.
[6]
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.
[7]
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.
[8]
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.
[9]
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.

Index Terms

  1. A demand-driven adaptive type analysis

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 37, Issue 9
    September 2002
    283 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/583852
    Issue’s Table of Contents
    • cover image ACM Conferences
      ICFP '02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programming
      October 2002
      294 pages
      ISBN:1581134878
      DOI:10.1145/581478
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 17 September 2002
    Published in SIGPLAN Volume 37, Issue 9

    Check for updates

    Author Tags

    1. demand-driven analysis
    2. static analysis
    3. type analysis

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 10 Nov 2024

    Other Metrics

    Citations

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media