skip to main content
article

Miniphases: compilation using modular and efficient tree transformations

Published:14 June 2017Publication History
Skip Abstract Section

Abstract

Production compilers commonly perform dozens of transformations on an intermediate representation. Running those transformations in separate passes harms performance. One approach to recover performance is to combine transformations by hand in order to reduce number of passes. Such an approach harms modularity, and thus makes it hard to maintain and evolve a compiler over the long term, and makes reasoning about performance harder. This paper describes a methodology that allows a compiler writer to define multiple transformations separately, but fuse them into a single traversal of the intermediate representation when the compiler runs. This approach has been implemented in a compiler for the Scala language. Our performance evaluation indicates that this approach reduces the running time of tree transformations by 35% and shows that this is due to improved cache friendliness. At the same time, the approach improves total memory consumption by reducing the object tenuring rate by 50%. This approach enables compiler writers to write transformations that are both modular and fast at the same time.

References

  1. H. Alblas. Attribute evaluation methods. In H. Alblas and B. Melichar, editors, Attribute Grammars, Applications and Systems: International Summer School SAGA Prague, Czechoslovakia, June 4–13, 1991 Proceedings, pages 48–113, Berlin, Heidelberg, 1991. Springer Berlin Heidelberg. ISBN 978-3-540-38490-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Bruneton, R. Lenglet, and T. Coupaye. Asm: a code manipulation tool to implement adaptable systems. Adaptable and extensible component systems, 30(19), 2002.Google ScholarGoogle Scholar
  3. D. Coutts, R. Leshchinskiy, and D. Stewart. Stream fusion: from lists to streams to nothing at all. In R. Hinze and N. Ramsey, editors, Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP 2007, Freiburg, Germany, October 1-3, 2007, pages 315–326. ACM, 2007. ISBN 978-1-59593-815-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. T. Ekman and G. Hedin. The JastAdd system – modular extensible compiler construction. Science of Computer Programming, 69(1):14–26, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. J. Gill. Cheap deforestation for non-strict functional languages. PhD thesis, University of Glasgow, UK, 1996.Google ScholarGoogle Scholar
  6. Intel Corporation. Intel 64 and IA-32 architectures optimization reference manual, 2016.Google ScholarGoogle Scholar
  7. Y. Jo and M. Kulkarni. Enhancing locality for recursive traversals of recursive structures. In Proceedings of the 2011 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’11, pages 463–482, New York, NY, USA, 2011. ACM. ISBN 978-1-4503-0940-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Y. Jo and M. Kulkarni. Automatically enhancing locality for tree traversals with traversal splicing. In G. T. Leavens and M. B. Dwyer, editors, Proceedings of the 27th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2012, part of SPLASH 2012, Tucson, AZ, USA, October 21-25, 2012, pages 355–374. ACM, 2012. ISBN 978-1-4503-1561-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Jourdan. A survey of parallel attribute evaluation methods. In H. Alblas and B. Melichar, editors, Attribute Grammars, Applications and Systems: International Summer School SAGA Prague, Czechoslovakia, June 4–13, 1991 Proceedings, pages 234–255, Berlin, Heidelberg, 1991. Springer Berlin Heidelberg. ISBN 978-3-540-38490-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. U. Kastens. Ordered attributed grammars. Acta Informatica, 13(3):229–256, 1980. ISSN 1432-0525. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. U. Kastens. Implementation of visit-oriented attribute evaluators. In H. Alblas and B. Melichar, editors, Attribute Grammars, Applications and Systems: International Summer School SAGA Prague, Czechoslovakia, June 4–13, 1991 Proceedings, pages 114–139, Berlin, Heidelberg, 1991. Springer Berlin Heidelberg. ISBN 978-3-540-38490-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. D. E. Knuth. Semantics of context-free languages. Mathematical systems theory, 2(2):127–145, 1968. ISSN 1433- 0490.Google ScholarGoogle Scholar
  13. G. Leontiev, E. Burmako, J. Zaugg, A. Moors, and P. Phillips. Sip-23 - literal-based singleton types. https://github.com/ scala/scala/pull/4706, 2016. Accessed: 2016-10-24.Google ScholarGoogle Scholar
  14. M. Lepper and B. Trancón y Widemann. Optimization of visitor performance by reflection-based analysis. In J. Cabot and E. Visser, editors, Theory and Practice of Model Transformations: 4th International Conference, ICMT 2011, Zurich, Switzerland, June 27-28, 2011. Proceedings, pages 15–30, Berlin, Heidelberg, 2011. Springer Berlin Heidelberg. ISBN 978-3-642-21732-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. P. Lewis, D. Rosenkrantz, and R. Stearns. Attributed translations. Journal of Computer and System Sciences, 9(3):279 – 307, 1974. ISSN 0022-0000. doi: http://dx. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. L. A. Meyerovich, M. E. Torok, E. Atkinson, and R. Bodik. Parallel schedule synthesis for attribute grammars. In Proceedings of the 18th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP ’13, pages 187–196, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-1922-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: An extensible compiler framework for java. In G. Hedin, editor, Compiler Construction: 12th International Conference, CC 2003 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2003 Warsaw, Poland, April 7–11, 2003 Proceedings, pages 138–152, Berlin, Heidelberg, 2003. Springer Berlin Heidelberg. ISBN 978-3-540-36579-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Odersky. The Scala language specification v 2.11, 2016.Google ScholarGoogle Scholar
  19. B. C. Pierce. Programming with intersection types, union types. Technical report, and polymorphism. Technical Report CMU-CS-91-106, Carnegie Mellon University, 1991.Google ScholarGoogle Scholar
  20. S. Rajbhandari, J. Kim, S. Krishnamoorthy, L. Pouchet, F. Rastello, R. J. Harrison, and P. Sadayappan. A domainspecific compiler for a parallel multiresolution adaptive numerical simulation environment. In J. West and C. M. Pancake, editors, Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC 2016, Salt Lake City, UT, USA, November 13- 18, 2016, pages 40:1–40:12. ACM, 2016. ISBN 978-1- 4673-8815-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. S. Rajbhandari, J. Kim, S. Krishnamoorthy, L.-N. Pouchet, F. Rastello, R. J. Harrison, and P. Sadayappan. On fusing recursive traversals of K-d trees. In Proceedings of the 25th International Conference on Compiler Construction, pages 152–162. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. H. Riis Nielson. Computation sequences: A way to characterize classes of attribute grammars. Acta Informatica, 19(3): 255–268, 1983. ISSN 1432-0525. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. D. Sarkar, O. Waddell, and R. K. Dybvig. Educational pearl: A nanopass framework for compiler education. J. Funct. Program., 15(5):653–667, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. P. Wadler. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 73(2):231–248, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Y. Weijiang, S. Balakrishna, J. Liu, and M. Kulkarni. Tree dependence analysis. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’15, pages 314–325, New York, NY, USA, 2015. ACM. ISBN 978-1-4503-3468-6. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Miniphases: compilation using modular and efficient tree transformations

    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 Notices
      ACM SIGPLAN Notices  Volume 52, Issue 6
      PLDI '17
      June 2017
      708 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/3140587
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI 2017: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation
        June 2017
        708 pages
        ISBN:9781450349888
        DOI:10.1145/3062341

      Copyright © 2017 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 14 June 2017

      Check for updates

      Qualifiers

      • article

    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!