Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

B3 JIT (WebKit)

Kunshan Wang edited this page Feb 19, 2016 · 5 revisions

The B3 JIT compiler

Original blog: https://webkit.org/blog/5852/introducing-the-b3-jit-compiler/

WebKit's FTL JIT now uses a new backend called B3 (Bare Bone Backend), which replaces LLVM as the low-level optimizer. This layer shares many principles with the Mu micro VM, most notably the role as a low-level substrate of a virtual machine.

This Wiki page will discuss the B3 JIT and its influence to the Mu micro VM.

Comparison

motivation

  • B3: LLVM is powerful but slow. It takes up 3/4 of the optimisation time. B3 should be 10 times faster than LLVM while still operate the same level of granularity as LLVM and do the same kind of optimisations LLVM does.
  • Mu: Mu abstracts over concurrency, JIT and GC, but offloads most optimisations to the client.

size of the IR

  • B3: Focus on the size (memory footprint) of the IRs, and the number of IRs (levels). Much effort is made to design a compact representation that is also fast to traverse and transform.
  • Mu: Not designed with memory footprint in mind. The in-memory representation of the IR is an implementation detail.

type system

  • B3 IR: void, int32, int64, float, double. No heap references. No aggregate types. Integers are used as addresses.
  • Mu IR: Has object references, pointers, aggregate types, etc.

basic operations

  • Both B3 and Mu IR have BinOps, Comparisons, Conversions, Branch and Switch. Both B3 and Mu use the goto-with-values form (B3 uses "Upsilon functions" to "assign" values to Phi-nodes.).

Function call

  • B3: Can only call C functions (CCall)
  • Mu: Can call both Mu functions (CALL) and C functions (CCALL).

Memory operations

  • B3: Load and Store with either Int32 or Int64 as addresses.
  • Mu: Load, Store, CmpXchg and AtomicRMW with iref<T> or ptr<T>. ptr<T> can be converted from int<n>.

GC

  • B3: Does not abstract over GC.
  • Mu: It does.

Influence to Mu

Clone this wiki locally