summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-12-18 14:02:43 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-12-18 14:02:43 (GMT)
commit3515f81d8cea51544e1ef5949175795ca8ffa35f (patch)
tree4edd1194a441f8c5533744f7af5d390c008b0dd4
parentf676347d4bf615c3cbf2bf40e3bd472a854f7944 (diff)
parentee58f2d325a281f03cf6669e8d7ae2c377a5af2d (diff)
downloadtcl-3515f81d8cea51544e1ef5949175795ca8ffa35f.zip
tcl-3515f81d8cea51544e1ef5949175795ca8ffa35f.tar.gz
tcl-3515f81d8cea51544e1ef5949175795ca8ffa35f.tar.bz2
Improved the sequence of instructions issued for [subst] when dealing with
simple variable references.
-rw-r--r--ChangeLog17
-rw-r--r--generic/tclCompCmdsSZ.c28
2 files changed, 39 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 13fcaf8..6104af0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,19 @@
+2012-12-18 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclCompCmdsSZ.c (TclSubstCompile): Improved the sequence of
+ instructions issued for [subst] when dealing with simple variable
+ references.
+
2012-11-13 Miguel Sofer <msofer@users.sf.net>
- * generic/tclCmdAH.c (CatchObjCmdCallback): do not decrRefCount
- the newValuePtr sent to Tcl_ObjSetVar2: TOSV2 is 'fire and
- forget', it decrs on its own. Fix for [Bug 3595576], found by
- andrewsh.
+ * generic/tclCmdAH.c (CatchObjCmdCallback): Do not decrRefCount the
+ newValuePtr sent to Tcl_ObjSetVar2: TOSV2 is 'fire and forget', it
+ decrs on its own. Fix for [Bug 3595576], found by andrewsh.
2012-12-13 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tcl.h: Fix Tcl_DecrRefCount macro such that it
- doesn't access its objPtr parameter twice any more.
+ * generic/tcl.h: Fix Tcl_DecrRefCount macro such that it doesn't
+ access its objPtr parameter twice any more.
2012-12-10 Donal K. Fellows <dkf@users.sf.net>
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 9c93fb2..7bead0d 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -836,6 +836,34 @@ TclSubstCompile(
TclEmitPush(literal, envPtr);
count++;
continue;
+ case TCL_TOKEN_VARIABLE:
+ /*
+ * Check for simple variable access; see if we can only generate
+ * TCL_OK or TCL_ERROR from the substituted variable read; if so,
+ * there is no need to generate elaborate exception-management
+ * code. Note that the first component of TCL_TOKEN_VARIABLE is
+ * always TCL_TOKEN_TEXT...
+ */
+
+ if (tokenPtr->numComponents > 1) {
+ int i, foundCommand = 0;
+
+ for (i=2 ; i<=tokenPtr->numComponents ; i++) {
+ if (tokenPtr[i].type == TCL_TOKEN_COMMAND) {
+ foundCommand = 1;
+ break;
+ }
+ }
+ if (foundCommand) {
+ break;
+ }
+ }
+
+ envPtr->line = bline;
+ TclCompileVarSubst(interp, tokenPtr, envPtr);
+ bline = envPtr->line;
+ count++;
+ continue;
}
while (count > 255) {