From: Vasiljevic Z. <zv...@ar...> - 2010-04-02 19:57:49
|
On 02.04.2010, at 20:58, Kevin Kenny wrote: > I'm disinclined to worry all that much. > > Tcl_InitStubs, in the current design, only, ever, either changes > tclStubsPtr from NULL to the actual Stubs table pointer, or changes > it from the actual Stubs table pointer to the *same* actual Stubs > table pointer. If this is so, then a simple and helgrind-savvy change (if you ever happen to run helgrind on the code you will understand what I mean) is to set tclStubsPtr only if it is NULL. If it is already set, one can simply avoid the change. Net-effect is simpler more understandable code and absence of tons of helgrind (a valgrind tool for detecting race-conditions) warnings about race-condotions at that place. The "logic" of setting the tclStubsPtr is really "convoluted". I do not consider myself super intelligent, but I'm not dumb either. From (lengthly) reading the (current) code I was not able to understand what it does. And I do have some 15 years Tcl (core) experience. Why Tcl_PackageReqEx() returns a new copy of the value to be set in (potentially initialized) tclStubsPtr?? I still did not get the clue why this done. And reading the Tcl_PackageReqEx comments does not bring any light into it. The most trivial and simple change would really be: tclStubsPtr = &tclStubs; as this is effectively what is being done after you walk all the calls in the chain. Cheers Zoran |