Keeping oops across primitives
Andreas Raab
andreas.raab at gmx.de
Tue Jun 6 10:12:41 UTC 2006
Cees De Groot wrote:
> I'm hardly a VM hacker, but:
>
> On 6/6/06, Andreas Raab <andreas.raab at gmx.de> wrote:
>> sqInt addToVmRoots(sqInt *newArray, sqInt newCount, sqInt *oldArray);
>
> why not oldCount as an argument? Or zero-terminated arrays for that matter?
oldCount is irrelevant since the VM won't copy the contents of newArray;
it will merely keep a reference to it (the array really is under control
of the plugin). Therefore all we need is the reference to oldArray (this
also goes for reallocating via realloc() - just remember the old pointer
before you do that and pass it into the above to update the oop array).
Why not NULL terminated? I'm planning on using NULL as the "undefined
entry" in the oop array. Since this code is managed by some other C code
that seems preferrable to nil (although the plugin could store nil just
as well). But it probably will be valuable for the C code to be able to
say "clear this entry" via storing NULL and having the VM skip this is
fairly simple.
Cheers,
- Andreas
More information about the Vm-dev
mailing list