At 9:06 PM +0100 3/13/04, Oli wrote:
Dan Sugalski wrote:

As well as involving much finding of instances, and moving of their attribute
values, this isn't thread safe (please excuse my lack of PASM syntax
knowledge):


Yeah, adding an attribute requires a stop-the-world action, as every object that has the modified class needs to be modified. That's a non-trivial activity.

But, even if we stop everything until all objects got their attribute list updated, any offsets previously obtained via C<classoffset> may still be bogus afterwards. And there is no way for the code that holds the offset to know that either.

Which is a good reason to not cache the attribute offset value, yeah. But, then, the PMC can change classes at a whim, sufficiently enough to make even the class name invalid. I think we're reasonably safe here, since the only place that we'll see a problem is in class methods, which limits the damage.


I could certainly see fit to have a way to get a PMC rather than an INT that represents the class, and make sure the magic always updates the PMC to have the correct value.

However, I can also see that it might not be out of line to have the class method lock the class such that the class itself can't be altered if another thread is in one of the class' methods. This, though, could be reasonably problematic, so I'm not sure it's a good idea. (Though altering the structure of the class when other code is using something of that class probably isn't the best thing either)

It definitely is an issue, though.
--
                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to