Mixed Blocks: Storing More Fields Flatin-person
This presentation concerns extending OCaml’s uniform value representation to allow some fields of a heap object to not themselves have the uniform value representation. We call such heap objects mixed blocks. The “mixed” suggests that some fields have the uniform value representation and some do not. The garbage collector must not scan those fields that do not, as it has no way to distinguish them from pointers that it must dereference. Mixed blocks are a departure from the current OCaml, which supports only uniform blocks: either all of the fields are scanned or none of the fields are scanned.
The main motivation for mixed blocks is performance. They allow you to store opaque data directly in a heap block alongside other data. This enjoys less indirection than the approach OCaml presently takes, which is to wrap opaque data in a dedicated heap block.
Jane Street also uses mixed blocks as a compilation strategy for structures containing unboxed types, like 64-bit floats.
An implementation of mixed blocks is available in Jane Street’s flambda-backend branch of the OCaml compiler. The approach we take sacrifices generic operations such as comparison.
Paper (ocaml2024-final12.pdf) | 330KiB |
Sat 7 SepDisplayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
09:00 - 10:30 | OCaml compiler features and optimizationsOCaml at Orange 2 Chair(s): Stephen Dolan Jane Street Live stream: https://www.youtube.com/watch?v=OuQqblCxJ2Y | ||
09:00 22mTalk | On the design and implementation of Modular Explicitsin-person OCaml File Attached | ||
09:22 22mTalk | Flambda2 Validatorin-person OCaml File Attached | ||
09:45 22mTalk | A Non-allocating Optionin-person OCaml Richard A. Eisenberg Jane Street File Attached | ||
10:07 22mTalk | Mixed Blocks: Storing More Fields Flatin-person OCaml Nicholas Roberts Jane Street File Attached |