Authors:
Robert Husák
1
;
Jan Kofroň
1
;
Jakub Míšek
2
and
Filip Zavoral
1
Affiliations:
1
Faculty of Mathematics and Physics, Charles University, Ke Karlovu 3, Prague, Czech Republic
;
2
iolevel s.r.o., Zelená 1743, Prague, Czech Republic
Keyword(s):
Compilers, Dynamic Languages, Optimization, Procedure Cloning, Type Analysis.
Abstract:
Compilation of dynamic programming languages into strongly typed platforms such as .NET and JVM has proven useful in enhancing the security and interoperability of the resulting programs, as well as in enabling their source-less distribution. In order to produce the best intermediate code possible, dynamic language compilers can employ advanced interprocedural type analysis and perform various optimizing transformations. However, these efforts are often limited due to the ambiguity of types in these languages and the need to preserve soundness. In this paper, we improve the performance of global functions by adapting the technique of procedure cloning, focusing on different parameter types those specialized clones can be called with. We devise several heuristics to identify the most promising specializations and call them from their respective call sites. Our technique was implemented into PeachPie, a compiler of PHP to .NET, and evaluated on standard benchmarks distributed with PHP.
Benchmarks containing deep recursion show a speedup factor up to 3.65, while benchmarks of computation-intensive loops reveal a speedup factor up to 2.64.
(More)