[Fwd: Re: Keeping oops across primitives]
Andreas Raab
andreas.raab at gmx.de
Fri Jun 9 22:29:18 UTC 2006
Tony Garnock-Jones wrote:
> Andreas Raab wrote:
>> Actually, this is an interesting thought. I have the need for managing a
>> dynamic array of roots but this could be handled just as easily by
>> tracking a variable pointing to a Squeak array.
>
> A variable in C is more-or-less a one-place array, so perhaps supporting
> arrays is the simpler option?
Turns out not. The code is much simpler supporting just individual oop
locations (variables) so I decided to go with the following interface:
sqInt oopVar; /* declare a global that we wish to track */
{
...
oopVar = vm->nilObject(); /* don't forget to initialize it !!! */
vm->addGCRoot(&oopVar); /* update it */
...
}
and to undo that
{
...
vm->removeGCRoot(&oopVar);
...
}
Cheers,
- Andreas
More information about the Vm-dev
mailing list