Overview
| Artifact ID: | 394c11458808c3cb691eb4423d47ab5d34950b7b |
|---|---|
| Ticket: | 1661637fffffffffffffffffffffffffffffffff
direct compile of pure list scripts |
| User & Date: | dgp on 2007-02-16 16:09:00 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
The attached patch modifies TclSetBytecodeFromAny() so that when the value we are compiling is already a pure list, we produce bytecode directly, and don't go through the waste of reparsing the string rep, and recreating word values out of the tokens produced by parsing. This means we don't shimmer away any possibly valuable internal reps in the elements of the list. As a simple example: set ns ::foo namespace eval $ns {} namespace exists $ns namespace eval [list namespace exists $ns] The first [namespace exists] caches converts value "::foo" to the "nsName" Tcl_ObjType with a cached reference to the Namespace that name represents. Without this patch, that internal rep data is lost when [namespace eval] bytecode compiles the second [namespace exists] command, and the namespace has to be looked up from string value again. With this patch, the value $ns compiles directly into the bytecode, and when INST_INVOKE_STK1 executes the compiled [namespace exists] command, it gets the cached intrep data. This is just a simple example to illustrate the general principle that we ought to keep intreps if it's reasonably easy and there's not a reason not to. This principle has already proved its worth for TCL_EVAL_DIRECT compiles, and inspired lots of [list $cmd $arg] coding style out there. It's strange that the same style has not until now been supported in the bytecompiling branches. - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "47. Bytecode Compiler"
- title changed to: "direct compile of pure list scripts"
- type changed to: "RFE"