Ticket UUID: | aa10216459cdfe0fd3eab0bbab949e611bd7336e | |||
Title: | bytecode using 4 bytes offsets and other improvements | |||
Type: | RFE | Version: | main | |
Submitter: | oehhar | Created on: | 2025-05-05 08:31:54 | |
Subsystem: | 47. Bytecode Compiler | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Open | Last Modified: | 2025-05-05 08:31:54 | |
Resolution: | None | Closed By: | nobody | |
Closed on: | ||||
Description: |
Donal Fellows has authored bytecode improvements in the branch https://core.tcl-lang.org/tcl/timeline?r=no-variable-width-instruction-issue&c=2025-05-04+16%3A43%3A44. The posted descriptions are recorded in this ticket by the cronicler Harald Oehlmann: The branch deprecates all operations that have a single byte for a jump offset, a variable index or an argument count (except for string concatenation). These are replaced with versions that use four-byte offsets/indices/counts. The affected instructions are:
Some of these are replaced with their existing 4-byte versions. Some have new versions (now with 4-byte args):
The replacement for INST_RETURN_CODE_BRANCH is INST_JUMP_TABLE_NUM that is a general numeric-keyed jump table. (Take note for the Tcl Compiler and TBCLoad: there's a new AUX type). I also add these new opcodes:
Some of the operations are made available to [tcl::unsupported::assemble]. Only the error prefix comparator isn't; that's got safety requirements on its argument that I'm not bothering to make the assembler understand. As far as I can tell, the test suite is passing. At least on Windows and excluding some tests that don't run on this laptop. A side note: the INST_JUMP_TABLE_NUM instruction will enable the addition of a new mode of operation for [switch] that I've been thinking about for a while: switching on integer equality, which I've seen the need for in handling things like switching on the number of arguments passed to a procedure. (It can't be safely done now because we use the wrong sort of equality testing.) I'll TIP that up once the instruction to make it practical hits the trunk. |
