On Friday 02 November 2001 05:27 pm, Dan Sugalski wrote:
> 1) The pointer in a PMC structure may point to:
>
>    *) Another PMC
>    *) A buffer object
>    *) Something non-tracked
>
> Additionally the buffer object may contain array of buffer object pointers,
> or an array of PMC pointers. Flags in the PMC note these occurrences.
>
> 2) A buffer object has the structure:
>
>     struct {
>        void *memory;
>        INTVAL size;
>     }
>
> this may be at the head of a larger structure, that's OK. (In fact, this is
> the start of the STRING and BIGNUM structures) The memory pointed to by a
> buffer object may be anything, but it is assumed to be moveable.

I hope rellocation can be handled efficiently.  I have these images in my 
head of multiple references to the same memory structure.. Relocating would 
involve finding each and every referrer.  That's a many to many association 
O(n^2).  Perhaps you suggest that PMC's themselves are not relocatable, and 
thus only a single PMC referes to each object in relocation-space.  Sounds 
like multiple heaps to me, but then there are advanced concepts like aliasing 
/ shared data-structures, etc.

>
> For a buffer to be considered 'live' it must be pointed to by a PMC either
> directly or via a single level of indirection. (If the PMC points to a
> buffer object that has an array of buffer pointers in it) For a PMC to be
> considered live it must be reachable via the interpreter's root set.

I'm missing the implications of being "live" or not.

>
> There will be a mechanism to register PMCs with the interpreter to note
> they're pointed to by something that the interpreter can't reach. (For
> example, a structure in your extension code, or via a pointer stashed in
> the depths of a buffer object, or referenced by another interpreter) This
> "foreign access" registry is considered part of an interpreter's root set.

Does this mean a flag exists such that when XS-code references a PMC it is 
set?  If this is so, the XS-can't unset it, since it doesn't know that other 
foreign code isn't also referencing it.

Lastly, is there any facility for private dynamic memory w/in XS code.. Such 
as algorithms that don't utilize PMC structures; especially parrot-ignorant 
algorithms.  I assume they'd need heap-space avoided by the GC.

-Michael

Reply via email to