Opened 16 months ago
#1824 assigned enhancement
Change locatives representation
Reported by: | sjamaan | Owned by: | sjamaan |
---|---|---|---|
Priority: | minor | Milestone: | 6.0.0 |
Component: | core libraries | Version: | 5.3.0 |
Keywords: | Cc: | ||
Estimated difficulty: | medium |
Description
As pointed out here, we can change the representation of locatives such that they take up less space, and we only have to traverse the live weak locatives for update during GC.
The idea is to drop the extra "object" slot, and store it in the pointer slot instead. When the locative is weak, set C_SPECIALBLOCK_BIT
. When it is strong, do not set it (so that the object is referenced normally). For weak locatives, we traverse the live ones using the "chained" approach and update the object.
We don't need to do the pointer recalculation on every GC. Instead, we calculate the pointer on-the-fly during locative_ref
.
NOTE: Perhaps we also want to expose a version of locative-ref that doesn't error out when the object has been collected, but returns bwp-object
instead? This means handling of such locatives is a bit simpler and doesn't require exception handling.