diff options
author | msofer <msofer@noemail.net> | 2010-09-28 15:22:53 (GMT) |
---|---|---|
committer | msofer <msofer@noemail.net> | 2010-09-28 15:22:53 (GMT) |
commit | d3bde6be09c1dc747a0bd0a09c49574b9444bef7 (patch) | |
tree | 590978688616b63bd5ab7a778dbe2e71db95af8a /generic/tclExecute.c | |
parent | 7059107af231e3d6ae24c6a8402378522e016429 (diff) | |
download | tcl-d3bde6be09c1dc747a0bd0a09c49574b9444bef7.zip tcl-d3bde6be09c1dc747a0bd0a09c49574b9444bef7.tar.gz tcl-d3bde6be09c1dc747a0bd0a09c49574b9444bef7.tar.bz2 |
reverting faulty commit
FossilOrigin-Name: 145f305da95caba1be4ba2dbc9d97889ee725570
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 2297492..ade67b6 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.501 2010/09/28 15:20:17 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.502 2010/09/28 15:22:54 msofer Exp $ */ #include "tclInt.h" @@ -721,6 +721,7 @@ static Tcl_NRPostProc CopyCallback; static Tcl_NRPostProc ExprObjCallback; static Tcl_NRPostProc TEBCresume; +static Tcl_NRPostProc TEBCreturn; /* * The structure below defines a bytecode Tcl object type to hold the @@ -1938,9 +1939,13 @@ TclNRExecuteByteCode( #endif /* - * Push the callback for bytecode execution + * Push the callbacks for + * - exception handling and cleanup + * - bytecode execution */ + TclNRAddCallback(interp, TEBCreturn, BP, NULL, + NULL, NULL); TclNRAddCallback(interp, TEBCresume, BP, /*resume*/ INT2PTR(0), NULL, NULL); @@ -1948,6 +1953,26 @@ TclNRExecuteByteCode( } static int +TEBCreturn( + ClientData data[], + Tcl_Interp *interp, + int result) +{ + BottomData *BP = data[0]; + ByteCode *codePtr = BP->codePtr; + + if (--codePtr->refCount <= 0) { + TclCleanupByteCode(codePtr); + } + while (BP->expanded) { + BP = BP->expanded; + } + TclStackFree(interp, BP); /* free my stack */ + + return result; +} + +static int TEBCresume( ClientData data[], Tcl_Interp *interp, @@ -2049,6 +2074,7 @@ TEBCresume( result = TCL_ERROR; } NRE_ASSERT(iPtr->cmdFramePtr == bcFramePtr); + NRE_ASSERT(TOP_CB(interp)->procPtr == TEBCreturn); iPtr->cmdFramePtr = bcFramePtr->nextPtr; TclArgumentBCRelease((Tcl_Interp *) iPtr, bcFramePtr); @@ -6326,18 +6352,11 @@ TEBCresume( CLANG_ASSERT(bcFramePtr); } - /* - * Free all resources associated with this execution + * Store the previous bottomPtr for returning to it, then free all + * resources used by this bytecode and process callbacks until you return + * to the previous bytecode (if any). */ - - if (--codePtr->refCount <= 0) { - TclCleanupByteCode(codePtr); - } - while (BP->expanded) { - BP = BP->expanded; - } - TclStackFree(interp, BP); /* free my stack */ iPtr->cmdFramePtr = bcFramePtr->nextPtr; return result; |