summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-12-10 16:54:00 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-12-10 16:54:00 (GMT)
commit5d16655f0b3f57cc706cdc882ed7d0d5edd9c14b (patch)
tree3468a33458205a5cefa3cf3a41d02627d7a6439d /generic
parentb3dcb75ee899428c0b1fae1ae3ddc2770030792b (diff)
downloadtcl-5d16655f0b3f57cc706cdc882ed7d0d5edd9c14b.zip
tcl-5d16655f0b3f57cc706cdc882ed7d0d5edd9c14b.tar.gz
tcl-5d16655f0b3f57cc706cdc882ed7d0d5edd9c14b.tar.bz2
* generic/tclBasic.c: Reducing the # of moving parts for
* generic/tclExecute.c: coroutines
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c24
-rw-r--r--generic/tclExecute.c18
2 files changed, 11 insertions, 31 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 75e896a..550aaf9 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.424 2009/12/09 17:57:03 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.425 2009/12/10 16:54:01 msofer Exp $
*/
#include "tclInt.h"
@@ -8401,7 +8401,6 @@ static int NRInterpCoroutine(ClientData clientData,
Tcl_Obj *const objv[]);
static int RewindCoroutine(CoroutineData *corPtr, int result);
static void DeleteCoroutine(ClientData clientData);
-static void PlugCoroutineChains(CoroutineData *corPtr);
static int NRCoroutineExitCallback(ClientData data[],
Tcl_Interp *interp, int result);
@@ -8578,26 +8577,6 @@ DeleteCoroutine(
}
}
-static void
-PlugCoroutineChains(
- CoroutineData *corPtr)
-{
- /*
- * Called to plug the coroutine's running environment into the caller's,
- * so that the frame chains are uninterrupted. Note that the levels and
- * numlevels may be wrong - we should fix them for the whole chain and not
- * just the base! This probably breaks Tip 280 and should be fixed, or at
- * least rethought as some of 280's functionality makes doubtful sense in
- * presence of coroutines (maybe the cmdFrame should be attached to the
- * execEnv and not the interp?)
- */
-
- corPtr->base.framePtr->callerPtr = corPtr->caller.framePtr;
- corPtr->base.framePtr->callerVarPtr = corPtr->caller.varFramePtr;
-
- corPtr->base.cmdFramePtr->nextPtr = corPtr->caller.cmdFramePtr;
-}
-
static int
NRCoroutineCallerCallback(
ClientData data[],
@@ -8738,7 +8717,6 @@ NRInterpCoroutine(
SAVE_CONTEXT(corPtr->caller);
RESTORE_CONTEXT(corPtr->running);
- PlugCoroutineChains(corPtr);
corPtr->auxNumLevels = iPtr->numLevels;
iPtr->numLevels += nestNumLevels;
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 3fac4ea..9597075 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.458 2009/12/09 17:55:01 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.459 2009/12/10 16:54:01 msofer Exp $
*/
#include "tclInt.h"
@@ -1972,20 +1972,21 @@ TclExecuteByteCode(
* execution stack is large enough to execute this ByteCode.
*/
- if (!codePtr) {
resumeCoroutine:
+ if (!codePtr) {
+ CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
/*
* Reawakening a suspended coroutine: the [yield] command is
* returning.
*/
- NRE_ASSERT(iPtr->execEnvPtr->corPtr->eePtr == iPtr->execEnvPtr);
- NRE_ASSERT(iPtr->execEnvPtr->corPtr != NULL);
- NRE_ASSERT(iPtr->execEnvPtr->corPtr->eePtr == iPtr->execEnvPtr);
- NRE_ASSERT(COR_IS_SUSPENDED(iPtr->execEnvPtr->corPtr));
+ NRE_ASSERT(corPtr != NULL);
+ NRE_ASSERT(corPtr->eePtr == iPtr->execEnvPtr);
+ NRE_ASSERT(COR_IS_SUSPENDED(corPtr));
OBP = iPtr->execEnvPtr->bottomPtr;
- iPtr->execEnvPtr->corPtr->stackLevel = &TAUX;
+ corPtr->stackLevel = &TAUX;
+ corPtr->base.cmdFramePtr->nextPtr = corPtr->caller.cmdFramePtr;
if (iPtr->execEnvPtr->rewind) {
TRESULT = TCL_ERROR;
}
@@ -2835,7 +2836,8 @@ TclExecuteByteCode(
goto nonRecursiveCallStart;
} else {
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
-
+
+ codePtr = NULL;
corPtr->callerBP = BP;
goto resumeCoroutine;
}