Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 394c11458808c3cb691eb4423d47ab5d34950b7b
Ticket: 1661637fffffffffffffffffffffffffffffffff
direct compile of pure list scripts
User & Date: dgp on 2007-02-16 16:09:00
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. 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.
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "dgp"
  10. subsystem changed to: "47. Bytecode Compiler"
  11. title changed to: "direct compile of pure list scripts"
  12. type changed to: "RFE"