skip to main content
research-article

HappyJIT: a tracing JIT compiler for PHP

Published:24 October 2011Publication History
Skip Abstract Section

Abstract

Current websites are a combination of server-generated dynamic content with client-side interactive programs. Dynamically - typed languages have gained a lot of ground in both of these domains. The growth of Web 2.0 has introduced a myriad of websites which contain personalized content, which is specific to the user. PHP or Python programs generate the actual HTML page after querying a database and processing the results, which are then presented by the browser. It is becoming more and more vital to accelerate the execution of these programs, as this is a significant part of the total time needed to present the page to the user.

This paper presents a novel interpreter for the PHP language written in RPython, which the PyPy translator then translates into C. The translator integrates into the interpreter a tracing just-in-time compiler which optimizes the hottest loops in the interpreted programs. We also describe a data model that supports all the data types in the PHP language, such as references and iterators. We evaluate the performance of this interpreter, showing that speedups up to a factor of 8 are observed using this approach.

References

  1. The Alternative PHP Cache. http://pecl.php.net/package/APC.Google ScholarGoogle Scholar
  2. cfront. http://www.softwarepreservation.org/projects/c_plus_plus/cfront.Google ScholarGoogle Scholar
  3. HipHop for PHP. https://github.com/facebook/hiphop-php.Google ScholarGoogle Scholar
  4. The PHP Benchmark. http://www.phpbench.com/.Google ScholarGoogle Scholar
  5. PyPy official documentation, http://codespeak.net/pypy/dist/pypy/doc.Google ScholarGoogle Scholar
  6. PyPy language front ends, http://codespeak.net/svn/pypy/lang/.Google ScholarGoogle Scholar
  7. Roadsend PHP. http://www.roadsend.com/home/index.php.Google ScholarGoogle Scholar
  8. The Computer Language Benchmarks Game. http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  9. Unladen Swallow. http://code.google.com/p/unladen-swallow/.Google ScholarGoogle Scholar
  10. The Zend PHP engine. http://www.zend.com/en/community/php/.Google ScholarGoogle Scholar
  11. O. Agesen. The cartesian product algorithm: Simple and precise type inference of parametric polymorphism. In Proceedings of the 1995 European Conference on Object-Oriented Programming, ECOOP '95, pages 2--26, London, UK, UK, 1995. Springer-Verlag. ISBN 3-540-60160-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. D. Ancona, M. Ancona, A. Cuni, and N. D. Matsakis. RPython: a step towards reconciling dynamically and statically typed OO languages. In Proceedings of the 2007 Dynamic Languages Symposium, DLS '07, pages 53--64, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-868-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. V. Bala, E. Duesterwald, and S. Banerjia. Dynamo: a transparent dynamic optimization system. In Proceedings of the 2000 Conference on Programming Language Design and Implementation, PLDI '00, pages 1--12, New York, NY, USA, 2000. ACM. ISBN 1-58113-199-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. P. Biggar, E. de Vries, and D. Gregg. A practical solution for scripting language compilers. In Proceedings of the 2009 Symposium on Applied Computing, SAC '09, pages 1916--1923, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-166-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In Proceedings of the 2009 Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS '09, pages 18--25, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-541-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. F. Bolz, M. Leuschel, and D. Schneider. Towards a jitting VM for Prolog execution. In Proceedings of the 2010 International Symposium on Principles and Practice of Declarative Programming, PPDP '10, pages 99--108, New York, NY, USA, 2010. ACM. ISBN 978-1-4503-0132-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Chang, E. Smith, R. Reitmaier, M. Bebenita, A. Gal, C. Wimmer, B. Eich, and M. Franz. Tracing for web 3.0: trace compilation for the next generation web applications. In Proceedings of the 2009 International Conference on Virtual Execution Environments, VEE '09, pages 71--80, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-375-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. A. Gal and M. Franz. Incremental dynamic code generation with trace trees. Technical Report ICS-TR-06-16, University of California, Irvine, 2006.Google ScholarGoogle Scholar
  19. A. Gal, C. W. Probst, and M. Franz. HotpathVM: an effective JIT compiler for resource-constrained devices. In Proceedings of the 2006 International Conference on Virtual Execution Environments, VEE '06, pages 144--153, New York, NY, USA, 2006. ACM. ISBN 1-59593-332-8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the 2009 Conference on Programming Language Design and Implementation, PLDI '09, pages 465--478, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-392-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. R. Ierusalimschy, L. H. D. Figueiredo, and W. Celes. The Implementation of Lua 5.0. Journal of Universal Computer Science, 11: 2005.Google ScholarGoogle Scholar
  22. C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. Proceedings of the 2004 International Symposium on Code Generation and Optimization, 0: 75, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. N. Lopes. Building a JIT compiler for PHP in 2 days, 2008.Google ScholarGoogle Scholar
  24. D. Rethans. The Vulcan Logic Dumper. http://derickrethans.nl/projects.html.Google ScholarGoogle Scholar
  25. A. Rigo. Representation-based just-in-time specialization and the psyco prototype for Python. In Proceedings of the 2004 Symposium on Partial Evaluation and Semantics-based Program Manipulation, PEPM '04, pages 15--26, New York, NY, USA, 2004. ACM. ISBN 1-58113-835-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. M. Serrano and P. Weis. Bigloo: A portable and optimizing compiler for strict functional languages. In Proceedings of the 1995 International Symposium on Static Analysis, SAS '95, pages 366--381, London, UK, 1995. Springer-Verlag. ISBN 3-540-60360-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Y. Shi, K. Casey, M. A. Ertl, and D. Gregg. Virtual machine showdown: Stack versus registers. ACM Transactions on Architecture and Code Optimization, 4: 2:1--2:36, January 2008. ISSN 1544-3566. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. Tatsubori, A. Tozawa, T. Suzumura, S. Trent, and T. Onodera. Evaluation of a just-in-time compiler retrofitted for PHP. In Proceedings of the 2010 International Conference on Virtual Execution Environments, VEE '10, pages 121--132, New York, NY, USA, 2010. ACM. ISBN 978-1-60558-910-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. A. Yermolovich, C. Wimmer, and M. Franz. Optimization of dynamic languages using hierarchical layering of virtual machines. In Proceedings of the 2009 Symposium on Dynamic languages, DLS '09, pages 79--88, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-769-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. M. Zaleski, A. D. Brown, and K. Stoodley. YETI: a gradually extensible trace interpreter. In Proceedings of the 2007 International Conference on Virtual Execution Environments, VEE '07, pages 83--93, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-630-1. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. HappyJIT: a tracing JIT compiler for PHP

      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

      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!