summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-11-11 05:24:01 (GMT)
committerdas <das>2007-11-11 05:24:01 (GMT)
commitf78cde82f8d5f7c77db75ae891fe3a4ff5611fef (patch)
tree3615bd2231dfbd94da97bcea778d0ab89ac36e84
parentbbed48f843a3bbe1cd2df6a00c538d187b73370a (diff)
downloadtcl-f78cde82f8d5f7c77db75ae891fe3a4ff5611fef.zip
tcl-f78cde82f8d5f7c77db75ae891fe3a4ff5611fef.tar.gz
tcl-f78cde82f8d5f7c77db75ae891fe3a4ff5611fef.tar.bz2
* unix/tclUnixInit.c: simplify non-crosscompiled case.
-rw-r--r--ChangeLog12
-rw-r--r--unix/tclUnixInit.c24
2 files changed, 22 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 95afc48..da4110a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,18 +3,24 @@
* unix/tclUnixTime.c (TclpWideClicksToNanoseconds): fix issues with
* generic/tclInt.h: int64_t overflow.
+ * generic/tclBasic.c: fix stack check failure case if stack grows up.
+ * unix/tclUnixInit.c: simplify non-crosscompiled case.
+
+ * unix/configure: autoconf-2.59
+ * unix/tclConfig.h.in: autoheader-2.59
+
2007-11-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: fast path for INST_LIST_INDEX when the
index is not a list.
-
- * unix/configure: autoconf 2.61
-
+
* generic/tclBasic.c:
* unix/configure.in:
* unix/tclUnixInit.c: detect stack grwoth direction at compile
time, only fall to runtime detection when crosscompiling.
+ * unix/configure: autoconf 2.61
+
* generic/tclBasic.c:
* generic/tclInt.h:
* tests/interp.test:
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 9202c26..d45f722 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.78 2007/11/10 22:24:14 msofer Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.79 2007/11/11 05:24:02 das Exp $
*/
#include "tclInt.h"
@@ -85,9 +85,9 @@ static Tcl_ThreadDataKey dataKey;
static int stackGrowsDown = -1;
static int StackGrowsDown(int *parent);
#elif defined(TCL_STACK_GROWS_UP)
-static int stackGrowsDown = 0;
+#define stackGrowsDown 0
#else
-static int stackGrowsDown = 1;
+#define stackGrowsDown 1
#endif
#endif /* TCL_NO_STACK_CHECK */
@@ -1010,10 +1010,11 @@ TclpFindVariable(
return result;
}
+#ifndef TCL_NO_STACK_CHECK
/*
*----------------------------------------------------------------------
*
- * TclpGetStackParams --
+ * TclpGetCStackParams --
*
* Determine the stack params for the current thread: in which
* direction does the stack grow, and what is the stack lower (resp.
@@ -1030,7 +1031,6 @@ TclpFindVariable(
*----------------------------------------------------------------------
*/
-#ifndef TCL_NO_STACK_CHECK
int
TclpGetCStackParams(
int **stackBoundPtr)
@@ -1041,7 +1041,7 @@ TclpGetCStackParams(
/* Most variables are actually in a
* thread-specific data block to minimise the
* impact on the stack. */
-#ifdef TCL_CROSS_COMPILE
+#ifdef TCL_CROSS_COMPILE
if (stackGrowsDown == -1) {
/*
* Not initialised!
@@ -1061,14 +1061,17 @@ TclpGetCStackParams(
result = GetStackSize(&stackSize);
if (result != TCL_OK) {
/* Can't check, assume it always succeeds */
+#ifdef TCL_CROSS_COMPILE
stackGrowsDown = 1;
+#endif
tsdPtr->stackBound = NULL;
goto done;
}
}
- if (stackSize || (stackGrowsDown && (&result < tsdPtr->stackBound))
- || (!stackGrowsDown && (&result > tsdPtr->stackBound))) {
+ if (stackSize || (tsdPtr->stackBound &&
+ ((stackGrowsDown && (&result < tsdPtr->stackBound)) ||
+ (!stackGrowsDown && (&result > tsdPtr->stackBound))))) {
/*
* Either the thread's first pass or stack failure: set the params
*/
@@ -1081,7 +1084,9 @@ TclpGetCStackParams(
result = GetStackSize(&stackSize);
if (result != TCL_OK) {
/* Can't check, assume it always succeeds */
+#ifdef TCL_CROSS_COMPILE
stackGrowsDown = 1;
+#endif
tsdPtr->stackBound = NULL;
goto done;
}
@@ -1110,8 +1115,6 @@ StackGrowsDown(
return (&here < parent);
}
#endif
-#endif
-
/*
*----------------------------------------------------------------------
@@ -1136,7 +1139,6 @@ StackGrowsDown(
*----------------------------------------------------------------------
*/
-#ifndef TCL_NO_STACK_CHECK
static int
GetStackSize(
size_t *stackSizePtr)