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.
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- T. Ekman and G. Hedin. The JastAdd system – modular extensible compiler construction. Science of Computer Programming, 69(1):14–26, 2007. Google Scholar
Digital Library
- A. J. Gill. Cheap deforestation for non-strict functional languages. PhD thesis, University of Glasgow, UK, 1996.Google Scholar
- Intel Corporation. Intel 64 and IA-32 architectures optimization reference manual, 2016.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- U. Kastens. Ordered attributed grammars. Acta Informatica, 13(3):229–256, 1980. ISSN 1432-0525. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- D. E. Knuth. Semantics of context-free languages. Mathematical systems theory, 2(2):127–145, 1968. ISSN 1433- 0490.Google Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- M. Odersky. The Scala language specification v 2.11, 2016.Google Scholar
- B. C. Pierce. Programming with intersection types, union types. Technical report, and polymorphism. Technical Report CMU-CS-91-106, Carnegie Mellon University, 1991.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- H. Riis Nielson. Computation sequences: A way to characterize classes of attribute grammars. Acta Informatica, 19(3): 255–268, 1983. ISSN 1432-0525. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- P. Wadler. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 73(2):231–248, 1990. Google Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Miniphases: compilation using modular and efficient tree transformations
Recommendations
Miniphases: compilation using modular and efficient tree transformations
PLDI 2017: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and ImplementationProduction 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 ...
A Software Science Model of Compile Time
The Halstead theory of software science is used to describe the compilation process and generate a compiler performance index. A nonlinear model of compile time is estimated for four Ada compilers. A fundamental relation between compile time and program ...






Comments