On Wed, 2008-03-05 at 14:32 -0500, Swaroop Sridhar wrote:
> Even if inner-ref is removed, it will still be possible take
> non-escapable references to individual elements of vectors (for for
> example), by passing them by-reference to functions that expect
> by-ref arguments.

It was never my intention that by-reference would permit inner aliasing
in this way. I failed completely to see this issue, and we need to
resolve it.

The problem with an inner pointer arises when a compacting collector is
used. The collector must now do containment analysis to determine the
base pointer to the original containing object so that it can determine
how to relocate the inner pointer correctly if the containing object was
moved.

There are a number of heap management techniques that can handle this,
but none of them are simple.

Possible solutions:

  1. Introduce a new REF type FAT-REF. REF can be assigned to FAT-REF
     but FAT-REF cannot be assigned to REF.

     I do not like this. I mention it for completeness.

  2. Design the heap so that discovering the correct base pointer
     is simplified. This complicates the allocator.

  3. Prohibit inner references passed by reference. This does not
     seem very nice.

  4. Remove by-reference from the language.

  5. Find some clever way of identifying these pointers.

  6. Stop worrying about compacting collectors.

I am open to suggestions.


shap

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

Reply via email to