Skip to main content

Unboxed values as first class citizens in a non-strict functional language

  • Conference paper
  • First Online:
Functional Programming Languages and Computer Architecture (FPCA 1991)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 523))

Abstract

The code compiled from a non-strict functional program usually manipulates heap-allocated boxed numbers. Compilers for such languages often go to considerable trouble to optimise operations on boxed numbers into simpler operations on their unboxed forms. These optimisations are usually handled in an ad hoc manner in the code generator, because earlier phases of the compiler have no way to talk about unboxed values.

We present a new approach, which makes unboxed values into (nearly) first-class citizens. The language, including its type system, is extended to handle unboxed values. The optimisation of boxing and unboxing operations can now be reinterpreted as a set of correctness-preserving program transformations. Indeed the particular transformations required are ones which a compiler would want to implement anyway. The compiler becomes both simpler and more modular.

Two other benefits accrue. Firstly, the results of strictness analysis can be exploited within the same uniform transformational framework. Secondly, new algebraic data types with unboxed components can be declared. Values of these types can be manipulated much more efficiently than the corresponding boxed versions.

Both a static and a dynamic semantics are given for the augmented language. The denotational dynamic semantics is notable for its use of unpointed domains.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Bibliography

  • AW Appel [1988], “Runtime tags aren't necessary,” CS-TR-142-88, Department of Computer Science, Princeton University.

    Google Scholar 

  • AW Appel & T Jim [Jan 1989], “Continuation-passing, closure-passing, style,” in Proc ACM Conference on Principles of Programming Languages, ACM, 293–302.

    Google Scholar 

  • TH Brus, MCJD van Eckelen, MO van Leer & MJ Plasmeijer [Sept 1987], “Clean — a language for functional graph rewriting,” in Functional programming languages and computer architecture, Portland, G Kahn, ed., LNCS 274, Springer Verlag, 364–384.

    Google Scholar 

  • LMM Damas & R Milner [1982], “Principal type schemes for functional programs,” in POPL, 207–212.

    Google Scholar 

  • P Fradet & D Le Metayer [1990], “Compilation of functional languages by program transformation,” IRISA, Campus de Beaulieu, Rennes.

    Google Scholar 

  • P Fradet & D Le Metayer [June 1988], “Compilation of lambda-calculus into functional machine code,” INRIA.

    Google Scholar 

  • [1986], in Abstract Interpretation of Declarative Languages, C Hankin & S Abramsky, eds., Ellis Horwood, Chichester, 246–265.

    Google Scholar 

  • P Hudak, PL Wadler, Arvind, B Boutel, J Fairbairn, J Fasel, K Hammond, J Hughes, T Johnsson, R Kieburtz, RS Nikhil, SL Peyton Jones, M Reeve, D Wise & J Young [April 1990], “Report on the functional programming language Haskell,” Department of Computing Science, Glasgow University.

    Google Scholar 

  • R Kelsey [May 1989], “Compilation by program transformation,” YALEU/DCS/RR-702, PhD thesis, Department of Computer Science, Yale University.

    Google Scholar 

  • DA Kranz [May 1988], “ORBIT — an optimising compiler for Scheme,” PhD thesis, Department of Computer Science, Yale University.

    Google Scholar 

  • X Leroy [April 1991], “Efficient data representations in polymorphic languages,” INRIA Research Report 1264, Rocquencourt.

    Google Scholar 

  • E Moggi [June 1989], “Computational lambda calculus and monads,” in Logic in Computer Science, California, IEEE.

    Google Scholar 

  • J Peterson [Sept 1989], “Untagged data in tagged environments: choosing optimal representations at compile time,” in Functional Programming Languages and Computer Architecture, London, Addison Wesley, 89–99.

    Google Scholar 

  • SL Peyton Jones [1987], The implementation of functional programming languages, Prentice Hall.

    Google Scholar 

  • SL Peyton Jones [Feb 1991], “The Spineless Tagless G-machine: a second attempt,” Department of Computing Science, University of Glasgow.

    Google Scholar 

  • SL Peyton Jones & Jon Salkild [Sept 1989], “The Spineless Tagless G-machine,” in Functional Programming Languages and Computer Architecture, D Mac-Queen, ed., Addison Wesley.

    Google Scholar 

  • DA Schmidt [1986], Denotational semantics: a methodology for language development, Allyn and Bacon.

    Google Scholar 

  • MB Smyth & GD Plotkin [Nov 1982], “The category-theoretic solution of recursive domain equations,” SIAM Journal of Computing 11, 761–783.

    Google Scholar 

  • GL Steele [1978], “Rabbit: a compiler for Scheme,” AI-TR-474, MIT Lab for Computer Science.

    Google Scholar 

  • SR Thatte [1990], “Coercive type equivalence,” Department of Maths and Computer Science, Clarkson University NY.

    Google Scholar 

  • P Wadler [1990], “Deforestation: transforming programs to eliminate trees,” Theoretical Computer Science 73, 231–248.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

John Hughes

Rights and permissions

Reprints and permissions

Copyright information

© 1991 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Jones, S.L.P., Launchbury, J. (1991). Unboxed values as first class citizens in a non-strict functional language. In: Hughes, J. (eds) Functional Programming Languages and Computer Architecture. FPCA 1991. Lecture Notes in Computer Science, vol 523. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3540543961_30

Download citation

  • DOI: https://doi.org/10.1007/3540543961_30

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-54396-1

  • Online ISBN: 978-3-540-47599-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics