diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclBasic.c | 24 | ||||
-rw-r--r-- | generic/tclExecute.c | 18 |
3 files changed, 16 insertions, 31 deletions
@@ -1,3 +1,8 @@ +2009-12-10 Miguel Sofer <msofer@users.sf.net> + + * generic/tclBasic.c: Reducing the # of moving parts for + * generic/tclExecute.c: coroutines + 2009-12-09 Andreas Kupries <andreask@activestate.com> * generic/tclIO.c: [Bug 2901998]: Applied Alexandre Ferrieux's 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; } |