diff options
author | andreas_kupries <andreas_kupries@noemail.net> | 2009-07-14 16:34:07 (GMT) |
---|---|---|
committer | andreas_kupries <andreas_kupries@noemail.net> | 2009-07-14 16:34:07 (GMT) |
commit | bd8297afb7fae802f6e3494da6cef786bd7706ff (patch) | |
tree | 96331345b305a3ee61ad9c1dfa7f37983ab71540 /generic/tclCompile.h | |
parent | 381b6433a8a41ee689e336fee820401440ac60b1 (diff) | |
download | tcl-bd8297afb7fae802f6e3494da6cef786bd7706ff.zip tcl-bd8297afb7fae802f6e3494da6cef786bd7706ff.tar.gz tcl-bd8297afb7fae802f6e3494da6cef786bd7706ff.tar.bz2 |
* generic/tclCompile.c (TclInitCompileEnv, EnterCmdWordIndex,
TclCleanupByteCode, TclCompileScript):
* generic/tclExecute.c (TclCompileObj, TclExecuteByteCode):
* tclCompile.h (ExtCmdLoc):
* tclInt.h (ExtIndex, CFWordBC, CmdFrame):
* tclBasic.c (DeleteInterpProc, TclArgumentBCEnter,
TclArgumentBCRelease, TclArgumentGet, SAVE_CONTEXT,
RESTORE_CONTEXT, NRCoroutineExitCallback, TclNRCoroutineObjCmd):
* generic/tclCmdAH.c (TclNRForObjCmd, TclNRForIterCallback,
ForNextCallback):
* generic/tclCmdMZ.c (TclNRWhileObjCmd):
Extended the bytecode compiler initialization to recognize the
compilation of whole files (NRE enabled 'source' command) and
switch to the counting of absolute lines in that case.
Further extended the bytecode compiler to track the start line in
the generated information, and modified the bytecode execution to
recompile an object if the location as per the calling context
doesn't match the location saved in the bytecode. This part could
be optimized more by using more memory to keep all possibilities
which occur around, or by just adjusting the location information
instead of a total recompile.
Reworked the handling of literal command arguments in bytecode to
be saved (compiler) and used (execution) per command (See the
TCL_INVOKE_STK* instructions), and not per the whole bytecode.
This, and the previous change remove the problems with location
data caused by literal sharing (across whole files, but also proc
bodies). Simplified the associated datastructures (ExtIndex is
gone, as is the function EnterCmdWordIndex).
The last change causes the hashtable 'lineLABCPtr' to be state
which has to be kept per coroutine, like the CmdFrame stack.
Reworked the coroutine support code to create, delete and switch
the information as needed. Further reworked the tailcall command
as well, it has to pop its own arguments when run in a bytecode
context to keep a proper stack in 'lineLABCPtr'.
Fixed the mishandling of line information in the NRE-enabled 'for'
and 'while' commands introduced when both were made to share their
iteration callbacks without taking into account that the loop body
is found in different words of the command. Introduced a separate
data structure to hold all the callback information, as we went
over the limit of 4 direct client-data values for NRE callbacks.
The above fixes [Bug 1605269].
FossilOrigin-Name: 7c711348014e77992c5d94d267a21f0d2c057c81
Diffstat (limited to 'generic/tclCompile.h')
-rw-r--r-- | generic/tclCompile.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/generic/tclCompile.h b/generic/tclCompile.h index a9b8545..75dc236 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.h,v 1.116 2009/05/08 01:02:26 msofer Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.117 2009/07/14 16:34:08 andreas_kupries Exp $ */ #ifndef _TCLCOMPILATION @@ -134,18 +134,23 @@ typedef struct ECL { * command. */ } ECL; -/* ExtIndex defined in tclInt.h */ - typedef struct ExtCmdLoc { int type; /* Context type. */ + int start; /* Starting line for compiled script. Needed + * for the extended recompile check in + * tclCompileObj. */ Tcl_Obj *path; /* Path of the sourced file the command is * in. */ ECL *loc; /* Command word locations (lines). */ int nloc; /* Number of allocated entries in 'loc'. */ int nuloc; /* Number of used entries in 'loc'. */ - ExtIndex* eiloc; - int neiloc; - int nueiloc; + Tcl_HashTable litInfo; /* Indexed by bytecode 'PC', to have the + * information accessible per command and + * argument, not per whole bytecode. Value is + * index of command in 'loc', giving us the + * literals to associate with line information + * as command argument, see + * TclArgumentBCEnter() */ } ExtCmdLoc; /* |