Sampling Optimized Code for Type Feedback

10/05/2020
by   Olivier Flückiger, et al.
0

To efficiently execute dynamically typed languages, many language implementations have adopted a two-tier architecture. The first tier aims for low-latency startup times and collects dynamic profiles, such as the dynamic types of variables. The second tier provides high-throughput using an optimizing compiler that specializes code to the recorded type information. If the program behavior changes to the point that not previously seen types occur in specialized code, that specialized code becomes invalid, it is deoptimized, and control is transferred back to the first tier execution engine which will start specializing anew. However, if the program behavior becomes more specific, for instance, if a polymorphic variable becomes monomorphic, nothing changes. Once the program is running optimized code, there are no means to notice that an opportunity for optimization has been missed. We propose to employ a sampling-based profiler to monitor native code without any instrumentation. The absence of instrumentation means that when the profiler is not active, no overhead is incurred. We present an implementation is in the context of the Ř just-in-time, optimizing compiler for the R language. Based on the sampled profiles, we are able to detect when the native code produced by Ř is specialized for stale type feedback and recompile it to more type-specific code. We show that sampling adds an overhead of less than 3 type feedback within milliseconds.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/06/2020

Bringing GNU Emacs to Native Code

Emacs Lisp (Elisp) is the Lisp dialect used by the Emacs text editor fam...
research
04/30/2021

Fast Compilation and Execution of SQL Queries with WebAssembly

Interpreted execution of queries, as in the vectorized model, suffers fr...
research
05/29/2019

Categorization of Program Regions for Agile Compilation using Machine Learning and Hardware Support

A compiler processes the code written in a high level language and produ...
research
07/12/2020

The Taint Rabbit: Optimizing Generic Taint Analysis with Dynamic Fast Path Generation

Generic taint analysis is a pivotal technique in software security. Howe...
research
11/20/2020

AZP: Automatic Specialization for Zero Values in Gaming Applications

Recent research has shown that dynamic zeros in shader programs of gamin...
research
03/04/2022

Deoptless: Speculation with Dispatched On-Stack Replacement and Specialized Continuations

Just-in-time compilation provides significant performance improvements f...
research
12/06/2022

Formally Verified Native Code Generation in an Effectful JIT – or: Turning the CompCert Backend into a Formally Verified JIT Compiler

Modern Just-in-Time compilers (or JITs) typically interleave several mec...

Please sign up or login with your details

Forgot password? Click here to reset