summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c11
-rw-r--r--generic/tclCompExpr.c15
2 files changed, 22 insertions, 4 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c94aeff..5ed7be0 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.17 2001/12/10 15:44:34 msofer Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.18 2001/12/11 14:29:40 msofer Exp $
*/
#include "tclInt.h"
@@ -1808,7 +1808,14 @@ TclCompileLindexCmd(interp, parsePtr, envPtr)
if ( numWords == 3 ) {
TclEmitOpcode( INST_LIST_INDEX, envPtr );
} else {
- TclEmitInstInt4( INST_LIST_INDEX_MULTI, numWords-2, envPtr );
+ /*
+ * envPtr->currStackDepth has to be updated, as this instruction
+ * does not conform to the convention that its stack balance is
+ * (1-opnd): it is actually one less (-opnd).
+ */
+
+ TclEmitInstInt4( INST_LIST_INDEX_MULTI, numWords-2, envPtr );
+ envPtr->currStackDepth--;
}
return TCL_OK;
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index bae0a90..8db30b2 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.7 2001/12/10 15:44:34 msofer Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.8 2001/12/11 14:29:40 msofer Exp $
*/
#include "tclInt.h"
@@ -967,8 +967,19 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr)
*/
if (mathFuncPtr->builtinFuncIndex >= 0) { /* a builtin function */
- TclEmitInstInt1(INST_CALL_BUILTIN_FUNC1,
+ /*
+ * Adjust the current stack depth by the number of arguments
+ * of the builtin function. This cannot be handled by the
+ * TclEmitInstInt1 macro as the number of arguments is not
+ * passed as an operand.
+ */
+
+ if (envPtr->maxStackDepth < envPtr->currStackDepth) {
+ envPtr->maxStackDepth = envPtr->currStackDepth;
+ }
+ TclEmitInstInt1(INST_CALL_BUILTIN_FUNC1,
mathFuncPtr->builtinFuncIndex, envPtr);
+ envPtr->currStackDepth -= mathFuncPtr->numArgs;
} else {
TclEmitInstInt1(INST_CALL_FUNC1, (mathFuncPtr->numArgs+1), envPtr);
}