summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-12-09 17:55:00 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-12-09 17:55:00 (GMT)
commite699453c93c0d61c1571e533dd550088858bd10f (patch)
tree60dc975989dfb52bbb5f88537ac8cd427a8e4d6c /generic/tclExecute.c
parent284f9241b726a8693f5915c2e37abac122cc1a8a (diff)
downloadtcl-e699453c93c0d61c1571e533dd550088858bd10f.zip
tcl-e699453c93c0d61c1571e533dd550088858bd10f.tar.gz
tcl-e699453c93c0d61c1571e533dd550088858bd10f.tar.bz2
* generic/tclBasic.c: Insure correct lifetime of varFrame's
(objc,objv)for coroutines. * generic/tclExecute.c: Code regrouping
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 831b7c3..3fac4ea 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.457 2009/12/09 12:16:46 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.458 2009/12/09 17:55:01 msofer Exp $
*/
#include "tclInt.h"
@@ -2001,10 +2001,6 @@ TclExecuteByteCode(
auxObjList = NULL;
NR_DATA_INIT(); /* record this level's data */
- if (iPtr->execEnvPtr->corPtr && !iPtr->execEnvPtr->corPtr->stackLevel) {
- iPtr->execEnvPtr->corPtr->stackLevel = &TAUX;
- }
-
iPtr->execEnvPtr->bottomPtr = BP;
TAUX.esPtr = iPtr->execEnvPtr->execStackPtr;
@@ -2033,14 +2029,22 @@ TclExecuteByteCode(
bcFramePtr->cmd.str.len = 0;
if (iPtr->execEnvPtr->corPtr) {
- if (!iPtr->execEnvPtr->corPtr->base.cmdFramePtr) {
+ CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
+ if (!corPtr->base.cmdFramePtr) {
/*
- * First coroutine run, the base cmdFramePtr has not yet been
- * initialized. Do it now.
+ * First coroutine run, incomplete init:
+ * - base.cmdFramePtr not set
+ * - need to break the BP chain
*/
- iPtr->execEnvPtr->corPtr->base.cmdFramePtr = bcFramePtr;
+ corPtr->base.cmdFramePtr = bcFramePtr;
+ BP->prevBottomPtr = NULL;
}
+
+ if (!corPtr->stackLevel) {
+ corPtr->stackLevel = &TAUX;
+ }
+
if (iPtr->execEnvPtr->rewind) {
TRESULT = TCL_ERROR;
goto abnormalReturn;
@@ -2888,11 +2892,10 @@ TclExecuteByteCode(
}
/*
- * Save our state and return
+ * Mark suspended, save our state and return
*/
- corPtr->stackLevel = NULL; /* mark suspended */
-
+ corPtr->stackLevel = NULL;
iPtr->execEnvPtr = corPtr->callerEEPtr;
OBP = corPtr->callerBP;
goto returnToCaller;