summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-05-08 01:02:26 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-05-08 01:02:26 (GMT)
commit7592bff0075283d77566536c9bea32df7073e73d (patch)
tree3cdc92382395a57ab68cc6fdb3b197d39dc8000d /generic
parent33fd9238dc467ef70e757a917e4c8ddd2dd7d78e (diff)
downloadtcl-7592bff0075283d77566536c9bea32df7073e73d.zip
tcl-7592bff0075283d77566536c9bea32df7073e73d.tar.gz
tcl-7592bff0075283d77566536c9bea32df7073e73d.tar.bz2
* generic/tclBasic.c: Let coroutines start with a much smaller
* generic/tclCompile.h: stack: 200 words (previously was 2000, * generic/tclExecute.c: the same as interps)
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c11
-rw-r--r--generic/tclCompile.h4
-rw-r--r--generic/tclExecute.c13
3 files changed, 16 insertions, 12 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index d5aad5d..41e3824 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -16,7 +16,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.392 2009/04/30 23:25:32 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.393 2009/05/08 01:02:26 msofer Exp $
*/
#include "tclInt.h"
@@ -31,6 +31,11 @@
#include <assert.h>
#endif
+
+#define INTERP_STACK_INITIAL_SIZE 2000
+#define CORO_STACK_INITIAL_SIZE 200
+
+
/*
* Determine whether we're using IEEE floating point
*/
@@ -608,7 +613,7 @@ Tcl_CreateInterp(void)
* variable).
*/
- iPtr->execEnvPtr = TclCreateExecEnv(interp);
+ iPtr->execEnvPtr = TclCreateExecEnv(interp, INTERP_STACK_INITIAL_SIZE);
/*
* TIP #219, Tcl Channel Reflection API support.
@@ -8479,7 +8484,7 @@ TclNRCoroutineObjCmd(
}
corPtr = (CoroutineData *) ckalloc(sizeof(CoroutineData));
- corPtr->eePtr = TclCreateExecEnv(interp);
+ corPtr->eePtr = TclCreateExecEnv(interp, CORO_STACK_INITIAL_SIZE);
corPtr->callerEEPtr = iPtr->execEnvPtr;
corPtr->eePtr->corPtr = corPtr;
corPtr->stackLevel = NULL;
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index fb5bdb9..a9b8545 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -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: tclCompile.h,v 1.115 2009/02/27 23:03:42 nijtmans Exp $
+ * RCS: @(#) $Id: tclCompile.h,v 1.116 2009/05/08 01:02:26 msofer Exp $
*/
#ifndef _TCLCOMPILATION
@@ -882,7 +882,7 @@ MODULE_SCOPE int TclCreateAuxData(ClientData clientData,
const AuxDataType *typePtr, CompileEnv *envPtr);
MODULE_SCOPE int TclCreateExceptRange(ExceptionRangeType type,
CompileEnv *envPtr);
-MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp);
+MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, int size);
MODULE_SCOPE Tcl_Obj * TclCreateLiteral(Interp *iPtr, char *bytes,
int length, unsigned int hash, int *newPtr,
Namespace *nsPtr, int flags,
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index a30c46e..e6eff03 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.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: tclExecute.c,v 1.434 2009/05/06 20:16:17 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.435 2009/05/08 01:02:26 msofer Exp $
*/
#include "tclInt.h"
@@ -788,16 +788,16 @@ InitByteCodeExecution(
*----------------------------------------------------------------------
*/
-#define TCL_STACK_INITIAL_SIZE 2000
-
ExecEnv *
TclCreateExecEnv(
- Tcl_Interp *interp) /* Interpreter for which the execution
+ Tcl_Interp *interp, /* Interpreter for which the execution
* environment is being created. */
+ int size) /* the initial stack size, in number of words
+ * [sizeof(Tcl_Obj*)] */
{
ExecEnv *eePtr = (ExecEnv *) ckalloc(sizeof(ExecEnv));
ExecStack *esPtr = (ExecStack *) ckalloc(sizeof(ExecStack)
- + (size_t) (TCL_STACK_INITIAL_SIZE-1) * sizeof(Tcl_Obj *));
+ + (size_t) (size-1) * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
TclNewBooleanObj(eePtr->constants[0], 0);
@@ -813,7 +813,7 @@ TclCreateExecEnv(
esPtr->prevPtr = NULL;
esPtr->nextPtr = NULL;
esPtr->markerPtr = NULL;
- esPtr->endPtr = &esPtr->stackWords[TCL_STACK_INITIAL_SIZE-1];
+ esPtr->endPtr = &esPtr->stackWords[size-1];
esPtr->tosPtr = &esPtr->stackWords[-1];
Tcl_MutexLock(&execMutex);
@@ -826,7 +826,6 @@ TclCreateExecEnv(
return eePtr;
}
-#undef TCL_STACK_INITIAL_SIZE
/*
*----------------------------------------------------------------------