At 8:05 PM +0100 12/22/03, Elizabeth Mattijsen wrote:
At 11:00 -0500 12/22/03, Dan Sugalski wrote:
Easily, albeit with a bit of a speed hit for threaded code. (Java has immutable strings which cuts out a lot of the need for synchronization, since you don't need any for immutable data) If all access is through PMCs, and it needs to be, you use the threaded version of the PMC vtables, which automatically get and release the PMC lock. (That's what the synchronization entry on the PMC is for, to hold the mutex or whatever it is for this)

In Perl 5, the sharedness of a variable can be determined at run-time. Leo's mentioned that a PMC will never change its address during its lifetime. Can these two requirements be met if there are threaded and unthreaded versions of PMC vtables?

Yes. Making a PMC shared can be as simple as swapping out the vtable pointer in the PMC structure--no need to move it around at all. (Or, worst case, turning the PMC into a reference PMC for the actual PMC, whose contents get moved to a new header, which is legal-ish)
--
Dan


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

Reply via email to