diff options
-rw-r--r-- | ChangeLog | 34 | ||||
-rw-r--r-- | generic/tclCompile.c | 11 | ||||
-rw-r--r-- | generic/tclCompile.h | 19 |
3 files changed, 42 insertions, 22 deletions
@@ -1,3 +1,11 @@ +2007-01-19 Donal K. Fellows <donal.k.fellows@man.ac.uk> + + * generic/tclCompile.c (TclCompileScript): Reduce the frequency with + which we issue INST_START_CMD, making bytecode both more compact and + somewhat faster. The optimized case is where we would otherwise be + issuing a sequence of those instructions; in those cases, it is only + ever the first one encountered that could possibly trigger. + 2007-01-19 Joe Mistachkin <joe@mistachkin.com> * tools/man2tcl.c: Include stdlib.h for exit() and improve comment @@ -13,22 +21,22 @@ * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of OSSpinLock(Un)Lock API. - + * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running testsuite from Xcode. - + * tests/env.test: add extra system env vars that need to be preserved on some Mac OS X versions for testsuite to work. - * unix/Makefile.in: move libtommath defines into configure.in to avoid - * unix/configure.in: replicating them across multiple buildsystems. - * macosx/Tcl.xcodeproj/project.pbxproj: + * unix/Makefile.in: Move libtommath defines into configure.in to + * unix/configure.in: avoid replicating them across multiple + * macosx/Tcl.xcodeproj/project.pbxproj: buildsystems. * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] - (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when - present in CFLAGS to avoid discrepancies between what headers configure - sees during preprocessing tests and compiling tests. + (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS + when present in CFLAGS to avoid discrepancies between what headers + configure sees during preprocessing tests and compiling tests. * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59 @@ -48,15 +56,15 @@ 2007-01-11 Joe English <jenglish@users.sourceforge.net> - * win/tcl.m4(CFLAGS_WARNING): Remove "-Wconversion". - This was removed from unix/tcl.m4 2004-07-16 but not from here. + * win/tcl.m4(CFLAGS_WARNING): Remove "-Wconversion". This was removed + from unix/tcl.m4 2004-07-16 but not from here. * win/configure: Regenerated. 2007-01-11 Pat Thoyts <patthoyts@users.sourceforge.net> - * win/makefile.vc: Fixes to work better on Win98. Read version - * win/nmakehlp.c: numbers from package index file to avoid - * win/rules.vc: keeping numbers in the makefile. + * win/makefile.vc: Fixes to work better on Win98. Read version numbers + * win/nmakehlp.c: from package index file to avoid keeping numbers in + * win/rules.vc: the makefile where they may become de-synchronized. 2007-01-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk> 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. */ diff --git a/generic/tclCompile.h b/generic/tclCompile.h index a99f501..cba0888 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -8,7 +8,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.67 2006/12/13 16:28:06 dkf Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.68 2007/01/19 14:06:10 dkf Exp $ */ #ifndef _TCLCOMPILATION @@ -281,11 +281,15 @@ typedef struct CompileEnv { AuxData staticAuxDataArraySpace[COMPILEENV_INIT_AUX_DATA_SIZE]; /* Initial storage for aux data array. */ /* TIP #280 */ - ExtCmdLoc* extCmdMapPtr; /* Extended command location information + ExtCmdLoc *extCmdMapPtr; /* Extended command location information * for 'info frame'. */ - int line; /* First line of the script, based on the + int line; /* First line of the script, based on the * invoking context, then the line of the * command currently compiled. */ + int atCmdStart; /* Flag to say whether an INST_START_CMD + * should be issued; they should never be + * issued repeatedly, as that is significantly + * inefficient. */ } CompileEnv; /* @@ -957,9 +961,11 @@ MODULE_SCOPE int TclWordSimpleExpansion(Tcl_Token *tokenPtr); */ #define TclEmitOpcode(op, envPtr) \ - if ((envPtr)->codeNext == (envPtr)->codeEnd) \ + if ((envPtr)->codeNext == (envPtr)->codeEnd) { \ TclExpandCodeArray(envPtr); \ + } \ *(envPtr)->codeNext++ = (unsigned char) (op);\ + (envPtr)->atCmdStart = ((op) == INST_START_CMD); \ TclUpdateStackReqs(op, 0, envPtr) /* @@ -971,8 +977,9 @@ MODULE_SCOPE int TclWordSimpleExpansion(Tcl_Token *tokenPtr); */ #define TclEmitInt1(i, envPtr) \ - if ((envPtr)->codeNext == (envPtr)->codeEnd) \ + if ((envPtr)->codeNext == (envPtr)->codeEnd) { \ TclExpandCodeArray(envPtr); \ + } \ *(envPtr)->codeNext++ = (unsigned char) ((unsigned int) (i)) #define TclEmitInt4(i, envPtr) \ @@ -1004,6 +1011,7 @@ MODULE_SCOPE int TclWordSimpleExpansion(Tcl_Token *tokenPtr); } \ *(envPtr)->codeNext++ = (unsigned char) (op); \ *(envPtr)->codeNext++ = (unsigned char) ((unsigned int) (i));\ + (envPtr)->atCmdStart = ((op) == INST_START_CMD); \ TclUpdateStackReqs(op, i, envPtr) #define TclEmitInstInt4(op, i, envPtr) \ @@ -1019,6 +1027,7 @@ MODULE_SCOPE int TclWordSimpleExpansion(Tcl_Token *tokenPtr); (unsigned char) ((unsigned int) (i) >> 8); \ *(envPtr)->codeNext++ = \ (unsigned char) ((unsigned int) (i) );\ + (envPtr)->atCmdStart = ((op) == INST_START_CMD); \ TclUpdateStackReqs(op, i, envPtr) /* |