summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-05-25 03:26:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-05-25 03:26:21 (GMT)
commit4a770ed0b5648f58f0ba0b07bb73cc904db339e0 (patch)
tree19f60fc1987887d4da8890f83d68528b3bb2675c
parent44c1eaa96ca8158ccbb3acddb45eadfadfb9f07a (diff)
downloadtcl-4a770ed0b5648f58f0ba0b07bb73cc904db339e0.zip
tcl-4a770ed0b5648f58f0ba0b07bb73cc904db339e0.tar.gz
tcl-4a770ed0b5648f58f0ba0b07bb73cc904db339e0.tar.bz2
Repair some stack depth housekeeping.
-rw-r--r--generic/tclCompCmds.c1
-rw-r--r--generic/tclCompCmdsGR.c5
-rw-r--r--generic/tclCompCmdsSZ.c2
-rw-r--r--generic/tclCompile.c2
4 files changed, 3 insertions, 7 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 5a5cd88..8c88649 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -1329,6 +1329,7 @@ TclCompileDictMergeCmd(
TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr);
TclEmitInt4( infoIndex, envPtr);
TclEmitOpcode( INST_RETURN_STK, envPtr);
+ TclAdjustStackDepth(-1, envPtr);
return TCL_OK;
}
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 13b874e..c6a01e7 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -2375,7 +2375,6 @@ TclCompileReturnCmd(
int numWords = parsePtr->numWords;
int explicitResult = (0 == (numWords % 2));
int numOptionWords = numWords - 1 - explicitResult;
- int savedStackDepth = envPtr->currStackDepth;
Tcl_Obj *returnOpts, **objv;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
DefineLineInformation; /* TIP #280 */
@@ -2398,7 +2397,6 @@ TclCompileReturnCmd(
CompileWord(envPtr, optsTokenPtr, interp, 2);
CompileWord(envPtr, msgTokenPtr, interp, 3);
TclEmitOpcode(INST_RETURN_STK, envPtr);
- envPtr->currStackDepth = savedStackDepth + 1;
return TCL_OK;
}
@@ -2494,7 +2492,6 @@ TclCompileReturnCmd(
Tcl_DecrRefCount(returnOpts);
TclEmitOpcode(INST_DONE, envPtr);
- envPtr->currStackDepth = savedStackDepth;
return TCL_OK;
}
}
@@ -2512,7 +2509,6 @@ TclCompileReturnCmd(
*/
CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts);
- envPtr->currStackDepth = savedStackDepth + 1;
return TCL_OK;
issueRuntimeReturn:
@@ -2542,7 +2538,6 @@ TclCompileReturnCmd(
*/
TclEmitOpcode(INST_RETURN_STK, envPtr);
- envPtr->currStackDepth = savedStackDepth + 1;
return TCL_OK;
}
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 7ce51b6..f2017f0 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -938,7 +938,7 @@ TclSubstCompile(
* that is too low. Here we manually fix that up.
*/
- TclAdjustStackDepth(5, envPtr);
+ TclAdjustStackDepth(4, envPtr);
/* OK destination */
if (TclFixupForwardJumpToHere(envPtr, &okFixup, 127)) {
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index cdaf985..87e620c 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -310,7 +310,7 @@ InstructionDesc const tclInstructionTable[] = {
{"pushReturnOpts", 1, +1, 0, {OPERAND_NONE}},
/* Push the interpreter's return option dictionary as an object on the
* stack. */
- {"returnStk", 1, -2, 0, {OPERAND_NONE}},
+ {"returnStk", 1, -1, 0, {OPERAND_NONE}},
/* Compiled [return]; options and result are on the stack, code and
* level are in the options. */