summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2001-12-11 14:29:39 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2001-12-11 14:29:39 (GMT)
commitdd1a92bd5aff575da91fd60c31a16bc6f8f16b68 (patch)
tree1e0d41feac520041a88004e8c9a568fafad25db3 /generic/tclCompExpr.c
parenta331ce2d727b1e7f577c49077938f7fb26f4d084 (diff)
downloadtcl-dd1a92bd5aff575da91fd60c31a16bc6f8f16b68.zip
tcl-dd1a92bd5aff575da91fd60c31a16bc6f8f16b68.tar.gz
tcl-dd1a92bd5aff575da91fd60c31a16bc6f8f16b68.tar.bz2
removed overestimates of necessary stack depth for bytecodes in the
fix for [Bug 483611].
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c15
1 files changed, 13 insertions, 2 deletions
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);
}