Charles Explorer logo
🇨🇿

Optimizing Transformations of Dynamic Languages Compiled to Intermediate Representations

Publikace na Matematicko-fyzikální fakulta |
2020

Tento text není v aktuálním jazyce dostupný. Zobrazuje se verze "en".Abstrakt

Compiling dynamic languages to stack-based intermediate representations used in platforms such as .NET and Java proved to be useful, mainly due to the enhanced interoperability and security. To produce the best intermediate code possible, current approaches perform a detailed flow-sensitive type analysis of the original code and utilize its results to choose the most efficient operations of the target platform.

As known from the traditional compilers, the standard way to further increase program performance is using a set of transformations, which increase its efficiency while preserving its semantics. However, these transformations are not directly usable in the compilers of dynamic languages, because these operate on a higher level of abstraction; moreover, dynamic languages pose specific challenges, such as those stemming from weak typing.

In this paper we propose a set of transformations which fit into the architecture of a dynamic language compiler, fitting well together with the type analysis. For evaluation purposes, we implemented them to Peachpie, a compiler of PHP to .NET.

Applying the transformations during compilation of WordPress resulted in improvement of 0.6% in the generated assembly size, 1.8% in CPU time and 0.8% in memory consumption.