summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmdsGR.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-06-11 20:38:00 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-06-11 20:38:00 (GMT)
commit9ca9c6da3a55c6358a221f006c6cc846bd8d9922 (patch)
tree1ccd7d3634fc387a151f25f772012f52206e4774 /generic/tclCompCmdsGR.c
parent236502157da38dfe3835d0daf426c2d2a0664160 (diff)
downloadtcl-9ca9c6da3a55c6358a221f006c6cc846bd8d9922.zip
tcl-9ca9c6da3a55c6358a221f006c6cc846bd8d9922.tar.gz
tcl-9ca9c6da3a55c6358a221f006c6cc846bd8d9922.tar.bz2
Select improvements in stack depth estimates brought over from mig-review.
Mostly these are just simplifications, removing code that wasn't needed. Some changes make the stack depth estimate more accurate instruction by instruction.
Diffstat (limited to 'generic/tclCompCmdsGR.c')
-rw-r--r--generic/tclCompCmdsGR.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 5e3d456..f7c15e6 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -142,10 +142,6 @@ TclCompileIfCmd(
int jumpIndex = 0; /* Avoid compiler warning. */
int jumpFalseDist, numWords, wordIdx, numBytes, j, code;
const char *word;
- int savedStackDepth = envPtr->currStackDepth;
- /* Saved stack depth at the start of the first
- * test; the envPtr current depth is restored
- * to this value at the start of each test. */
int realCond = 1; /* Set to 0 for static conditions:
* "if 0 {..}" */
int boolVal; /* Value of static condition. */
@@ -203,7 +199,6 @@ TclCompileIfCmd(
* the "then" part.
*/
- envPtr->currStackDepth = savedStackDepth;
testTokenPtr = tokenPtr;
if (realCond) {
@@ -270,7 +265,6 @@ TclCompileIfCmd(
if (compileScripts) {
SetLineInformation(wordIdx);
- envPtr->currStackDepth = savedStackDepth;
CompileBody(envPtr, tokenPtr, interp);
}
@@ -295,6 +289,7 @@ TclCompileIfCmd(
* with a 4 byte jump.
*/
+ TclAdjustStackDepth(-1, envPtr);
if (TclFixupForwardJumpToHere(envPtr,
jumpFalseFixupArray.fixup+jumpIndex, 120)) {
/*
@@ -325,13 +320,6 @@ TclCompileIfCmd(
}
/*
- * Restore the current stack depth in the environment; the "else" clause
- * (or its default) will add 1 to this.
- */
-
- envPtr->currStackDepth = savedStackDepth;
-
- /*
* Check for the optional else clause. Do not compile anything if this was
* an "if 1 {...}" case.
*/
@@ -416,7 +404,6 @@ TclCompileIfCmd(
*/
done:
- envPtr->currStackDepth = savedStackDepth + 1;
TclFreeJumpFixupArray(&jumpFalseFixupArray);
TclFreeJumpFixupArray(&jumpEndFixupArray);
return code;