Charles Explorer logo
🇬🇧

Using Procedure Cloning for Performance Optimization of Compiled Dynamic Languages

Publication at Faculty of Mathematics and Physics |
2022

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.