Modeling the Invariance of Virtual Pointers in LLVM

02/22/2020
by   Piotr Padlewski, et al.
0

Devirtualization is a compiler optimization that replaces indirect (virtual) function calls with direct calls. It is particularly effective in object-oriented languages, such as Java or C++, in which virtual methods are typically abundant. We present a novel abstract model to express the lifetimes of C++ dynamic objects and invariance of virtual table pointers in the LLVM intermediate representation. The model and the corresponding implementation in Clang and LLVM enable full devirtualization of virtual calls whenever the dynamic type is statically known and elimination of redundant virtual table loads in other cases. Due to the complexity of C++, this has not been achieved by any other C++ compiler so far. Although our model was designed for C++, it is also applicable to other languages that use virtual dispatch. Our benchmarks show an average of 0.8 speedup in some cases. The implementation is already a part of the upstream LLVM/Clang and can be enabled with the -fstrict-vtable-pointers flag.

READ FULL TEXT
research
12/15/2021

Exploring Aspects of Polyglot High-Performance Virtual Machine GraalVM

Contemporary software often becomes vastly complex, and we are required ...
research
11/08/2017

Correctness of Speculative Optimizations with Dynamic Deoptimization

High-performance dynamic language implementations make heavy use of spec...
research
05/16/2017

A Co-contextual Type Checker for Featherweight Java (incl. Proofs)

This paper addresses compositional and incremental type checking for obj...
research
10/01/2019

Mμl: The Power of Dynamic Multi-Methods

Multi-methods are a straightforward extension of traditional (single) dy...
research
03/10/2020

Devil is Virtual: Reversing Virtual Inheritance in C++ Binaries

Complexities that arise from implementation of object-oriented concepts ...
research
10/05/2020

Wasm/k: Delimited Continuations for WebAssembly

WebAssembly is designed to be an alternative to JavaScript that is a saf...
research
02/17/2022

Million.js: A Fast, Compiler-Augmented Virtual DOM for Performant JavaScript UI Libraries

The need for developing and delivering interactive web applications has ...

Please sign up or login with your details

Forgot password? Click here to reset