diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2007-11-10 19:01:33 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2007-11-10 19:01:33 (GMT) |
commit | 1bb7bf057245c23fb001032ceb3df30a99b093ee (patch) | |
tree | ee3e9b6761d7863d8db6a9e00353b6f533742f04 /generic/tclBasic.c | |
parent | 9d4613e63ad9a84dc895ee578f5839138fc85dad (diff) | |
download | tcl-1bb7bf057245c23fb001032ceb3df30a99b093ee.zip tcl-1bb7bf057245c23fb001032ceb3df30a99b093ee.tar.gz tcl-1bb7bf057245c23fb001032ceb3df30a99b093ee.tar.bz2 |
* generic/tclBasic.c:
* generic/tclInt.h:
* unix/tclUnixInit.c:
* win/tclWin32Dll.c: restore simpler behaviour for stack checking,
not adaptive to stack size changes after a thread is
launched. Consensus is that "nobody does that", and so it is not
worth the cost.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 2684986..53cd4fd 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.273 2007/11/10 16:08:09 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.274 2007/11/10 19:01:34 msofer Exp $ */ #include "tclInt.h" @@ -338,15 +338,15 @@ static const OpCmdInfo mathOpCmds[] = { static int stackGrowsDown = 1; #define GetCStackParams(iPtr) \ - stackGrowsDown = TclpGetCStackParams(&((iPtr)->stackBoundPtr)) + stackGrowsDown = TclpGetCStackParams(&((iPtr)->stackBound)) -#define CheckStackSpace(iPtr, localIntPtr) \ +#define StackOverflow(iPtr, localIntPtr) \ (stackGrowsDown \ - ? ((localIntPtr) > *((iPtr)->stackBoundPtr)) \ - : ((localIntPtr) < *((iPtr)->stackBoundPtr)) \ + ? ((localIntPtr) < (iPtr)->stackBound) \ + : ((localIntPtr) > (iPtr)->stackBound) \ ) #else /* stack check disabled: make them noops */ -#define CheckStackSpace(interp, localIntPtr) 1 +#define StackOverflow(interp, localIntPtr) 0 #define GetCStackParams(iPtr) #endif @@ -3407,7 +3407,7 @@ int TclInterpReady( Tcl_Interp *interp) { - int localInt, stackOverflow; /* used for checking the stack */ + int localInt; /* used for checking the stack */ register Interp *iPtr = (Interp *) interp; /* @@ -3435,17 +3435,8 @@ TclInterpReady( * probably because of an infinite loop somewhere. */ - stackOverflow = !CheckStackSpace(iPtr, &localInt); - if (stackOverflow) { - /* - * Update the stack params in case the thread's stack was grown. - */ - - GetCStackParams(iPtr); - stackOverflow = !CheckStackSpace(iPtr, &localInt); - } - - if (stackOverflow || ((iPtr->numLevels) > iPtr->maxNestingDepth)) { + if (((iPtr->numLevels) > iPtr->maxNestingDepth) + || StackOverflow(iPtr, &localInt)) { Tcl_AppendResult(interp, "too many nested evaluations (infinite loop?)", NULL); return TCL_ERROR; |