From 5e126fd43fcba3e54f62f4e92afb95fcf492e683 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Thu, 10 Dec 2009 17:48:39 +0000 Subject: * generic/tclBasic.c: Reducing the # of moving parts for * generic/tclExecute.c: coroutines by delegating more to tebc; eliminate the special coroutine CallFrame. --- ChangeLog | 3 ++- generic/tclBasic.c | 27 +++------------------------ generic/tclExecute.c | 3 ++- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3719dbb..894fbd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2009-12-10 Miguel Sofer * generic/tclBasic.c: Reducing the # of moving parts for - * generic/tclExecute.c: coroutines + * generic/tclExecute.c: coroutines by delegating more to tebc; + eliminate the special coroutine CallFrame. 2009-12-09 Andreas Kupries diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 550aaf9..aa1e26b 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.425 2009/12/10 16:54:01 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.426 2009/12/10 17:48:39 msofer Exp $ */ #include "tclInt.h" @@ -8630,7 +8630,6 @@ NRCoroutineExitCallback( int result) { CoroutineData *corPtr = data[0]; - Tcl_Obj *arglistPtr = data[1]; Command *cmdPtr = corPtr->cmdPtr; /* @@ -8645,10 +8644,6 @@ NRCoroutineExitCallback( NRE_ASSERT(!COR_IS_SUSPENDED(corPtr)); NRE_ASSERT((corPtr->callerEEPtr->callbackPtr->procPtr == NRCoroutineCallerCallback)); - NRE_ASSERT(iPtr->framePtr->compiledLocals == NULL); - TclPopStackFrame(interp); - Tcl_DecrRefCount(arglistPtr); - cmdPtr->deleteProc = NULL; Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr); TclCleanupCommandMacro(cmdPtr); @@ -8742,13 +8737,11 @@ TclNRCoroutineObjCmd( Command *cmdPtr; CoroutineData *corPtr; Tcl_Obj *cmdObjPtr; - CallFrame *framePtr, **framePtrPtr; TEOV_callback *rootPtr = TOP_CB(interp); const char *fullName; const char *procName; Namespace *nsPtr, *altNsPtr, *cxtNsPtr; Tcl_DString ds; - Tcl_Obj *arglistPtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "name cmd ?arg ...?"); @@ -8826,19 +8819,6 @@ TclNRCoroutineObjCmd( iPtr->execEnvPtr = corPtr->eePtr; - framePtrPtr = &framePtr; - if (TCL_OK != TclPushStackFrame(interp, (Tcl_CallFrame **) framePtrPtr, - NULL, 0)) { - corPtr->eePtr->corPtr = NULL; - TclDeleteExecEnv(corPtr->eePtr); - ckfree((char *) corPtr); - return TCL_ERROR; - } - arglistPtr = Tcl_NewListObj(objc-2, &objv[2]); - Tcl_IncrRefCount(arglistPtr); - Tcl_ListObjGetElements(interp, arglistPtr, &framePtr->objc, - &framePtr->objv); - /* * Save the base context. The base cmdFramePtr is unknown at this time: it * will be allocated in the Tcl stack. So signal TEBC that it has to @@ -8899,12 +8879,11 @@ TclNRCoroutineObjCmd( * the cleaner "proc is a named lambda" to do this properly. */ - iPtr->varFramePtr = iPtr->rootFramePtr; iPtr->lookupNsPtr = iPtr->framePtr->nsPtr; corPtr->auxNumLevels = iPtr->numLevels; - TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, arglistPtr, - NULL,NULL); + TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, + NULL, NULL, NULL); iPtr->evalFlags |= TCL_EVAL_REDIRECT; TclNREvalObjEx(interp, cmdObjPtr, 0, NULL, 0); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 9597075..28fab46 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.459 2009/12/10 16:54:01 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.460 2009/12/10 17:48:39 msofer Exp $ */ #include "tclInt.h" @@ -2040,6 +2040,7 @@ TclExecuteByteCode( corPtr->base.cmdFramePtr = bcFramePtr; BP->prevBottomPtr = NULL; + iPtr->varFramePtr->callerPtr = iPtr->rootFramePtr; } if (!corPtr->stackLevel) { -- cgit v0.12