Get the latest tech news
Representing Type Lattices Compactly
The Cinder JIT compiler does some cool stuff with how they represent types so I’m going to share it with you here. The core of it is thinking about types as sets (lattices, even), and picking a compact representation. Compilers will create and manipulate types with abandon, so all operations have to be fast.
It may be tempting to assume that if your type t is a strict subtype of (can’t be equal to) LongExact, it represents a specific int object: iv, written by Constellation (JavaScriptCore committer), has a smaller bitset lattice V8’s Turbofan compiler has something similar Simple (the Sea of Nodes compiler)’s Type.java Cliff Click’s aa language Type.java HotSpot’s C2’s type.hpp PyPy’s RPython generates heap effect metadata for functions that can’t be inlined so that the JIT knows what heap addresses they do and do not write to. Thanks to CF Bolz-Tereick, Cliff Click, Tom Hebb, Kai Williams, and Thomas Gardner for feedback on this post.
Or read this on Hacker News