summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-07-21 10:47:18 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-07-21 10:47:18 (GMT)
commit7aa734510a8d4513721e66fa08ec27b72726d1a6 (patch)
treeebfd27f59af5c53eade7e31ae6b0414b8e9661e6 /generic
parentaf031c0a09d0d4abeb4bf13bd542663126fb2245 (diff)
downloadtcl-7aa734510a8d4513721e66fa08ec27b72726d1a6.zip
tcl-7aa734510a8d4513721e66fa08ec27b72726d1a6.tar.gz
tcl-7aa734510a8d4513721e66fa08ec27b72726d1a6.tar.bz2
* generic/tclExecute.c:
* tests/execute.test (execute-9.1): dgp's fix for [Bug 1522803].
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c13
-rw-r--r--generic/tclInt.h15
-rw-r--r--generic/tclObj.c22
3 files changed, 29 insertions, 21 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 96677f9..0870219 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.238 2006/07/20 06:17:38 das Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.239 2006/07/21 10:47:18 msofer Exp $
*/
#include "tclInt.h"
@@ -1791,7 +1791,7 @@ TclExecuteByteCode(
*/
DECACHE_STACK_INFO();
- Tcl_ResetResult(interp);
+ /*Tcl_ResetResult(interp);*/
result = TclEvalObjvInternal(interp, objc, objv, bytes, length, 0);
CACHE_STACK_INFO();
@@ -1890,7 +1890,7 @@ TclExecuteByteCode(
objPtr = *tosPtr;
DECACHE_STACK_INFO();
- Tcl_ResetResult(interp);
+ /*Tcl_ResetResult(interp);*/
result = Tcl_ExprObj(interp, objPtr, &valuePtr);
CACHE_STACK_INFO();
if (result != TCL_OK) {
@@ -5205,17 +5205,21 @@ TclExecuteByteCode(
}
case INST_BREAK:
+ /*
DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
CACHE_STACK_INFO();
+ */
result = TCL_BREAK;
cleanup = 0;
goto processExceptionReturn;
case INST_CONTINUE:
+ /*
DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
CACHE_STACK_INFO();
+ */
result = TCL_CONTINUE;
cleanup = 0;
goto processExceptionReturn;
@@ -5411,6 +5415,7 @@ TclExecuteByteCode(
case INST_END_CATCH:
catchTop--;
+ Tcl_ResetResult(interp);
result = TCL_OK;
TRACE(("=> catchTop=%d\n", (catchTop - initCatchTop - 1)));
NEXT_INST_F(1, 0, 0);
@@ -5474,7 +5479,7 @@ TclExecuteByteCode(
goto checkForCatch;
}
if (objResultPtr == NULL) {
- Tcl_ResetResult(interp);
+ /*Tcl_ResetResult(interp);*/
Tcl_AppendResult(interp, "key \"", TclGetString(*tosPtr),
"\" not known in dictionary", NULL);
TRACE_WITH_OBJ(("%u => ERROR ", opnd), Tcl_GetObjResult(interp));
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 35addc8..cb4a70f 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -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: tclInt.h,v 1.272 2006/07/05 05:34:44 dgp Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.273 2006/07/21 10:47:19 msofer Exp $
*/
#ifndef _TCLINT
@@ -2624,15 +2624,20 @@ MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr);
(objPtr)->length = 0; \
(objPtr)->typePtr = NULL
+/* Invalidate the string rep first so we can use the bytes value \
+ * for our pointer chain, and signal an obj deletion (as opposed \
+ * to shimmering) with 'length == -1' */ \
+
# define TclDecrRefCount(objPtr) \
if (--(objPtr)->refCount <= 0) { \
+ if ((objPtr)->bytes \
+ && ((objPtr)->bytes != tclEmptyStringRep)) { \
+ ckfree((char *) (objPtr)->bytes); \
+ } \
+ (objPtr)->length = -1; \
if ((objPtr)->typePtr && (objPtr)->typePtr->freeIntRepProc) { \
TclFreeObj(objPtr); \
} else { \
- if ((objPtr)->bytes \
- && ((objPtr)->bytes != tclEmptyStringRep)) { \
- ckfree((char *) (objPtr)->bytes); \
- } \
TclFreeObjStorage(objPtr); \
TclIncrObjsFreed(); \
} \
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 521a49b..6463904 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.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: tclObj.c,v 1.109 2006/07/20 06:17:39 das Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.110 2006/07/21 10:47:19 msofer Exp $
*/
#include "tclInt.h"
@@ -111,13 +111,8 @@ typedef struct PendingObjData {
#define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0)
#define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL)
#define PushObjToDelete(contextPtr,objPtr) \
- /* Invalidate the string rep first so we can use the bytes value \
- * for our pointer chain. */ \
- if (((objPtr)->bytes != NULL) \
- && ((objPtr)->bytes != tclEmptyStringRep)) { \
- ckfree((char *) (objPtr)->bytes); \
- } \
- /* Now push onto the head of the stack. */ \
+ /* The string rep is already invalidated so we can use the bytes value \
+ * for our pointer chain: push onto the head of the stack. */ \
(objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \
(contextPtr)->deletionStack = (objPtr)
#define PopObjToDelete(contextPtr,objPtrVar) \
@@ -849,6 +844,13 @@ TclFreeObj(
Tcl_Panic("Reference count for %lx was negative", objPtr);
}
+ /* Invalidate the string rep first so we can use the bytes value
+ * for our pointer chain, and signal an obj deletion (as opposed
+ * to shimmering) with 'length == -1' */
+
+ TclInvalidateStringRep(objPtr);
+ objPtr->length = -1;
+
if (ObjDeletePending(context)) {
PushObjToDelete(context, objPtr);
} else {
@@ -857,7 +859,6 @@ TclFreeObj(
typePtr->freeIntRepProc(objPtr);
ObjDeletionUnlock(context);
}
- TclInvalidateStringRep(objPtr);
Tcl_MutexLock(&tclObjMutex);
ckfree((char *) objPtr);
@@ -923,9 +924,6 @@ TclFreeObj(
objPtr->typePtr->freeIntRepProc(objPtr);
ObjDeletionUnlock(context);
- if (objPtr->bytes && (objPtr->bytes != tclEmptyStringRep)) {
- ckfree((char *) objPtr->bytes);
- }
TclFreeObjStorage(objPtr);
TclIncrObjsFreed();
ObjDeletionLock(context);