From: Donal F. <don...@ma...> - 2025-05-02 16:24:53
|
Hi everyone, The branch for the new bytecodes (with the wonderfully wieldy name no-variable-width-instruction-issue) is ready for someone to give it a bit of a review. It's quite a large one, so here's a summary: 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: * INST_PUSH1 * INST_INVOKE_STK1 * INST_LOAD_SCALAR1 * INST_LOAD_SCALAR_STK (wasn't issues by our compiler anyway) * INST_LOAD_ARRAY1 * INST_STORE_SCALAR1 * INST_STORE_SCALAR_STK (another never-generated one) * INST_STORE_ARRAY1 * INST_INCR_SCALAR1 * INST_INCR_ARRAY1 * INST_INCR_SCALAR1_IMM * INST_INCR_ARRAY1_IMM * INST_APPEND_SCALAR1 * INST_APPEND_ARRAY1 * INST_LAPPEND_SCALAR1 * INST_LAPPEND_ARRAY1 * INST_RETURN_CODE_BRANCH * INST_TAILCALL * INST_TCLOO_NEXT * INST_TCLOO_NEXT_CLASS Some of these are replaced with their existing 4-byte versions. Some have new versions (now with 4-byte args): * INST_INCR_SCALAR * INST_INCR_ARRAY * INST_INCR_SCALAR_IMM * INST_INCR_ARRAY_IMM * INST_TAILCALL * INST_TCLOO_NEXT * INST_TCLOO_NEXT_CLASS 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: * INST_SWAP - Swap the top two items on the stack. * INST_ERROR_PREFIX_EQ - Special equality for [try/trap] * INST_TCLOO_ID - Get the creation ID of an object; not common, but easy * INST_DICT_PUT - [dict replace] as an opcode, simplifying [try] * INST_DICT_REMOVE - [dict remove] as an opcode, to fill out the suite available * INST_IS_EMPTY - access to Tcl_IsEmpty (and enhancements to bytecode optimiser to use it) 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. I have not performance-tested the code! This machine has aggressive speed-stepping forced on by institutional group policy. Sorry about that. Donal. |