skip to main content
10.1145/1111037.1111073acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article

Staged allocation: a compositional technique for specifying and implementing procedure calling conventions

Published:11 January 2006Publication History

ABSTRACT

We present staged allocation, a technique for specifying calling conventions by composing tiny allocators called stages. A specification written using staged allocation has a precise, formal semantics, and it can be executed directly inside a compiler. Specifications of nine standard C~calling conventions range in size from 15 to 30 lines each. An implementation of staged allocation takes about 250 lines of ML or 650~lines of C++. Each specification can be used not only to help a compiler implement the calling convention but also to generate a test suite.

References

  1. Appel, Andrew W. 1992. Compiling with Continuations. Cambridge: Cambridge University Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Apple Computer. 2003. Mach-O Runtime Architecture.Google ScholarGoogle Scholar
  3. Bailey, Mark W. 2000. CSDL: Reusable Computing System Descriptions for Retargetable Systems Software. PhD thesis, University of Virginia, Dept of Computer Science. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bailey, Mark W. and Jack W. Davidson. 1995. A formal model and specification language for procedure calling conventions. In Conference Record of the 22nd Annual ACM Symposium on Principles of Programming Languages, pages 298--310. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. --------. 1996. Target-sensitive construction of diagnostic programs for procedure calling sequence generators. Proceedings of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation, in SIGPLAN Notices 31 (May): 249--257. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. --------. 2003. Automatic detection and diagnosis of faults in generated code for procedure calls. IEEE Transactions on Software Engineering 29 (November): 1031--1042. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Davidson, Jack W. and David B. Whalley. 1991. Methods for saving and restoring register values across function calls. Software---Practice & Experience 21 (2): 149--165. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Fraser, Christopher W. and David R. Hanson. 1995. A Retargetable C Compiler: Design and Implementation. Redwood City, CA: Benjamin/Cummings. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. George, Lal. 1999. SMLNJ: Garbage collection API. As of November 2005, available from http://www.smlnj.org/compiler-notes/gc-api.ps.Google ScholarGoogle Scholar
  10. Griswold, Ralph E. and Madge T. Griswold. 1996. The Icon Programming Language. Third edition. San Jose, CA: Peer-to-Peer Communications. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Hutton, Graham. 1992. Higher-order functions for parsing. Journal of Functional Programming 2 (July): 323--343.Google ScholarGoogle ScholarCross RefCross Ref
  12. Ierusalimschy, Roberto. 2003. Programming in Lua. Lua.org. ISBN 85-903798-1-7.Google ScholarGoogle Scholar
  13. Leroy, Xavier, Damien Doligez, Jacques Garrigue, Didier Rémy, and Jérôme Vouillon. 2004. The Objective Caml system release 3.08: Documentation and user's manual. INRIA. Available at http://pauillac.inria.fr/ocaml/htmlman.Google ScholarGoogle Scholar
  14. Lindig, Christian. 2005. Random testing of C calling conventions. In Sixth International Symposium on Automated and Analysis-Driven Debugging (AADEBUG), pages 3--11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Lindig, Christian and Norman Ramsey. 2004. Declarative composition of stack frames. In 13th International Conference on Compiler Construction (CC 2004), Vol. 2985 of LNCS, pages 298--312.Google ScholarGoogle ScholarCross RefCross Ref
  16. Mealy, George H. 1955. A method for synthesizing sequential circuits. Bell System Technical Journal 34 (5): 1045--1079.Google ScholarGoogle ScholarCross RefCross Ref
  17. Peyton Jones, Simon L., Norman Ramsey, and Fermin Reig. 1999. C--: a portable assembly language that supports garbage collection. In International Conference on Principles and Practice of Declarative Programming, Vol. 1702 of LNCS, pages 1--28. Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ramsey, Norman. 2005. Embedding an interpreted language using higher-order functions and types. Journal of Functional Programming. To appear. A preliminary version of this paper appeared in Proceedings of the ACM Workshop on Interpreters, Virtual Machines, and Emulators, June 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ramsey, Norman and Christian Lindig. 2002. Custom calling conventions in a portable assembly language. Unpublished paper available at http://www.eecs.harvard.edu/~nr/pubs/custom-abstract.html.Google ScholarGoogle Scholar
  20. Ramsey, Norman and Simon L. Peyton Jones. 2000. A single intermediate language that supports multiple implementations of exceptions. Proceedings of the ACM SIGPLAN~'00 Conference on Programming Language Design and Implementation, in SIGPLAN Notices 35 (May): 285--298. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Smith, Michael D. and Glenn Holloway. 2000. An introduction to Machine SUIF and its portable libraries for analysis and optimization. See http://www.eecs.harvard.edu/machsuif/software/nci/overview.html.Google ScholarGoogle Scholar
  22. Stroustrup, Bjarne. 1997. The C++ Programming Language. Third edition. Reading, MA: Addison-Wesley. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Staged allocation: a compositional technique for specifying and implementing procedure calling conventions

    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

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!