summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2009-12-06 20:35:38 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2009-12-06 20:35:38 (GMT)
commitfa22561193e48c63681c637db297f6808b80ce1a (patch)
tree06eda450bdbd56c35fa55ffddcc9e0ac45ee3b54 /generic/tclNamesp.c
parent39cc2a0e16b0e756662ae39eb7e7381535dc5b54 (diff)
downloadtcl-fa22561193e48c63681c637db297f6808b80ce1a.zip
tcl-fa22561193e48c63681c637db297f6808b80ce1a.tar.gz
tcl-fa22561193e48c63681c637db297f6808b80ce1a.tar.bz2
factoring TclSpliceTailcall out of TclPopStackFrame
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c47
1 files changed, 2 insertions, 45 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 99f3f1a..dbeb70d 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.196 2009/12/05 21:30:05 msofer Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.197 2009/12/06 20:35:41 msofer Exp $
*/
#include "tclInt.h"
@@ -510,50 +510,7 @@ Tcl_PopCallFrame(
framePtr->nsPtr = NULL;
if (framePtr->tailcallPtr) {
- /*
- * Find the splicing spot: right before the NRCommand of the thing
- * being tailcalled. Note that we skip NRCommands marked in data[1]
- * (used by command redirectors)
- */
-
- TEOV_callback *tailcallPtr, *runPtr;
- ExecEnv *eePtr = NULL;
-
-
- restart:
- for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) {
- if (((runPtr->procPtr) == NRCommand) && !runPtr->data[1]) {
- break;
- }
- }
- if (!runPtr) {
- /*
- * If we are tailcalling out of a coroutine, the splicing spot is
- * in the caller's execEnv: go find it!
- */
-
- CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
- if (corPtr) {
- eePtr = iPtr->execEnvPtr;
- iPtr->execEnvPtr = corPtr->callerEEPtr;
- goto restart;
- }
- Tcl_Panic("Tailcall cannot find the right splicing spot: should not happen!");
- }
-
- tailcallPtr = framePtr->tailcallPtr;
-
- tailcallPtr->nextPtr = runPtr->nextPtr;
- runPtr->nextPtr = tailcallPtr;
-
- if (eePtr) {
- /*
- * Restore the right execEnv if it was swapped for tailcalling out
- * of a coroutine.
- */
-
- iPtr->execEnvPtr = eePtr;
- }
+ TclSpliceTailcall(interp, framePtr->tailcallPtr);
}
}