5 research outputs found

    Homeostasis: Design and Implementation of a Self-Stabilizing Compiler

    Full text link
    Mainstream compilers perform a multitude of analyses and optimizations on the given input program. Each analysis (such as points-to analysis) may generate a program-abstraction (such as points-to graph). Each optimization is typically composed of multiple alternating phases of inspection of such program-abstractions and transformations of the program. Upon transformation of a program, the program-abstractions generated by various analyses may become inconsistent with the modified program. Consequently, the correctness of the downstream inspection (and consequent transformation) phases cannot be ensured until the relevant program-abstractions are stabilized; that is, the program-abstractions are either invalidated or made consistent with the modified program. In general, the existing compiler frameworks do not perform automated stabilization of the program-abstractions and instead leave it to the compiler pass writers to deal with the complex task of identifying the relevant program-abstractions to be stabilized, the points where the stabilization is to be performed, and the exact procedure of stabilization. In this paper, we address these challenges by providing the design and implementation of a novel compiler-design framework called Homeostasis. Homeostasis automatically captures all the program changes performed by each transformation phase, and later, triggers the required stabilization using the captured information, if needed. We also provide a formal description of Homeostasis and a correctness proof thereof. To assess the feasibility of using Homeostasis in compilers of parallel programs, we have implemented our proposed idea in IMOP, a compiler framework for OpenMP C programs. We present an evaluation which demonstrates that Homeostasis is efficient and easy to use.Comment: Accepted for publication in ACM TOPLAS. 58 pages, 36 figures. Patent granted in India. US Patent published. For associated code, see https://github.com/anonymousoopsla21/homeostasi

    Cross-Platform Language Design

    Get PDF
    Programming languages are increasingly compiled to multiple runtimes, each featuring their own rich structures such as their object model. Furthermore, they need to interact with other languages targeting said runtimes. A language targeting only one runtime can be designed to tailor its semantics to those of that runtime, for easy interoperability with other languages. However, in a language targeting multiple runtimes with differing semantics, it is difficult to cater to each of them while retaining a common behavior across runtimes. We call \emph{cross-platform language} a language that aims at being both \emph{portable} across platforms and \emph{interoperable} with each target platform. Portability is the ability for a program or a library to cross-compile for multiple platforms, and behave the same way on all of them. Interoperability is the ability to communicate with other languages on the same platform. While many cross-compiling languages focus on one of these two properties---only adding support for the other one as an afterthought---, languages that are designed from the ground up to support both are rare. In this thesis, we present the design of Scala.js, the dialect of Scala targeting the JavaScript platform, which turned Scala into a cross-platform language. On the one hand, Scala programs can be cross-compiled for the JVM and JavaScript with portable semantics. On the other hand, whereas Scala/JVM interoperates with Java, Scala.js interoperates with JavaScript, allowing to use any JavaScript library. Along the dissertation, we give insights that can be transferred to the design of other cross-platform languages, although with a bias towards those targeting the JVM and JavaScript. The first and most obvious challenge is to reconcile the static nature of Scala's object model with JavaScript's dynamic one. Besides the ability to mutate a class hierarchy at run-time in JavaScript, there are fundamental differences between the two models, in particular the difference between compile-time overloading and run-time overloading. We discuss how such semantic mismatches can live in harmony within the language. The second challenge is to obtain good performance from a language where interoperability with a dynamic and unknown part of the program is pervasive. To that end, we design and specify an intermediate representation (IR) with first-class support for dynamically typed interoperability features in addition to statically typed JVM-style operations. Despite its tight integration with the open world of JavaScript, most of the IR can be considered as a closed world where advanced whole-program optimizations can be performed. The performance of the overall system is evaluated and shown to be competitive with hand-written JavaScript, and even with Scala/JVM in some cases
    corecore