Closed jstolarek closed 7 years ago
I didn't see anywhere it was assumed that M.size refs == refCount.
Indeed, I think this is no longer needed in the current code. This was definitely required at some point in the past, but I think this invariant might have become obsolete when I refactored Store
to be abstract outside of Core
module. I definitely want to take a closer look at this later to make sure this is indeed correct.
This looks good.
The implementation of the
Store
logic might have a bug introduced by implementation of arrays:(Field names added for clarity.) The intention of
refCount
is to track the number of allocated references. So the invariant should beM.Size refs = refCount
. This is invalidated bystoreCreateArr
:So now the invariant is
M.Size refs + M.size arrs = refCount
and keys inrefs
andarrs
are not consecutive integers.I'm not sure if this causes any problems - needs deeper investigation.