fitzgen opened issue #11164:
Right now, we have a hash map from
VMSharedTypeIndexto metadata about how to trace objects of that type:This map is lazily updated as we allocate objects, inserting entries whenever we allocate an object of a type we haven't allocated before:
This system is slow:
- We always have to hash stuff on the hot allocation path, even if we already have that allocation's type's trace info.
- When we have to add a new entry because it is the first allocation of a given type, we hit the engine's type registry, which requires acquiring a read-lock.
We could address (1) by adding a one-item cache in front of the hashing, but that isn't super satisfactory.
Better would be to completely remove the need for this type-to-trace-info map in the first place by inlining the metadata we need to trace an object inline into its header:
- For arrays, this is just a bit saying whether the elements are GC refs or not.
- For structs, this is a bitmap:
- the
ith bit represents whetherobject_ptr + FIELDS_OFFSET + (i * size_of(VMGcRef))is aVMGcReffield that needs to be traced or not
fitzgen added the performance label to Issue #11164.
fitzgen added the wasm-proposal:gc label to Issue #11164.
Last updated: Dec 06 2025 at 06:05 UTC