summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-12-11 05:32:59 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-12-11 05:32:59 (GMT)
commit7e4c6f37909b4679e7ca70148d619d8059650581 (patch)
treeee616cde688298665ccd635f404788ec487ce283
parent11915ee6b5791aab49447d524ef382336aeec38d (diff)
downloadtcl-7e4c6f37909b4679e7ca70148d619d8059650581.zip
tcl-7e4c6f37909b4679e7ca70148d619d8059650581.tar.gz
tcl-7e4c6f37909b4679e7ca70148d619d8059650581.tar.bz2
code comments
-rw-r--r--ChangeLog1
-rw-r--r--generic/tclExecute.c28
2 files changed, 16 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ff54aa..8acc9a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+2009-12-11 Miguel Sofer <msofer@users.sf.net>
2009-12-10 Miguel Sofer <msofer@users.sf.net>
* generic/tclBasic.c: Full nre-enabling of coroutines
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index fdc2dc4..c88aa73 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.463 2009/12/11 04:47:13 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.464 2009/12/11 05:33:00 msofer Exp $
*/
#include "tclInt.h"
@@ -1978,7 +1978,11 @@ TclExecuteByteCode(
resumeCoroutine:
/*
* Reawakening a suspended coroutine: the [yield] command is
- * returning.
+ * returning:
+ * - monkey-patch the cmdFrame chain
+ * - set the running level of the coroutine
+ * - monkey-patch the BP chain
+ * - restart the code at [yield]'s return
*/
corPtr = iPtr->execEnvPtr->corPtr;
@@ -1987,15 +1991,14 @@ TclExecuteByteCode(
NRE_ASSERT(corPtr->eePtr == iPtr->execEnvPtr);
NRE_ASSERT(COR_IS_SUSPENDED(corPtr));
- *corPtr->callerBPPtr = OBP;
- OBP = iPtr->execEnvPtr->bottomPtr;
-
- corPtr->stackLevel = &TAUX;
- corPtr->base.cmdFramePtr->nextPtr = corPtr->caller.cmdFramePtr;
-
if (iPtr->execEnvPtr->rewind) {
TRESULT = TCL_ERROR;
}
+
+ corPtr->base.cmdFramePtr->nextPtr = corPtr->caller.cmdFramePtr;
+ corPtr->stackLevel = &TAUX;
+ *corPtr->callerBPPtr = OBP;
+ OBP = iPtr->execEnvPtr->bottomPtr;
goto returnToCaller;
}
@@ -2041,16 +2044,15 @@ TclExecuteByteCode(
/*
* First coroutine run, incomplete init:
* - base.cmdFramePtr not set
- * - need to break the BP chain
+ * - need to monkey-patch the BP chain
+ * - set the running level for the coroutine
+ * - insure that the coro runs in #0
*/
corPtr->base.cmdFramePtr = bcFramePtr;
- iPtr->varFramePtr = iPtr->rootFramePtr;
corPtr->callerBPPtr = &BP->prevBottomPtr;
- }
-
- if (!corPtr->stackLevel) {
corPtr->stackLevel = &TAUX;
+ iPtr->varFramePtr = iPtr->rootFramePtr;
}
if (iPtr->execEnvPtr->rewind) {