Skip to content
Tcl Source Code Artifact [2cb4761b0f]
Login

Artifact [2cb4761b0f]

Artifact 2cb4761b0fa548f681ffe47676e77c11f0fb1b66789a77f7b5f806f7cd4a5853:

Ticket change [2cb4761b0f] - New ticket [aa10216459cdfe0f|aa10216459] <i>bytecode using 4 bytes offsets and other improvements</i>. by oehhar on 2025-05-05 08:31:54.
D 2025-05-05T08:31:54.704
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment Donal\sFellows\shas\sauthored\sbytecode\simprovements\sin\sthe\sbranch\s[https://core.tcl-lang.org/tcl/timeline?r=no-variable-width-instruction-issue&c=2025-05-04+16%3A43%3A44].\r\n\r\nThe\sposted\sdescriptions\sare\srecorded\sin\sthis\sticket\sby\sthe\scronicler\sHarald\sOehlmann:\r\n\r\nThe\sbranch\sdeprecates\sall\soperations\sthat\shave\sa\ssingle\sbyte\sfor\sa\sjump\soffset,\sa\svariable\sindex\sor\san\sargument\scount\s(except\sfor\sstring\sconcatenation).\sThese\sare\sreplaced\swith\sversions\sthat\suse\sfour-byte\soffsets/indices/counts.\sThe\saffected\sinstructions\sare:\r\n\r\n\r\n\s\s\s*\s\s\sINST_PUSH1\r\n\s\s\s*\s\s\sINST_INVOKE_STK1\r\n\s\s\s*\s\s\sINST_LOAD_SCALAR1\r\n\s\s\s*\s\s\sINST_LOAD_SCALAR_STK\s(wasn't\sissues\sby\sour\scompiler\sanyway)\r\n\s\s\s*\s\s\sINST_LOAD_ARRAY1\r\n\s\s\s*\s\s\sINST_STORE_SCALAR1\r\n\s\s\s*\s\s\sINST_STORE_SCALAR_STK\s(another\snever-generated\sone)\r\n\s\s\s*\s\s\sINST_STORE_ARRAY1\r\n\s\s\s*\s\s\sINST_INCR_SCALAR1\r\n\s\s\s*\s\s\sINST_INCR_ARRAY1\r\n\s\s\s*\s\s\sINST_INCR_SCALAR1_IMM\r\n\s\s\s*\s\s\sINST_INCR_ARRAY1_IMM\r\n\s\s\s*\s\s\sINST_APPEND_SCALAR1\r\n\s\s\s*\s\s\sINST_APPEND_ARRAY1\r\n\s\s\s*\s\s\sINST_LAPPEND_SCALAR1\r\n\s\s\s*\s\s\sINST_LAPPEND_ARRAY1\r\n\s\s\s*\s\s\sINST_RETURN_CODE_BRANCH\r\n\s\s\s*\s\s\sINST_TAILCALL\r\n\s\s\s*\s\s\sINST_TCLOO_NEXT\r\n\s\s\s*\s\s\sINST_TCLOO_NEXT_CLASS\r\n\r\nSome\sof\sthese\sare\sreplaced\swith\stheir\sexisting\s4-byte\sversions.\sSome\shave\snew\sversions\s(now\swith\s4-byte\sargs):\r\n\r\n\s\s\s*\s\s\sINST_INCR_SCALAR\r\n\s\s\s*\s\s\sINST_INCR_ARRAY\r\n\s\s\s*\s\s\sINST_INCR_SCALAR_IMM\r\n\s\s\s*\s\s\sINST_INCR_ARRAY_IMM\r\n\s\s\s*\s\s\sINST_TAILCALL\r\n\s\s\s*\s\s\sINST_TCLOO_NEXT\r\n\s\s\s*\s\s\sINST_TCLOO_NEXT_CLASS\r\n\r\n\r\nThe\sreplacement\sfor\sINST_RETURN_CODE_BRANCH\sis\sINST_JUMP_TABLE_NUM\sthat\sis\sa\sgeneral\snumeric-keyed\sjump\stable.\s(Take\snote\sfor\sthe\sTcl\sCompiler\sand\sTBCLoad:\sthere's\sa\snew\sAUX\stype).\r\n\r\nI\salso\sadd\sthese\snew\sopcodes:\r\n\r\n\s\s\s*\s\s\sINST_SWAP\s-\sSwap\sthe\stop\stwo\sitems\son\sthe\sstack.\r\n\s\s\s*\s\s\sINST_ERROR_PREFIX_EQ\s-\sSpecial\sequality\sfor\s[try/trap]\r\n\s\s\s*\s\s\sINST_TCLOO_ID\s-\sGet\sthe\screation\sID\sof\san\sobject;\snot\scommon,\sbut\seasy\r\n\s\s\s*\s\s\sINST_DICT_PUT\s-\s[dict\sreplace]\sas\san\sopcode,\ssimplifying\s[try]\r\n\s\s\s*\s\s\sINST_DICT_REMOVE\s-\s[dict\sremove]\sas\san\sopcode,\sto\sfill\sout\sthe\ssuite\savailable\r\n\s\s\s*\s\s\sINST_IS_EMPTY\s-\saccess\sto\sTcl_IsEmpty\s(and\senhancements\sto\sbytecode\soptimiser\sto\suse\sit)\r\n\r\n\r\nSome\sof\sthe\soperations\sare\smade\savailable\sto\s[tcl::unsupported::assemble].\sOnly\sthe\serror\sprefix\scomparator\sisn't;\sthat's\sgot\ssafety\srequirements\son\sits\sargument\sthat\sI'm\snot\sbothering\sto\smake\sthe\sassembler\sunderstand.\r\n\r\nAs\sfar\sas\sI\scan\stell,\sthe\stest\ssuite\sis\spassing.\sAt\sleast\son\sWindows\sand\sexcluding\ssome\stests\sthat\sdon't\srun\son\sthis\slaptop.\r\n\r\nA\sside\snote:\sthe\sINST_JUMP_TABLE_NUM\sinstruction\swill\senable\sthe\saddition\sof\sa\snew\smode\sof\soperation\sfor\s[switch]\sthat\sI've\sbeen\sthinking\sabout\sfor\sa\swhile:\sswitching\son\sinteger\sequality,\swhich\sI've\sseen\sthe\sneed\sfor\sin\shandling\sthings\slike\sswitching\son\sthe\snumber\sof\sarguments\spassed\sto\sa\sprocedure.\s(It\scan't\sbe\ssafely\sdone\snow\sbecause\swe\suse\sthe\swrong\ssort\sof\sequality\stesting.)\sI'll\sTIP\sthat\sup\sonce\sthe\sinstruction\sto\smake\sit\spractical\shits\sthe\strunk.
J foundin main
J is_private 0
J login oehhar
J priority 5\sMedium
J private_contact 0f366eb3e9e2fcab52b8ebacd197db9047186a5f
J resolution None
J severity Minor
J status Open
J submitter oehhar
J subsystem 47.\sBytecode\sCompiler
J title bytecode\susing\s4\sbytes\soffsets\sand\sother\simprovements
J type RFE
K aa10216459cdfe0fd3eab0bbab949e611bd7336e
U oehhar
Z 9b93b4043e633c8cadfb3de495bb8be8