summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-01-19 14:06:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-01-19 14:06:09 (GMT)
commitb1e9c1d4b650fea5e60a10b7beaad0c893848982 (patch)
tree1d6d0da8a00a3f7253a77e3051f23d247d1fa15d /generic/tclCompile.c
parent04752af27c73732b84dc81b8f2284d5ca83e3962 (diff)
downloadtcl-b1e9c1d4b650fea5e60a10b7beaad0c893848982.zip
tcl-b1e9c1d4b650fea5e60a10b7beaad0c893848982.tar.gz
tcl-b1e9c1d4b650fea5e60a10b7beaad0c893848982.tar.bz2
More efficient issuing of INST_START_CMD instructions. See ChangeLog for discussion
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 0dcfb32..2964e46 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,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.c,v 1.105 2007/01/18 23:17:07 dkf Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.106 2007/01/19 14:06:09 dkf Exp $
*/
#include "tclInt.h"
@@ -854,6 +854,7 @@ TclInitCompileEnv(
envPtr->cmdMapPtr = envPtr->staticCmdMapSpace;
envPtr->cmdMapEnd = COMPILEENV_INIT_CMD_MAP_SIZE;
envPtr->mallocedCmdMap = 0;
+ envPtr->atCmdStart = 0;
/*
* TIP #280: Set up the extended command location information, based on
@@ -1124,7 +1125,7 @@ TclCompileScript(
Command *cmdPtr;
Tcl_Token *tokenPtr;
int bytesLeft, isFirstCmd, gotParse, wordIdx, currCmdIndex;
- int commandLength, objIndex, code;
+ int commandLength, objIndex;
Tcl_DString ds;
/* TIP #280 */
ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr;
@@ -1468,6 +1469,7 @@ TclCompileScript(
int savedNumCmds = envPtr->numCommands;
unsigned int savedCodeNext =
envPtr->codeNext - envPtr->codeStart;
+ int update = 0, code;
/*
* Mark the start of the command; the proper bytecode
@@ -1479,14 +1481,15 @@ TclCompileScript(
* (savedCodeNext == 0)
*/
- if (savedCodeNext != 0) {
+ if (savedCodeNext != 0 && !envPtr->atCmdStart) {
TclEmitInstInt4(INST_START_CMD, 0, envPtr);
+ update = 1;
}
code = (cmdPtr->compileProc)(interp, &parse, envPtr);
if (code == TCL_OK) {
- if (savedCodeNext != 0) {
+ if (update) {
/*
* Fix the bytecode length.
*/