7 research outputs found

    Inline Caching Meets Quickening. In

    Get PDF
    Abstract. Inline caches effectively eliminate the overhead implied by dynamic typing. Yet, inline caching is mostly used in code generated by just-in-time compilers. We present efficient implementation techniques for using inline caches without dynamic translation, thus enabling future interpreter implementers to use this important optimization techniquewe report speedups of up to a factor of 1.71-without the additional implementation and maintenance costs incurred by using a just-in-time compiler

    Speculative Staging for Interpreter Optimization

    Full text link
    Interpreters have a bad reputation for having lower performance than just-in-time compilers. We present a new way of building high performance interpreters that is particularly effective for executing dynamically typed programming languages. The key idea is to combine speculative staging of optimized interpreter instructions with a novel technique of incrementally and iteratively concerting them at run-time. This paper introduces the concepts behind deriving optimized instructions from existing interpreter instructions---incrementally peeling off layers of complexity. When compiling the interpreter, these optimized derivatives will be compiled along with the original interpreter instructions. Therefore, our technique is portable by construction since it leverages the existing compiler's backend. At run-time we use instruction substitution from the interpreter's original and expensive instructions to optimized instruction derivatives to speed up execution. Our technique unites high performance with the simplicity and portability of interpreters---we report that our optimization makes the CPython interpreter up to more than four times faster, where our interpreter closes the gap between and sometimes even outperforms PyPy's just-in-time compiler.Comment: 16 pages, 4 figures, 3 tables. Uses CPython 3.2.3 and PyPy 1.

    Static optimization in PHP 7

    Get PDF
    PHP is a dynamically typed programming language commonly used for the server-side implementation of web applications. Approachability and ease of deployment have made PHP one of the most widely used scripting languages for the web, powering important web applications such as WordPress, Wikipedia, and Facebook. PHP's highly dynamic nature, while providing useful language features, also makes it hard to optimize statically. This paper reports on the implementation of purely static bytecode optimizations for PHP 7, the last major version of PHP. We discuss the challenge of integrating classical compiler optimizations, which have been developed in the context of statically-typed languages, into a programming language that is dynamically and weakly typed, and supports a plethora of dynamic language features. Based on a careful analysis of language semantics, we adapt static single assignment (SSA) form for use in PHP. Combined with type inference, this allows type-based specialization of instructions, as well as the application of various classical SSA-enabled compiler optimizations such as constant propagation or dead code elimination. We evaluate the impact of the proposed static optimizations on a wide collection of programs, including micro-benchmarks, libraries and web frameworks. Despite the dynamic nature of PHP, our approach achieves an average speedup of 50% on micro-benchmarks, 13% on computationally intensive libraries, as well as 1.1% (MediaWiki) and 3.5% (WordPress) on web applications

    A Flexible Framework for Studying Trace-Based Just-In-Time Compilation

    Get PDF
    Just-in-time compilation has proven an effective, though effort-intensive, choice for realizing performant language runtimes. Recently introduced JIT compilation frameworks advocate applying meta-compilation techniques such as partial evaluation or meta-tracing on simple interpreters to reduce the implementation effort. However, such frameworks are few and far between. Designed and highly optimized for performance, they are difficult to experiment with. We therefore present STRAF, a minimalistic yet flexible Scala framework for studying trace-based JIT compilation. STRAF is sufficiently general to support a diverse set of language interpreters, but also sufficiently extensible to enable experiments with trace recording and optimization. We demonstrate the former by plugging two different interpreters into STRAF. We demonstrate the latter by extending STRAF with e.g., constant folding and type-specialization optimizations, which are commonly found in dedicated trace-based JIT compilers. The evaluation shows that STRAF is suitable for prototyping new techniques and formalisms in the domain of trace-based JIT compilation

    Distributed programming using role-parametric session types in go

    Get PDF
    This paper presents a framework for the static specification and safe programming of message passing protocols where the number and kinds of participants are dynamically instantiated. We develop the first theory of distributed multiparty session types (MPST) to support parameterised protocols with indexed rolesÐour framework statically infers the different kinds of participants induced by a protocol definition as role variants, and produces decoupled endpoint projections of the protocol onto each variant. This enables safe MPST-based programming of the parameterised endpoints in distributed settings: each endpoint can be implemented separately by different programmers, using different techniques (or languages). We prove the decidability of role variant inference and well-formedness checking, and the correctness of projection. We implement our theory as a toolchain for programming such role-parametric MPST protocols in Go. Our approach is to generate API families of lightweight, protocol- and variant-specific type wrappers for I/O. The APIs ensure a well-typed Go endpoint program (by native Go type checking) will perform only compliant I/O actions w.r.t. the source protocol. We leverage the abstractions of MPST to support the specification and implementation of Go applications involving multiple channels, possibly over mixed transports (e.g., Go channels, TCP), and channel passing via a unified programming interface. We evaluate the applicability and run-time performance of our generated APIs using microbenchmarks and real-world applications

    Optimizing JavaScript Engines for Modern-day Workloads

    Get PDF
    In modern times, we have seen tremendous increase in popularity and usage of web-based applications. Applications such as presentation softwareand word processors, which were traditionally considered desktop applications are being ported to the web by compiling them to JavaScript. Since JavaScript is the de facto language of the web, JavaScript engine performance significantly affects the overall web application experience. JavaScript, initially intended solely as a client-side scripting language for web browsers, is now being used to implement server-side web applications (node.js) that traditionally have been written in languages like Java. Web application developers expect "C"-like performance out of their applications. Thus, there is a need to reevaluate the optimization strategies implemented in the modern day engines.Thesis statement: I propose that by using run-time and ahead-of-time profiling and type specialization techniques it is possible to improve the performance of JavaScript engines to cater to the needs of modern-day workloads.In this dissertation, we present an improved synergistic type specialization strategy for optimized JavaScript code execution, implemented on top of a research JavaScript engine called MuscalietJS. Our technique combines type feedback and type inference to reinforce and augment each other in a unique way. We then present a novel deoptimization strategy that enables type specialized code generation on top of typed, stack-based virtual machines like CLR. We also describe a server-side offline profiling technique to collect profile information for web application which helps client JavaScript engines (running in the browser) avoid deoptimizations and improve performance of the applications. Finally, we describe a technique to improve the performance of server-side JavaScript code by making use of intelligent profile caching and two new type stability heuristics

    Optimization in code generation to reduce energy consumption

    Get PDF
    Dissertação de mestrado em Computer ScienceIn recent years we have witnessed a great technological advance accompanied by an equally impressive increase in energy consumption, causing problems of both financial and environmental order. In order to counteract this tendency, Green Computing emerges with a number of measures for a more efficient use of computing resources without a great loss of performance. This essay is a study of several elements of Information Technology analyzed from the point of view of energy efficiency. With special emphasis on microprocessors, modern compiler design, development tools and optimization of code generation, a wide range of information is gathered on very relevant subjects through perspectives still not very considered by the community in general. Also presented are two experimental studies that analyze the optimization of generated code for a set of benchmark programs in several programming languages with the aim of apraise the otimization impact on improving their energy consumption efficiency. A software measurement framework was also developed that, together with the methodologies presented in both studies, allows obtaining very precise and pertinent results for analysis. Finally, a ranking was produced for 18 development tools, considering the execution time and energy consumption of the executables generated through their compilation profiles. This study also intends to contribute to an energy efficient technological advancement. All the work developed here may also serve as motivation so that these and other aspects of Information Technology may be seen through a greener perspective.Nos últimos anos temos assistido a um grande avanço tecnológico acompanhado por um aumento igualmente impressionante do consumo energético, provocando problemas quer de ordem financeira quer de ordem ambiental. Com o intuito de contrariar essa tendência, surge o Green Computing com várias medidas para uma utilização mais eficiente dos recursos computacionais sem grande perda de performance. Esta dissertação apresenta um estudo relativo a diversos elementos das Tecnologias de Informação analisados do ponto de vista da eficiência energética. Com especial destaque para microprocessadores, conceção moderna dos compiladores atuais, ferramentas de desenvolvimento e geração de código otimizado, é aqui reunida uma vasta gama de informação sobre assuntos bastante relevantes segundo perspetivas ainda pouco consideradas pela comunidade em geral. São também apresentados dois estudos experimentais que analisam a otimização do código gerado para um conjunto de programas benchmarks em várias linguagens de programação com o objetivo de compreender o impacto das otimizações no sentido de melhorar a eficiência energética dos programas compilados. Foi também desenvolvida uma framework de medição por software que em conjunto com as metodologias apresentadas em ambos os estudos permite a obtenção de resultados bastante precisos e pertinentes de análise. Por último é elaborado um ranking para 18 ferramentas de desenvolvimento considerando o tempo de execução e consumo energético dos executáveis gerados através dos seus perfis de compilação. Este estudo pretende assim contribuir para um avanço tecnológico energeticamente mais eficiente. Que todo o trabalho aqui desenvolvido possa também ele servir de motivação para que estes e outros aspetos das Tecnologias de Informação possam ser vistos através de uma perspetiva mais ecológica.This work is funded by the ERDF through the Programme COMPETE and by the Portuguese Government through FCT - Foundation for Science and Technology, within projects: FCOMP-01-0124-FEDER-020484, FCOMP-01-0124-FEDER-022701, and grant ref. BI4-2014 GreenSSCM-38973 UMINHO
    corecore