summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmdsGR.c
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2013-06-11 20:38:00 (GMT)
committerdgp <dgp@noemail.net>2013-06-11 20:38:00 (GMT)
commit7d2be756e3a74aa4a7ad16d4cce5fb1142933824 (patch)
tree1ccd7d3634fc387a151f25f772012f52206e4774 /generic/tclCompCmdsGR.c
parent3ac8690ad09689b3d6f3c2041f04e2951b095605 (diff)
downloadtcl-7d2be756e3a74aa4a7ad16d4cce5fb1142933824.zip
tcl-7d2be756e3a74aa4a7ad16d4cce5fb1142933824.tar.gz
tcl-7d2be756e3a74aa4a7ad16d4cce5fb1142933824.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. FossilOrigin-Name: c438852c5f20effc175ab1ce1d61464b6d8f5f7d
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;