diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2007-04-18 21:00:41 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2007-04-18 21:00:41 (GMT) |
commit | 3f66d3d7fe0596082573ea01a6b5027b6adb870f (patch) | |
tree | 3350f725879006d0cdbb1762e1dd4ab64fa8a1bd /generic | |
parent | 79f95e949c348b6380830c77f049542e91136874 (diff) | |
download | tcl-3f66d3d7fe0596082573ea01a6b5027b6adb870f.zip tcl-3f66d3d7fe0596082573ea01a6b5027b6adb870f.tar.gz tcl-3f66d3d7fe0596082573ea01a6b5027b6adb870f.tar.bz2 |
* generic/tclExecute.c: slight changes in Tcl_Obj management.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 50 |
1 files changed, 28 insertions, 22 deletions
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); } /* |