NativeJIT: A C++ expression –> x64 JIT
10 months ago
- #C++
- #JIT compilation
- #Bing search engine
- NativeJIT is an open-source, cross-platform library for high-performance just-in-time (JIT) compilation of expressions involving C data structures.
- Developed by the Bing team, it is used in the Bing search engine for scoring documents based on user queries.
- NativeJIT is lightweight, fast, and has no dependencies beyond the standard C++ runtime, running on Linux, OSX, and Windows.
- It optimizes generated code with a focus on register allocation, crucial for throughput and latency at scale.
- Designed for scenarios where expressions are unknown until runtime, evaluated multiple times to amortize compilation costs, and require low compilation latency.
- Includes support for arithmetic, logical operations, pointer and array operations, conditionals, structure field access, and calling C functions.
- Building NativeJIT requires CMake (2.8.11+) and a modern C++ compiler (gcc 5+, clang 3.4+, or VC 2015+).
- Provides example scripts for building on *nix platforms, OS X (using Makefiles or Xcode), and Windows (Visual Studio 2015).
- Example code demonstrates compiling an expression to calculate the area of a circle, showcasing generated assembly code.