Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Free access

Implementing typed intermediate languages

Published: 29 September 1998 Publication History

Abstract

Recent advances in compiler technology have demonstrated the benefits of using strongly typed intermediate languages to compile richly typed source languages (e.g., ML). A type-preserving compiler can use types to guide advanced optimizations and to help generate provably secure mobile code. Types, unfortunately, are very hard to represent and manipulate efficiently; a naive implementation can easily add exponential overhead to the compilation and execution of a program. This paper describes our experience with implementing the FLINT typed intermediate language in the SML/NJ production compiler. We observe that a type-preserving compiler will not scale to handle large types unless all of its type-preserving stages preserve the asymptotic time and space usage in representing and manipulating types. We present a series of novel techniques for achieving this property and give empirical evidence of their effectiveness.

References

[1]
M. Abadi, L. Cardeili, P. Curien, and J. Levy. Explicit substitutions. In Seventeenth Annual A GM Syrup. on Principles of Prog. Languages, pages 31-46, New York, Jan 1990. ACM Press.
[2]
A. W. Appel. Compiling with Continuations. Cambridge University Press, 1992.
[3]
A. W. Appel and D. B. MacQueen. Standard ML of New Jersey. In M. Wirsing, editor, Third lnt'l Syrup. on Prog. Lang. Implementation and Logic Programming, pages 1-13, New York, August 1991. Springer-Verlag.
[4]
M. Blume. A compilation manager for SML/NJ. as part of SML/NJ User's Guide, 1995.
[5]
L. Damas and R. Milner. Principal type-schemes for functional programs. In Ninth Annual A CM Sltrnp. on Principles of Prog. Languages, pages 207-212, New York, Jan 1982. ACM Press.
[6]
O. Danvy. Type-directed partial evaluation. In Proc. ~$rd Annual A CM SIGPLAN-SIGACT Syrup. on Principles of Programming Languages, pages 242-257. ACM Press, 1996.
[7]
N. de Bruijn. A survey of the project AUTOMATH. In To H. B. Curry: Essays on Combinator~l Logic, Larnbda Calculus and Formalism, pages 579-606. Edited by J. P. Seldin and J. R. Hindley, Academic Press, 1980.
[8]
A. Dimoek, R. Muller, F. TUrbak, and J. B. Wells. Strongly typed flow-directed representation transformations. In Proc. 1997 A CM SIGPLAN International Conference on P~nctional Programming (IGFP'97), pages 11-24. ACM Press, June 1997.
[9]
J. Field. On laziness and optimality in lambda interpreters: Tools for specification and analysis. In Seventeenth Annual A GM Syrup. on Principles of Prog. Languages, pages 1-15, New York, Jan 1990. ACM Press.
[10]
C. Flanagan, A. Sabry, B. F. Dubs, and M. Felleisen. The essence of compiling with continuations. In Proc. A CM SIC- PLAN '93 Conf. on Prog. Lang. Design and Implementslion, pages 237-247, New York, June 1993. ACM Press.
[11]
L. George, F. Guillaume, and J. Reppy. A portable and optimizing backend for the SML/NJ compiler. In Proceedings of the 1994 international Conference on Compiler Construction, pages 83-97. Springer-Verlag, April 1994.
[12]
J. Y. Girard. Interpretation Fonctionnelle et Elimination des Coupures dans l'Arithmetique d'Ordre Superieur. PhD thesis, University of Paris Vii, 1972.
[13]
J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Addison-Wesley, 1996.
[14]
R. Harper and G. Morrisett. Compiling polymorphism using intensional type arlalysis. In Twenty-second Annual A CM S~lmp. on Principles of Prog. Languages, pages 130-141, New York, Jan 1995. ACM Press.
[15]
G. Huet. Logical Foundations of Functional Programming. Addison-Wesley, 1990.
[16]
X. Leroy. Unboxed objects and polymorphic typing. In Nineteenth Annual A CM SZlmp. on Principles of Prog. Languages, pages 177-188, New York, Jan 1992. AGM Press. Longer version available as INRIA Tech Report.
[17]
X. Leroy and F. Roualx. Security properties of typed applets. In Twenty-fifth Annual A CM S~lmp. on Principles of Prog. Languages, page (to appear), New York, Jan 1998. ACM Press.
[18]
J.-J. Levy. Optimal reductions in the lambda calculus. In To H. B. Curtal: Essays on Uornbinator~t Logic, Lambda Calculus and Formalism. Edited by J. P. Seldin and J. R. Hindley, Academic Press, 1980.
[19]
T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley, 1997.
[20]
H. G. Mairson. Deciding ML typability is complete for determinsitic exponential time. In Proc. i7th Annual A CM SIGPLAN-SIGACT Sltmp. on Principles of Programming Languages, pages 382-401. ACM Press, 1990.
[21]
R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). MIT Press, Cambridge, Massachusetts, 1997.
[22]
G. Morrisett. Compiling with Types. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, December 1995. Tech Report CMU-CS-95-226.
[23]
G. Morrisett, D. Walker, K. Crary, and N. Glew. From system F to typed assembly language. In Proc. ~5rd Annual A CM SIGPLAN-SIGA CT Syrup. on Principles of Programming Languages, page (to appear). ACM Press, 1998.
[24]
G. Nadathur. A notation for lambda terms II: Refinements and applications. Technical Report CS-1994-01, Duke University, Durham, NC, January 1994.
[25]
G. Nadathur and D. S. Wilson. A representation of lambda terms suitable for operations on their intensions. In 1990 A CM Conference on Lisp and Functional Programming, pages 341-348, New York, June 1990. ACM Press.
[26]
G. Necula. Proof-carrying code. In Twenty-Fourth Annual A CM Syrup. on Principles of Prog. Languages, New York, Jan 1997. ACM Press.
[27]
S. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Journal of Functional Programming, 2(2):127-202, April 1992.
[28]
S. Peyton Jones and J. 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.
[29]
S. Peyton Jones, J. Launchbury, M. Shields, and A. Tolmach. Bridging the gulf: a common intermediate language for ML and Haskell. In Proc. 25rd Annual A CM SIGPLAN- SIGA CT Syrup. on Principles of Programming Languages, page (to appear). ACM Press, 1998.
[30]
S. Peyton Jones and E. Meijer. Henk: a typed intermediate language. In Proc. 1997 A CM SIGPLAN Workshop on Types in Compilation, June 1997.
[31]
J. H. Reppy and E. R. Gansner. The eXene library manual. Cornell Univ. Dept. of Computer Science, March 1991.
[32]
J. C. Reynolds. Towards a theory of type structure. In Proceedings, Colloque sur la Programmation, Lecture Notes in Computer Science, volume 19, pages 408-425. Springer- Verlag, Berlin, 1974.
[33]
B. Saha and Z. Shao. Optimal type lifting. In Proc. 1998 International Workshop on Types in Compilation, March 1998.
[34]
Z. Shao. Flexible representation analysis. In Proc. 1997 A CM SIGPLAN International Conference on Functional Programming (iCFP'97), pages 85-98. ACM Press, June 1997.
[35]
Z. Shao. An overview of the FLiNT/ML compiler. In Proc. 1997 A CM SIGPLAN Workshop on Types in Compilation, June 1997.
[36]
Z. Shao. Typed common intermediate format. In Proc. 1997 USENIX Conference on Domain Specific Languages, pages 89-102, October 1997.
[37]
Z. Shao. Typed cross-module compilation. In Proc. 1998 A CM SIGPLAN International Conference on Functional Programming (ICFP'98). ACM Press, September 1998.
[38]
Z. Shao and A. W. Appel. Space-efficient closure representations. In 1994 A CM Conference on Lisp and Functional Programming, pages 150-161, New York, June 1994. ACM Press.
[39]
Z. Shao and A. W. Appel. A type-based compiler for Standard ML. In Proc. A CM SIGPLAN '95 Conf. on Prog. Lang. Design and Implementation, pages 116-129. ACM Press, 1995.
[40]
D. Tarditi. Design and Implementation of Code Optimizations for a 7~ype-Directed Compiler for Standard ML. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, December 1996. Tech Report CMU- CS-97-108.
[41]
D. Tarditi, G. Morrisett, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A type-directed optimizing compiler for ML. In Proc. A CM SIGPLAN '96 Conf. on Prog. Lang. Design and Implementation, pages 181-192. ACM Press, 1996.
[42]
M. Torte. Region-based memory management (invited talk). In Proc. 1998 International Workshop on Types in Compilation, March 1998.
[43]
A. Tolmach. Tag-free garbage collection using explicit type parameters. In Proc. 199d A CM Conf. on Lisp and Functional Programming, pages 1-11, New York, June 1994. ACM Press.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

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: 29 September 1998
Published in SIGPLAN Volume 34, Issue 1

Check for updates

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)81
  • Downloads (Last 6 weeks)20
Reflects downloads up to 22 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2008)Scrap Your Type ApplicationsProceedings of the 9th international conference on Mathematics of Program Construction10.1007/978-3-540-70594-9_2(2-27)Online publication date: 15-Jul-2008
  • (2002)The Suspension Notation for Lambda Terms and its Use in Metalanguage ImplementationsElectronic Notes in Theoretical Computer Science10.1016/S1571-0661(04)80539-567(35-48)Online publication date: Oct-2002
  • (2001)Scalable Certification for Typed Assembly LanguageTypes in Compilation10.1007/3-540-45332-6_5(117-145)Online publication date: 13-Jun-2001
  • (2001)Program Representation Size in an Intermediate Language with Intersection and Union TypesTypes in Compilation10.1007/3-540-45332-6_2(27-52)Online publication date: 13-Jun-2001
  • (2001)Sound and Complete Elimination of Singleton KindsTypes in Compilation10.1007/3-540-45332-6_1(1-25)Online publication date: 13-Jun-2001
  • (2024)Hashing Modulo Context-Sensitive 𝛼-EquivalenceProceedings of the ACM on Programming Languages10.1145/36564598:PLDI(2027-2050)Online publication date: 20-Jun-2024
  • (2021)Hashing modulo alpha-equivalenceProceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3453483.3454088(960-973)Online publication date: 19-Jun-2021
  • (2020)The history of Standard MLProceedings of the ACM on Programming Languages10.1145/33863364:HOPL(1-100)Online publication date: 12-Jun-2020
  • (2020)The evolution of Smalltalk: from Smalltalk-72 through SqueakProceedings of the ACM on Programming Languages10.1145/33863354:HOPL(1-101)Online publication date: 12-Jun-2020
  • (2020)The early history of F#Proceedings of the ACM on Programming Languages10.1145/33863254:HOPL(1-58)Online publication date: 12-Jun-2020
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media