From 4a770ed0b5648f58f0ba0b07bb73cc904db339e0 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 25 May 2013 03:26:21 +0000 Subject: Repair some stack depth housekeeping. --- generic/tclCompCmds.c | 1 + generic/tclCompCmdsGR.c | 5 ----- generic/tclCompCmdsSZ.c | 2 +- generic/tclCompile.c | 2 +- 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. */ -- cgit v0.12