skip to main content
10.1145/581478.581487acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

A demand-driven adaptive type analysis

Published:17 September 2002Publication 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A demand-driven adaptive type analysis

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      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
      • 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

      Copyright © 2002 ACM

      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

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      ICFP '02 Paper Acceptance Rate24of76submissions,32%Overall Acceptance Rate333of1,064submissions,31%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader