summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclExecute.c50
2 files changed, 32 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index d49142a..5af96a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-04-18 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclExecute.c: slight changes in Tcl_Obj management.
+
2007-04-17 Kevin B. Kenny <kennykb@acm.org>
* library/clock.tcl: Fixed the naming of
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 00a3509..ebb5f49 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.278 2007/04/17 20:06:18 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.279 2007/04/18 21:00:42 msofer Exp $
*/
#include "tclInt.h"
@@ -1400,34 +1400,36 @@ TclExecuteByteCode(
case INST_RETURN_IMM: {
int code = TclGetInt4AtPtr(pc+1);
int level = TclGetUInt4AtPtr(pc+5);
- Tcl_Obj *returnOpts;
+ /*
+ * OBJ_AT_TOS is returnOpts, OBJ_UNDER_TOS is resultObjPtr.
+ */
+
TRACE(("%u %u => ", code, level));
- returnOpts = POP_OBJECT();
- result = TclProcessReturn(interp, code, level, returnOpts);
- Tcl_DecrRefCount(returnOpts);
- if (result != TCL_OK) {
- Tcl_SetObjResult(interp, OBJ_AT_TOS);
- cleanup = 1;
+ result = TclProcessReturn(interp, code, level, OBJ_AT_TOS);
+ if (result == TCL_OK) {
+ TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")",
+ O2S(objResultPtr)));
+ NEXT_INST_F(9, 1, 0);
+ } else {
+ Tcl_SetObjResult(interp, OBJ_UNDER_TOS);
+ cleanup = 2;
goto processExceptionReturn;
}
- TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")",
- O2S(objResultPtr)));
- NEXT_INST_F(9, 0, 0);
}
case INST_RETURN_STK:
TRACE(("=> "));
objResultPtr = POP_OBJECT();
- result = Tcl_SetReturnOptions(interp, POP_OBJECT());
+ result = Tcl_SetReturnOptions(interp, OBJ_AT_TOS);
+ OBJ_AT_TOS = objResultPtr;
if (result == TCL_OK) {
TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")",
O2S(objResultPtr)));
- NEXT_INST_F(1, 0, -1);
+ NEXT_INST_F(1, 0, 0);
} else {
Tcl_SetObjResult(interp, objResultPtr);
- Tcl_DecrRefCount(objResultPtr);
- cleanup = 0;
+ cleanup = 1;
goto processExceptionReturn;
}
@@ -1704,13 +1706,15 @@ TclExecuteByteCode(
CACHE_STACK_INFO();
/*
- * Expand the list at stacktop onto the stack; free the list.
+ * Expand the list at stacktop onto the stack; free the list. Knowing
+ * that it has a freeIntRepProc we use Tcl_DecrRefCount().
*/
for (i = 0; i < objc; i++) {
PUSH_OBJECT(objv[i]);
}
- TclDecrRefCount(valuePtr);
+
+ Tcl_DecrRefCount(valuePtr);
NEXT_INST_F(5, 0, 0);
}
@@ -3102,11 +3106,12 @@ TclExecuteByteCode(
/*
* Get the old value of variable, and remove the stack ref. This is
* safe because the variable still references the object; the ref
- * count will never go zero here.
+ * count will never go zero here - we can use the smaller macro
+ * Tcl_DecrRefCount.
*/
value2Ptr = POP_OBJECT();
- TclDecrRefCount(value2Ptr); /* This one should be done here */
+ Tcl_DecrRefCount(value2Ptr); /* This one should be done here */
/*
* Get the new element value.
@@ -3149,11 +3154,12 @@ TclExecuteByteCode(
/*
* Get the old value of variable, and remove the stack ref. This is
* safe because the variable still references the object; the ref
- * count will never go zero here.
+ * count will never go zero here - we can use the smaller macro
+ * Tcl_DecrRefCount.
*/
objPtr = POP_OBJECT();
- TclDecrRefCount(objPtr); /* This one should be done here */
+ Tcl_DecrRefCount(objPtr); /* This one should be done here */
/*
* Get the new element value, and the index list
@@ -6553,7 +6559,7 @@ TclExecuteByteCode(
{
while (CURR_DEPTH > initStackDepth) {
Tcl_Obj *objPtr = POP_OBJECT();
- TclDecrRefCount(objPtr);
+ Tcl_DecrRefCount(objPtr);
}
/*