From 1226c2ef3595f10f6ae34fc47c9d26706f4a4351 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Mon, 18 Jun 2007 21:58:40 +0000 Subject: * generic/tclExecute.c (TEBC): Moved the CmdFrame off the C stack and onto the Tcl stack, between the catch and the execution stacks --- ChangeLog | 9 +++++++-- generic/tclExecute.c | 39 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 617e5fb..0e8ceb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ +2007-06-18 Miguel Sofer + + * generic/tclExecute.c (TEBC): Moved the CmdFrame off the C stack + and onto the Tcl stack, between the catch and the execution stacks + 2007-06-18 Don Porter - * generic/tclBasic.c (TclEvalEx,TclEvalObjEx): Moved the CmdFrame off - the C stack and onto the Tcl stack. + * generic/tclBasic.c (TclEvalEx,TclEvalObjEx): Moved the CmdFrame + off the C stack and onto the Tcl stack. 2007-06-17 Donal K. Fellows diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a4c8a59..0020474 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,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.296 2007/06/17 21:29:38 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.297 2007/06/18 21:58:41 msofer Exp $ */ #include "tclInt.h" @@ -1346,7 +1346,7 @@ TclExecuteByteCode( ptrdiff_t *initCatchTop; /* Catch stack top at start of execution. */ Var *compiledLocals; Namespace *namespacePtr; - CmdFrame bcFrame; /* TIP #280: Structure for tracking lines. */ + CmdFrame *bcFramePtr; /* TIP #280: Structure for tracking lines. */ Tcl_Obj **constants = &iPtr->execEnvPtr->constants[0]; /* @@ -1392,7 +1392,7 @@ TclExecuteByteCode( /* * The execution uses a unified stack: first the catch stack, immediately - * above it the execution stack. + * above it a CmdFrame, then the execution stack. * * Make sure the catch stack is large enough to hold the maximum number of * catch commands that could ever be executing at the same time (this will @@ -1401,28 +1401,29 @@ TclExecuteByteCode( */ catchTop = initCatchTop = (ptrdiff_t *) ( - GrowEvaluationStack(iPtr->execEnvPtr, - codePtr->maxExceptDepth + codePtr->maxStackDepth, 0) - 1); - tosPtr = initTosPtr = - ((Tcl_Obj **) initCatchTop) + codePtr->maxExceptDepth; + GrowEvaluationStack(iPtr->execEnvPtr, + codePtr->maxExceptDepth + sizeof(CmdFrame) + + codePtr->maxStackDepth, 0) - 1); + bcFramePtr = (CmdFrame *) (initCatchTop + codePtr->maxExceptDepth + 1); + tosPtr = initTosPtr = ((Tcl_Obj **) (bcFramePtr + 1)) - 1; esPtr = iPtr->execEnvPtr->execStackPtr; /* * TIP #280: Initialize the frame. Do not push it yet. */ - bcFrame.type = ((codePtr->flags & TCL_BYTECODE_PRECOMPILED) + bcFramePtr->type = ((codePtr->flags & TCL_BYTECODE_PRECOMPILED) ? TCL_LOCATION_PREBC : TCL_LOCATION_BC); - bcFrame.level = (iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level+1 : 1); - bcFrame.framePtr = iPtr->framePtr; - bcFrame.nextPtr = iPtr->cmdFramePtr; - bcFrame.nline = 0; - bcFrame.line = NULL; + bcFramePtr->level = (iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level+1 : 1); + bcFramePtr->framePtr = iPtr->framePtr; + bcFramePtr->nextPtr = iPtr->cmdFramePtr; + bcFramePtr->nline = 0; + bcFramePtr->line = NULL; - bcFrame.data.tebc.codePtr = codePtr; - bcFrame.data.tebc.pc = NULL; - bcFrame.cmd.str.cmd = NULL; - bcFrame.cmd.str.len = 0; + bcFramePtr->data.tebc.codePtr = codePtr; + bcFramePtr->data.tebc.pc = NULL; + bcFramePtr->cmd.str.cmd = NULL; + bcFramePtr->cmd.str.len = 0; #ifdef TCL_COMPILE_DEBUG if (tclTraceExec >= 2) { @@ -1952,8 +1953,8 @@ TclExecuteByteCode( * 'TclGetSrcInfoForPc', and push the frame. */ - bcFrame.data.tebc.pc = (char *) pc; - iPtr->cmdFramePtr = &bcFrame; + bcFramePtr->data.tebc.pc = (char *) pc; + iPtr->cmdFramePtr = bcFramePtr; DECACHE_STACK_INFO(); cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[0]); -- cgit v0.12