Tcl Source Code

Artifact [171462a904]
Login

Artifact 171462a90496c43a375089b7b501a8635a7126e3:

Attachment "README" to ticket [519535ffff] added by msofer 2002-02-19 03:41:49.
This is a very rough/experimental patch! 


I - Changes in this patch:

   * Incorporation of new functions with signature
      Tcl_Obj * TclCoreFun (Tcl_Interp *interp, int objc, 
           Tcl_Obj *CONST objv[], int argc, ClientData *argv);

     These will implement the core functionality of Tcl; the standard
     calls act as front ends for them.

     The usage is to allow receiving pointers to C structures that are
     determined at proc-compile time - for example, to variables.

   * Modification of the main variable access functions in tclVar.c to
     follow this structure. Factoring out TclLookupVar.

   * Definition of new instructions to
       - lookup variable pointers given their index (locals) or name
       - push non-Tcl_Obj items on the Tcl stack
       - call a TclCoreFun

   * test trial: [gets] is compiled using these interfaces, with a 20% 
     speed gain in the benchmarks:

     000 VERSIONS:                           patched    HEAD
     001 READ 595K, gets                      136482  175674
     006 READ 3050b, gets                        742     953
     011 READ bin 595K, gets                  145248  183942
     016 READ bin 3050b, gets                    803    1007


II - Notes:

   * INST_GET_SCALAR, INST_SET_SCALAR, INST_INCR_SCALAR and
     INST_FOREACH were changed to use directly the core functions
     instead of going through the interface.

   * the (incr) functions' interaction with the new 64bit patch has to
     be thought out; as is here, it will probably bomb - the patch
     assumes that you can store a "long" in a "ClientData"

   * all hope of portability of the compiled code is gone, as it uses
     pointers. A new save/load facility for compiled code has to be
     thought out; it can be implemented via stubs tables.

III - Outlook:

   * The details need some working out; however, it is conceivable
     that the new engine will only address variables through a
     combination of (INST_LOOKUP, INST_CALL_CFUN).

   * This opens the path for compiling all instructions, performing
     sub-command selection at compile time, and many other opts.