Skip to content
Tcl Source Code Artifact [3c91321c9b]
Login

Artifact [3c91321c9b]

Artifact 3c91321c9b02bc2eb4235d30f1238c18a2672cae:

Ticket change [3c91321c9b] - Ticket [3030870fffffffff|3030870fff] <i>make itcl 3.x built with pre-8.6 work in 8.6</i> status still Open with 4 other changes by nijtmans on 2010-07-18 12:42:53.
D 2010-07-18T12:42:53
J icomment See\sthe\sfollowing\scomment\sin\stcl.h:\n==========================================================================\nA\scall\sframe\sis\sinitialized\sand\spushed\susing\sTcl_PushCallFrame\sand\spopped\nusing\sTcl_PopCallFrame.\sStorage\sfor\sa\sTcl_CallFrame\smust\sbe\sprovided\sby\sthe\nTcl_PushCallFrame\scaller,\sand\scallers\stypically\sallocate\sthem\son\sthe\sC\scall\nstack\sfor\sefficiency.\sFor\sthis\sreason,\sTcl_CallFrame\sis\sdefined\sas\sa\nstructure\sand\snot\sas\san\sopaque\stoken.\sHowever,\smost\sTcl_CallFrame\sfields\nare\shidden\ssince\sapplications\sshould\snot\saccess\sthem\sdirectly;\sothers\sare\ndeclared\sas\s"dummyX".\n==========================================================================\n\nExample\sextension\scode:\n\n\sTcl_CallFrame\sframe;\n\sint\ssomevar;\n\n\sTcl_PushCallFrame(interp,\s&frame,\s....);\n\s....\n\sTcl_PopCallFrame(interp);\n\nThe\sfunctions\sTcl_PushCallFrame\sand\sTcl_PopCallFrame\sare\sfunctions\nthat\slook\slike\spublic,\sbut\sin\sfact\sthey\sare\sin\sthe\sprivate\sstub\ntable.\sThe\sTcl_CallFrame\sstructure\slooks\slike\sa\spublic\sstructure,\nbut\sin\sfact\sis\swas\snever\sdocumented.\sAs\sfar\sas\sI\sknow,\sthe\sonly\nextension\susing\sit\sis\sItcl.\sSo,\sis\sit\sreally\spublic?....\n\nJust\sbecause\sTcl\s8.5\sadded\stwo\sfields\sto\sthe\sTcl_CallFrame\sstructure\nthis\scaused\s[incr\sTcl\sBug\s#1725219].\sTcl\s8.6\sdid\sit\sagain\swith\sone\nadditional\sfield.\sSo,\syes,\syou\sare\sright\sthat\s"Adjusting\sthe\ssize\nof\sany\spublic\sstructure\sis\sa\srecipe\sfor\sproblems".\sThat's\sexactly\nwhat\scaused\s[incr\sTcl\sBug\s#1725219].\sThe\sproblem\sis\scaused\sby\noverwriting\svariables\sthat\scome\simmediately\safther\sthe\sTcl_CallFrame\nstructure\son\sthe\sstack,\sthat\sthat's\sexactly\swhat\sthis\spatch\sis\nnot\sdoing.\n\nSo,\swhat\shappens\sif\sthe\sabove\sexample\scode\sis\scompiled\sagainst\nTcl\s8.4.19?\sThe\s"frame"\svariable\sis\sallocated\son\sthe\sstack,\sand\nis\sused\sto\shold\sthe\sold\scallframe\sbetween\sthe\sTcl_PushCallFrame\nand\sTcl_PopCallFrame\scalls.\sNow\swe\sare\srunning\sit\sin\sTcl\s8.5\sor\nTcl\s8.6.\sThe\sTcl_CallFrame\sstructure\sgot\ssome\sextra\nfields,\sso\sthe\sresult\sis\sthat\sthe\s"frame"\svariable\sis\snot\nbig\senough\sany\smore\sto\shold\sthe\sinformation\sstored\sby\sTcl.\nThe\seffect\swill\sbe\sthat\sthe\s"somevar"\svariable\sis\soverwritten.\n\nSo,\snow\swe\srun\sit\sin\sTcl\s8.4.20\s(with\sthis\spatch).\sYes,\sthe\nTcl_CallFrame\sgot\ssome\sextra\sfields.\sBut\sTcl\snever\sreads\sor\nwrites\sthose\sdummy\sfields,\sso\sthe\s"somevar"\svariable\swill\nnever\sbe\soverwritten.\n\nNow\swhat\shappens\sif\swe\scompile\sthe\sabove\ssample\scode\susing\nTcl\s8.4.20\s(with\sthis\spatch).\sThe\seffect\sis\sthat\sthe\s"frame"\nvariable\sgets\ssome\sextra\sspace,\sand\sthe\sthe\s"somevar"\svariable\nis\smoved\sfarther\saway\son\sthe\sstack.\sWhen\srunning\sit\son\nTcl\s8.4.19,\sthis\sextra\sspace\sis\snot\sused.\sBut\swhen\srunning\nit\son\sTcl\s8.5\sor\sTcl\s8.6,\sthis\sspace\swill\sbe\sused\sby\sthe\nTcl_PushCallFrame\sfunction!\sBut\sthis\spatch\sprevents\sthat\nthe\s"somevar"\sis\soverwritten,\sso\sthe\sbug\sis\ssolved.\n
J login nijtmans
J mimetype text/plain
J username nijtmans
K 3030870fffffffffffffffffffffffffffffffff
U nijtmans
Z 273aa0d88acfa1e978ade861db528fb3