At 06:46 PM 4/24/2001 -0700, Larry Wall wrote:
>Dan Sugalski writes:
>: Resizing the vtable at runtime is a really dodgy thing. There are some
>: rather huge threading implications here--changing their size (as opposed to
>: using up a limited number of "uncommitted" spots we leave at the end) means
>: potentially having to move all the vtables around, which means updating the
>: vtable pointers already stuck into variables. This, one could assume, falls
>: firmly in the "yuck" category.
>
>I think we definitely have to be able to resize vtables at compile time,
>which is a form of run time.  It's vaguely possible we could restrict
>multithreading during compile phase.

We need to be single-threaded when we make any sort of wholesale structural 
change to the universe. It's a lot easier (and cheaper) to do it during a 
period where we're guaranteed to be single-threaded than it is to have all 
the running threads go stop and check periodically. (I don't really want to 
be coordinating on mutexes every statement or block or whatever)

>On the other hand, if objects point at their class, and the class points
>at the vtable, I don't see any big deal in resizing.  When you're ready
>to commit a new vtable it's a single pointer swap.

If you have the double-indirect, the window of vulnerability is smaller, 
but it's still there if you're running multithreaded. Unfortunately that 
double-indirection's not going to be cheap, and I don't see that it buys us 
all that much. Yes, it means that updating vtables costs less and is less 
dangerous, but it still costs and isn't free.

Also you have the issue of needing *all* the vtables in the system resized 
essentially atomically. (Or done at least before any code that uses the 
resized vtable to execute, which is more doable) The vtables need to stay 
consistent--if we add a method to one of 'em, we need to add it to all of them.

                                        Dan

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

Reply via email to