skip to main content
article
Free Access

Unrolling lists

Authors Info & Claims
Published:01 July 1994Publication History
Skip Abstract Section

Abstract

Lists are ubiquitous in functional programs, thus supporting lists efficiently is a major concern to compiler writers for functional languages. Lists are normally represented as linked cons cells, with each cons cell containing a car (the data) and a cdr (the link); this is inefficient in the use of space, because 50% of the storage is used for links. Loops and recursions on lists are slow on modern machines because of the long chains of control dependencies (in checking for nil) and data dependencies (in fetching cdr fields).

We present a data structure for “unrolled lists”, where each cell has several data items (car fields) and one link (cdr). This reduces the memory used for links, and it significantly shortens the length of control-dependence and data-dependence chains in operations on lists.

We further present an efficient compile-time analysis that transforms programs written for “ordinary” lists into programs on unrolled lists. The use of our new representation requires no change to existing programs.

We sketch the proof of soundness of our analysis—which is based on refinement types—and present some preliminary measurements of our technique.

References

  1. 1 William E. Aitken and John H. Reppy. Abstract value constructors. In A CM SIGPLAN Workshop on ML and its Applications, June 1992.Google ScholarGoogle Scholar
  2. 2 Andrew W. Appel. Compiling with Continuations. Cambridge University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 Andrew W. Appel and David B. MacQueen. Standard ML of New Jersey. In Martin Wirsing, editor, Third Int'l Syrup. on Prog. Lang. Implementation and Logic Programming, pages 1-13, New York, August 1991. Springer-Ver}ag.Google ScholarGoogle Scholar
  4. 4 Henry G. Baker. List processing in real time on a serial computer. Communications of the A CM, 21(4):280-294, April 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 Daniel G. Bobrow. A note on hash linking. Communications of the A CM, 18(7):413-415, July 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 Daniel G. Bobrow and Douglas W. Clark. Compact encodings of list structure. A CM Transactions on Programming Languages and Systems, 1(2):267-286, October 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7 Luca CardeUi. Compiling a functional language. In Proc. of the 198~i A CM Conference on Lisp and Functional Programming, pages 208-217, August 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 Douglas W. Clark. List structure: measurements, algorithms, and encodings. PhD thesis, Carnegie Mellon Univ., Pittsburgh, PA, August 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9 Douglas W. Clark and C. Cordell Green. An empirical study of list structure in llsp. Communications of the ACM, 20(2):78-87, February 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 L. P. Deutsch. A lisp machine with very compact programs. In Proc. 3rd IJA CI, pages 697-703, 1973.Google ScholarGoogle Scholar
  11. 11 Tim Freeman. Carnegie Mellon University, personal communication, 1992.Google ScholarGoogle Scholar
  12. 12 Tim Freeman and Frank Pfenning. Refinement types for ML. In Proc. A CM SIGPLAN '91 Conf. on Prog. Lang. Design and Implementation, pages 268-277, New York, July 1991. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 R. Greenblatt. Lisp machine progress report memo 444. TechnicMreport, A.i. Lab., M.I.T., Cambridge, MA, August 1977.Google ScholarGoogle Scholar
  14. 14 Cordelia V. Hail. Using hindley-milner type inference to optimize list representation. In 199~ A CM Conference on Lisp and Fucntional Programming, page (to appear), New York, June 1994. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 15 Wilfred J. Hansen. Compact list representation: Definition, garbage collection, and system implementation. Communications of the A CM, 12(9):499-507, Sep 1969. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16 Paul Hudak, Simon L. Peyton Jones, and Philip Wadler et aI. Report on the programming language Haskell a non-strict, purely functional language version 1.2. SIGPLAN Notices, 21(5), May 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 17 Xavier Leroy. Unboxed objects and polymorphic typing. In Nineteenth Annual A CM Syrup. on Principles of Prog. Languages, New York, Jan 1992. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 18 Kai Li and Paul Hudak. A new list compaction method. Software - Practice and Experience, 16(2):145-163, February 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 19 Robin Milner, Mads Torte, and Robert Harper. The Definition of Standard NIL. MIT Press, Cambridge, Massachusetts, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 20 Laurence C. Paulson. ML for the Working Programmer. Cambridge University Press, Cambridge, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 21 Simon L. Peyton Jones and John Launchbury. Unboxed values as first class citizens in a non-strict functional language. In The Fifth International Conference on Functional Programming Languages and Computer Architecture, pages 636-666, New York, August 1991. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22 Chris Reade. Elements of Functional Programming. Addison-Wesley, Reading, MA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23 Guy L. Steele. Rabbit: a compiler for Scheme. Technical Report AI-TR-474, MIT, Cambridge, MA, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 24 Philip Wadler. Views: A way for pattern matching to cohabit with data abstractirm. In Fourteenth Annual A CM Syrup. on Principles of Prog. Languages, pages 307-313, New York, Jan 1987. ACM Press. Google ScholarGoogle Scholar
  25. 25 D. Weinreb and D. Moon. Lisp machine manual. Technical report, Symolics Corp., Cambridge, Mass., 1981.Google ScholarGoogle Scholar

Index Terms

  1. Unrolling lists

          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

          Full Access

          • Published in

            cover image ACM SIGPLAN Lisp Pointers
            ACM SIGPLAN Lisp Pointers  Volume VII, Issue 3
            July-Sept. 1994
            327 pages
            ISSN:1045-3563
            DOI:10.1145/182590
            Issue’s Table of Contents
            • cover image ACM Conferences
              LFP '94: Proceedings of the 1994 ACM conference on LISP and functional programming
              July 1994
              327 pages
              ISBN:0897916433
              DOI:10.1145/182409

            Copyright © 1994 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: 1 July 1994

            Check for updates

            Qualifiers

            • article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader