6 research outputs found

    JavaScript AOT compilation

    Get PDF
    International audienceStatic compilation, a.k.a., ahead-of-time (AOT) compilation, is an alternative approach to JIT compilation that can combine good speed and lightweight memory footprint, and that can accommodate read-only memory constraints that are imposed by some devices and some operating systems. Unfortunately the highly dynamic nature of JavaScript makes it hard to compile statically and all existing AOT compilers have either gave up on good performance or full language support. We have designed and implemented an AOT compiler that aims at satisfying both. It supports full unrestricted ECMAScript 5.1 plus many ECMAScript 2017 features and the majority of benchmarks are within 50% of the performance of one of the fastest JIT compilers

    Compact Native Code Generation for Dynamic Languages on Micro-core Architectures

    Get PDF
    Micro-core architectures combine many simple, low memory, low power-consuming CPU cores onto a single chip. Potentially providing significant performance and low power consumption, this technology is not only of great interest in embedded, edge, and IoT uses, but also potentially as accelerators for data-center workloads. Due to the restricted nature of such CPUs, these architectures have traditionally been challenging to program, not least due to the very constrained amounts of memory (often around 32KB) and idiosyncrasies of the technology. However, more recently, dynamic languages such as Python have been ported to a number of micro-cores, but these are often delivered as interpreters which have an associated performance limitation. Targeting the four objectives of performance, unlimited code-size, portability between architectures, and maintaining the programmer productivity benefits of dynamic languages, the limited memory available means that classic techniques employed by dynamic language compilers, such as just-in-time (JIT), are simply not feasible. In this paper we describe the construction of a compilation approach for dynamic languages on micro-core architectures which aims to meet these four objectives, and use Python as a vehicle for exploring the application of this in replacing the existing micro-core interpreter. Our experiments focus on the metrics of performance, architecture portability, minimum memory size, and programmer productivity, comparing our approach against that of writing native C code. The outcome of this work is the identification of a series of techniques that are not only suitable for compiling Python code, but also applicable to a wide variety of dynamic languages on micro-cores.Comment: Preprint of paper accepted to ACM SIGPLAN 2021 International Conference on Compiler Construction (CC 2021

    R Melts Brains -- An IR for First-Class Environments and Lazy Effectful Arguments

    Full text link
    The R programming language combines a number of features considered hard to analyze and implement efficiently: dynamic typing, reflection, lazy evaluation, vectorized primitive types, first-class closures, and extensive use of native code. Additionally, variable scopes are reified at runtime as first-class environments. The combination of these features renders most static program analysis techniques impractical, and thus, compiler optimizations based on them ineffective. We present our work on PIR, an intermediate representation with explicit support for first-class environments and effectful lazy evaluation. We describe two dataflow analyses on PIR: the first enables reasoning about variables and their environments, and the second infers where arguments are evaluated. Leveraging their results, we show how to elide environment creation and inline functions

    Reusable semantics for implementation of Python optimizing compilers

    Full text link
    Le langage de programmation Python est aujourd'hui parmi les plus populaires au monde grĂące Ă  son accessibilitĂ© ainsi que l'existence d'un grand nombre de librairies standards. Paradoxalement, Python est Ă©galement reconnu pour ses performances mĂ©diocres lors de l'exĂ©cution de nombreuses tĂąches. Ainsi, l'Ă©criture d’implĂ©mentations efficaces du langage est nĂ©cessaire. Elle est toutefois freinĂ©e par la sĂ©mantique complexe de Python, ainsi que par l’absence de sĂ©mantique formelle officielle. Pour rĂ©gler ce problĂšme, nous prĂ©sentons une sĂ©mantique formelle pour Python axĂ©e sur l’implĂ©mentation de compilateurs optimisants. Cette sĂ©mantique est Ă©crite de maniĂšre Ă  pouvoir ĂȘtre intĂ©grĂ©e et analysĂ©e aisĂ©ment par des compilateurs dĂ©jĂ  existants. Nous introduisons Ă©galement semPy, un Ă©valuateur partiel de notre sĂ©mantique formelle. Celui-ci permet d'identifier et de retirer automatiquement certaines opĂ©rations redondantes dans la sĂ©mantique de Python. Ce faisant, semPy gĂ©nĂšre une sĂ©mantique naturellement plus performante lorsqu'exĂ©cutĂ©e. Nous terminons en prĂ©sentant Zipi, un compilateur optimisant pour le langage Python dĂ©veloppĂ© avec l'assistance de semPy. Sur certaines tĂąches, Zipi offre des performances compĂ©titionnant avec celle de PyPy, un compilateur Python reconnu pour ses bonnes performances. Ces rĂ©sultats ouvrent la porte Ă  des optimisations basĂ©es sur une Ă©valuation partielle gĂ©nĂ©rant une implĂ©mentation spĂ©cialisĂ©e pour les cas d'usage frĂ©quent du langage.Python is among the most popular programming language in the world due to its accessibility and extensive standard library. Paradoxically, Python is also known for its poor performance on many tasks. Hence, more efficient implementations of the language are required. The development of such optimized implementations is nevertheless hampered by the complex semantics of Python and the lack of an official formal semantics. We address this issue by presenting a formal semantics for Python focussed on the development of optimizing compilers. This semantics is written as to be easily reusable by existing compilers. We also introduce semPy, a partial evaluator of our formal semantics. This tool allows to automatically target and remove redundant operations from the semantics of Python. As such, semPy generates a semantics which naturally executes more efficiently. Finally, we present Zipi, a Python optimizing compiler developped with the aid of semPy. On some tasks, Zipi displays performance competing with those of PyPy, a Python compiler known for its good performance. These results open the door to optimizations based on a partial evaluation technique which generates specialized implementations for frequent use cases

    Of JavaScript AOT compilation performance

    No full text
    International audienceThe fastest JavaScript production implementations use just-in-time (JIT) compilation and the vast majority of academic publications about implementations of dynamic languages published during the last two decades focus on JIT compilation. This does not imply that static compilers (AoT) cannot be competitive; as comparatively little effort has been spent creating fast AoT JavaScript compilers, a scientific comparison is lacking. This paper presents the design and implementation of an AoT JavaScript compiler, focusing on a performance analysis. The paper reports on two experiments, one based on standard JavaScript benchmark suites and one based on new benchmarks chosen for their diversity of styles, authors, sizes, provenance, and coverage of the language. The first experiment shows an advantage to JIT compilers, which is expected after the decades of effort that these compilers have paid to these very tests. The second shows more balanced results, as the AoT compiler generates programs that reach competitive speeds and that consume significantly less memory. The paper presents and evaluates techniques that we have either invented or adapted from other systems, to improve AoT JavaScript compilation
    corecore