Re: Patches that will come...

[email protected] (Leopold Toetsch) Thu, 2 Sep 2004 12:25:40 +0200
Newsgroups perl.ponie.dev
Message-ID <[email protected]>
Arthur Bergman <[email protected]> wrote:
>>
>> Is there XS code around that directly manipulates aggregates? E.g.
>>
>>   AvARRAY(av)[i] = some_sv;
>>
>> or is it enforced to use the interface:


> There is, but I think we can get this to work because even if you can
> do that you need to go through the API to resize the array (IE, if you
> call realloc yourself your are on your own), so AvARRAY simply needs to
> return the internal array as it does now, and the GC code in our PMC
> just needs to walk the PMCs inside the AvARRAY.

I don't think that this will work. The AvARRAY(av) is the actual
location of the start of the "current" array memory. The problem is not
to finally walk through that array and mark objects being alive. Trying
to realloc() is likely to break, but that's not the point.

The write barrier has to track pointer overwrites when they happen. Some
GC schemes need the old pointer value before it gets overwritten. Other
schemes need to know that a new value was written into that aggregate.

So as soon as aggregate's memory is exposed like above and direct
overwrites can happen, things will start breaking.

The term aggregate stands for anything that possibly holds references to
other PMCs.

> I think :)

Sorry ;)

> Cheers
> Arthur

leo