Skip to main content
QUICK REVIEW

[Paper Review] Deoptless: Speculation with Dispatched On-Stack Replacement and Specialized Continuations

Olivier Flückiger, Jan Ječmen|arXiv (Cornell University)|Mar 4, 2022
Parallel Computing and Optimization TechniquesComputer Science26 references5 citations
TL;DR

This paper introduces deoptless, a just-in-time compilation technique that replaces traditional deoptimization with dispatched, specialized continuations to avoid performance degradation when speculative optimizations fail. By dynamically selecting optimized continuations based on runtime context, deoptless enables faster recovery from failed speculations and achieves up to 35× speedup in real-world benchmarks compared to baseline deoptimization.

ABSTRACT

Just-in-time compilation provides significant performance improvements for programs written in dynamic languages. These benefits come from the ability of the compiler to speculate about likely cases and generate optimized code for these. Unavoidably, speculations sometimes fail and the optimizations must be reverted. In some pathological cases, this can leave the program stuck with suboptimal code. In this paper we propose deoptless, a technique that replaces deoptimization points with dispatched specialized continuations. The goal of deoptless is to take a step towards providing users with a more transparent performance model in which mysterious slowdowns are less frequent and grave.

Motivation & Objective

  • To address performance pathologies caused by deoptimization in just-in-time compilers.
  • To eliminate the need to deoptimize to a slower tier when speculative optimizations fail.
  • To provide a more predictable and performant execution model for dynamic languages.
  • To enable recovery from failed speculations using optimized, context-specific continuations instead of fallback interpreters.
  • To improve peak performance by generating code specialized to the actual execution context at OSR points.

Proposed method

  • Replaces deoptimization with dispatched on-stack replacement (OSR) to specialized continuations instead of reverting to baseline code.
  • Maintains multiple optimized continuations at each OSR point, each specialized under different runtime assumptions.
  • Uses context dispatch at OSR exit points to select the most appropriate continuation based on current execution state.
  • Retains the original function and its optimized code for potential reuse, avoiding progressive generalization.
  • Employs type inference and feedback to override stale profile data and guide continuation selection.
  • Bounds the number of continuations; when full, deoptless falls back to traditional deoptimization.

Experimental results

Research questions

  • RQ1Can deoptless eliminate performance degradation caused by deoptimization in JIT compilers?
  • RQ2How does deoptless compare to traditional deoptimization in terms of recovery speed after failed speculation?
  • RQ3Can deoptless improve peak performance by generating context-specialized continuations?
  • RQ4What is the impact of deoptless on real-world workloads with dynamic type changes?
  • RQ5How does deoptless handle cases where profile data becomes stale or incorrect?

Key findings

  • Deoptless achieves up to 9.1× faster execution on synthetic benchmarks with randomly failing assumptions, with all benchmarks at least 1.9× faster than baseline.
  • In the column-wise sum benchmark, deoptless delivers a 35× performance improvement over the baseline due to faster recovery from deoptimization.
  • The ray-tracer benchmark shows consistent alleviation of slowdowns caused by type changes, demonstrating deoptless's effectiveness in real-world scenarios.
  • Deoptless outperforms profile-driven reoptimization on the RSA benchmark, matching its best-case speedup of 1.4×.
  • The technique is robust in handling stale type feedback and maintains high performance through context-aware continuation dispatch.
  • No benchmarks were slower under deoptless, indicating consistent performance improvement across diverse workloads.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.