Skip to content
Tcl Source Code Artifact [7c7315c0f0]
Login

Artifact [7c7315c0f0]

Artifact 7c7315c0f08ae7caffd00ef5a7611ad90416dd75:

Ticket change [7c7315c0f0] - Ticket [d4e7780ca1681cd0|d4e7780ca1] <i>&quot;global&quot; cmd literal sharing vs. per-interp resolvers</i> status still Open with 4 other changes by gustafn2 on 2016-09-05 22:03:23.
D 2016-09-05T22:03:23.527
J comment Cmd\sliterals\sare\sshared\sin\sthe\sglobal\s(i.e.\sper-interpreter)\sliteral\spool\sper\snamespace.\sHowever,\sit\sis\snot\sguaranteed,\sthat\sthe\scmdObj\sresolved\sfor\sa\sliteral\svia\sa\scmd\sresolver\sis\sthe\salways\ssame\sfor\sa\snamespace.\sTherefore\sone\ssees\sdifferent\sresults\sfor\sa\scmd\sdepending\son\swhether\sor\snot\sthe\sa\scmd\sliteral\swas\searlier\sadded\sto\sthe\sglobal\scmd\sliteral\spool.\sThe\sglobal\sshared\scmd\sliteral\sis\staken,\sthe\sresult\sfrom\sthe\scommand\sresolver\sis\signored.\s\r\n\r\nThe\sproblem\scomes\sfrom\sa\slarge\sreal\sworld\sapplication\sduring\sthe\stcl8.5\s->\stcl8.6\stransition.\sThe\sprovided\spatch\s(see\sattachment)\sdetermines\ssuch\ssituations\sand\sturns\sshared\sglobal\sliterals\sinto\sunshared\sprivate\sones.\sThe\sprovided\stest\scases\sare\strying\sto\sreproduce\sthe\sbehavior\sin\sa\sminimalistic\ssetup,\swhich\stries\sto\sminimalize\sinteractions\swith\sother\stest\scases\sby\srestricting\sto\scertain\snames.\r\n\r\nAn\salternative\s(but\snot\sso\slocal)\sapproach\sto\saddress\sthese\skind\sof\sbugs\swould\sbe\sto\sflag\sduring\scmd\sresolution\swhether\sa\sresolved\scommand\swas\sderived\sfrom\sa\scustom\scmd\sresolver,\sand\sto\sprevent\sthe\snamespace\sbased\s"global"\ssharing\sin\ssuch\scases\sbased\son\sthat\sflag.
J icomment <p>Deleted\sTclPanic:\sthis\swas\sintentionally.\sWhen\sthe\scode\sis\scompiled\swith\sTCL_COMPILE_DEBUG\sthe\sfunction\sTclVerifyLocalLiteralTable()\sis\scalled,\swhich\stries\sto\smake\ssure\sthat\sall\sliterals\sare\sin\sthe\sglobal\s(sharing)\sliteral\spool.\sIt\sis\sthe\sintention\sof\sthe\spatch\sto\savoid\ssharing\sfor\sliterals\shandled\sby\sthe\sresolvers,\stherefore\sthese\sare\snot\sin\sthe\sglobal\spool,\sbut\sthere\sis\sno\sneed\sto\spanic\sin\ssuch\scases.\sActually,\sthe\sfull\sif-clause\sshould\sbe\sremoved.\sThe\schange\sis\sonly\svisible\swhen\scompiled\swith\sTCL_COMPILE_DEBUG\sin\sthe\sresolver.test.\r\n\r\n<p>Crash:\sThe\scode\shad\sthe\sassumption\sthat\sall\sTcl_Objs\sof\stype\s"cmdName"\shave\sa\r\nvalid\sintrep.\sHowever,\sSetCmdNameFromAny()\scan\sproduce\sa\sTcl_Obj\sof\stype\s"cmdName"\swhen\sthe\scommand\sis\snot\sfound\s(last\sclause\sof\sthe\sfunction).\sin\sthe\stcloo.test,\sthere\sis\ssome\sshimmering\sduring\scompilation,\swhere\sthe\sliteral\sis\sfound\slocally\swith\sa\sdifferent\stype\sand\sthen\sSetCmdNameFromAny()\schanges\sit.\sThe\spatch\sfixes\sthe\sincorrect\sassumption.\r\n\r\n<pre>\r\n==================================================================\r\n---\sgeneric/tclObj.c\r\n+++\sgeneric/tclObj.c\r\n@@\s-4218,11\s+4218,11\s@@\r\n\s\s\s\s\sregister\sNamespace\s*currNsPtr;\r\n\s\s\s\s\sconst\schar\s*name;\r\n\s\r\n\s\s\s\s\sif\s(objPtr->typePtr\s==\s&tclCmdNameType)\s{\r\n\s\tresPtr\s=\sobjPtr->internalRep.twoPtrValue.ptr1;\r\n-\tif\s(resPtr->cmdPtr\s==\scmdPtr)\s{\r\n+\tif\s(resPtr\s!=\sNULL\s&&\sresPtr->cmdPtr\s==\scmdPtr)\s{\r\n\s\t\s\s\s\sreturn;\r\n\s\t}\r\n\s\s\s\s\s}\r\n\s\r\n\s\s\s\s\scmdPtr->refCount++;\r\n</pre>\r\n\r\ni'll\scheck\stomorrow,\swhether\sthe\scleaned-up\sversion\sis\sstill\sthe\ssame\s(just\snoticed\schanges\sin\sflag\sextra-flag\spassing).
J login gustafn2
J mimetype text/html
K d4e7780ca1681cd095dbd81fe264feff75c988f7
U gustafn2
Z e32ae2176775e2c58e52654f0510406e