I had a further thought on borrowed pointers, and I no longer believe that
they are fully subsumed by regions. Here is why:

Given two regions r4 < r3, and a cell that is typed as "reference to object
in r4", there are two types of values that may reside in that cell:

   - A reference to an object in r3. This is a borrowed reference.
   - A reference to an object in r4. This is *not* a borrowed reference

The distinction between the two does not matter for safety reasons, but it *
does* matter for GC reasons. Overwriting a borrowed reference can never
reduce the live set of the target region. Overwriting a same-region
reference *may* reduce the live set.

But in contrast to a weak pointer, a borrowed pointer imposes the
requirement that the target object lifespan will be longer than the pointer
cell lifespan.

I'm not sure that this distinction is terribly useful in practice, because
it is *allocations* that trigger GC. The idea *might* be useful is where we
are trying to determine whether the liveness of a region may shrink. Not
sure. Certainly food for thought. I suppose it might also be useful to
track when GC can't possible help. If no action that potentially reduces
liveness has occurred, then GC can't free anything no matter how many
allocations we do.

Interesting, maybe.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to