summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-12-06 18:12:25 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-12-06 18:12:25 (GMT)
commit54bc7a4be035ab032c4311c97a7e2240fb08b0cd (patch)
treeea7e42167e177d0f7427ba36cff69c20fe35be60 /generic/tclExecute.c
parent3ae6f1e3cac2201928b801e657042f9dfc0cb481 (diff)
downloadtcl-54bc7a4be035ab032c4311c97a7e2240fb08b0cd.zip
tcl-54bc7a4be035ab032c4311c97a7e2240fb08b0cd.tar.gz
tcl-54bc7a4be035ab032c4311c97a7e2240fb08b0cd.tar.bz2
* generic/tclBasic.c: Small changes for clarity in tailcall
* generic/tclExecute.c: and coroutine code.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 404696c..6ad9043 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.448 2009/11/18 21:59:51 nijtmans Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.449 2009/12/06 18:12:26 msofer Exp $
*/
#include "tclInt.h"
@@ -1945,6 +1945,7 @@ TclExecuteByteCode(
int nested = 0;
if (!codePtr) {
+ resumeCoroutine:
/*
* Reawakening a suspended coroutine: the [yield] command
* is returning.
@@ -1989,6 +1990,9 @@ TclExecuteByteCode(
*/
codePtr = param;
+ if (!codePtr) {
+ goto resumeCoroutine;
+ }
break;
case TCL_NR_TAILCALL_TYPE: {
/*
@@ -2001,14 +2005,16 @@ TclExecuteByteCode(
}
#endif
if (catchTop != initCatchTop) {
- TclClearTailcall(interp, param);
+ TEOV_callback *tailcallPtr = iPtr->varFramePtr->tailcallPtr;
+
+ TclClearTailcall(interp, tailcallPtr);
+ iPtr->varFramePtr->tailcallPtr = NULL;
result = TCL_ERROR;
Tcl_SetResult(interp,"Tailcall called from within a catch environment",
TCL_STATIC);
pc--;
goto checkForCatch;
}
- iPtr->varFramePtr->tailcallPtr = param;
goto abnormalReturn;
}
case TCL_NR_YIELD_TYPE: { /*[yield] */
@@ -2036,15 +2042,12 @@ TclExecuteByteCode(
}
/*
- * Save our state, restore the caller's execEnv and return
+ * Save our state and return
*/
NR_DATA_BURY();
esPtr->tosPtr = tosPtr;
- corPtr->stackLevel = NULL; /* mark suspended */
iPtr->execEnvPtr->bottomPtr = bottomPtr;
-
- iPtr->execEnvPtr = corPtr->callerEEPtr;
return TCL_OK;
}
default: