summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2010-09-28 15:22:54 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2010-09-28 15:22:54 (GMT)
commit1b6687e138b163e113158afd6450a4c3c4baf4f0 (patch)
tree590978688616b63bd5ab7a778dbe2e71db95af8a
parentf939b6c7e8e9053fe0c26c1c33379cd9fba0a241 (diff)
downloadtcl-1b6687e138b163e113158afd6450a4c3c4baf4f0.zip
tcl-1b6687e138b163e113158afd6450a4c3c4baf4f0.tar.gz
tcl-1b6687e138b163e113158afd6450a4c3c4baf4f0.tar.bz2
reverting faulty commit
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclExecute.c43
2 files changed, 31 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 2816e5f..e04ca05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,3 @@
-2010-09-27 Miguel Sofer <msofer@users.sf.net>
-
- * generic/tclExecute.c: remove TEBCreturn() callback, the job can
- be accomplished by TEBCresume()
-
2010-09-28 Reinhard Max <max@suse.de>
Implementation of TIP #162, "IPv6 Sockets for Tcl"
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;