There is a tension between fast allocation of objects and honoring various constraints the VM might place on the object.

These constraints include registering the objects for finalization, aligning the objects on multiple word boundaries, pinning objects for performance reasons, registering objects related to weak pointers and so forth.

We have tried to resolve this tension by overloading the size argument that is passed to the allocation routine. If the size of the argument has a high bit of 0, then the allocation routine will assume that no constraints exist on the allocation of this object and allocation can potentially be made very fast. If on the other hand the size is large then the routine will query the class data structure to determine what constraints are being made on the allocation of this object.

The gc_import.h interface will provide the following masks to allow the gc to quickly determine the constraints.