summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-10-16 20:27:38 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-10-16 20:27:38 (GMT)
commit0172b5d75aa7fb9c03668b70cd8c267b6bccd503 (patch)
treed9884553a41faec78867c6bd03b10b6c7ff4bf57
parent3b9ea5778de8ac6371fc6f8a1caed01bb1776de3 (diff)
downloadtcl-0172b5d75aa7fb9c03668b70cd8c267b6bccd503.zip
tcl-0172b5d75aa7fb9c03668b70cd8c267b6bccd503.tar.gz
tcl-0172b5d75aa7fb9c03668b70cd8c267b6bccd503.tar.bz2
* generic/tclExecute.c (ReleaseDictIterator): Factored out the release
of the bytecode-level dictionary iterator information so that the side-conditions on instruction issuing are simpler.
-rw-r--r--ChangeLog36
-rw-r--r--generic/tclExecute.c80
2 files changed, 75 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 87b457a..9cb75ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
+2010-10-16 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclExecute.c (ReleaseDictIterator): Factored out the release
+ of the bytecode-level dictionary iterator information so that the
+ side-conditions on instruction issuing are simpler.
+
2010-10-15 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/reg_locale.c [Bug 3085863] tclUniData 9 years old: Updated Unicode
- * generic/tclUniData.c tables to latest UnicodeData.txt, corresponding with
- * tools/uniParse.tcl Unicode 6.0 (except for out-of-range chars > 0xFFFF)
+ * generic/reg_locale.c: [Bug 3085863]: tclUniData 9 years old: Updated
+ * generic/tclUniData.c: Unicode tables to latest UnicodeData.txt,
+ * tools/uniParse.tcl: corresponding with Unicode 6.0 (except for
+ out-of-range chars > 0xFFFF)
2010-10-13 Don Porter <dgp@users.sourceforge.net>
@@ -11,20 +18,21 @@
2010-10-13 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tclWinThrd.h (removed) because it is just empty en used nowhere
+ * win/tclWinThrd.h: (removed) because it is just empty en used nowhere
* win/tcl.dsp
2010-10-12 Jan Nijtmans <nijtmans@users.sf.net>
- * tools/uniClass.tcl Spacing and comments: let uniClass.tcl generation match
- * generic/regc_locale.c better the current (hand-modified) regc_locale.c
- * tools/uniParse.tcl Generate proper const qualifiers for tclUniData.c
- * generic/tclUniData.c
+ * tools/uniClass.tcl: Spacing and comments: let uniClass.tcl
+ * generic/regc_locale.c: generation match better the current
+ (hand-modified) regc_locale.c
+ * tools/uniParse.tcl: Generate proper const qualifiers for
+ * generic/tclUniData.c: tclUniData.c
2010-10-12 Reinhard Max <max@suse.de>
- * unix/tclUnixSock.c (CreateClientSocket): Fix a memleak and
- refactor the calls to freeaddrinfo() [Bug #3084338].
+ * unix/tclUnixSock.c (CreateClientSocket): [Bug 3084338]: Fix a
+ memleak and refactor the calls to freeaddrinfo().
2010-10-11 Jan Nijtmans <nijtmans@users.sf.net>
@@ -39,8 +47,8 @@
2010-10-09 Miguel Sofer <msofer@users.sf.net>
- * generic/tclExecute.c: fix overallocation of exec stack in TEBC
- (mixing numwords and numbytes)
+ * generic/tclExecute.c: Fix overallocation of exec stack in TEBC (due
+ to mixing numwords and numbytes)
2010-10-08 Jan Nijtmans <nijtmans@users.sf.net>
@@ -50,8 +58,8 @@
* tests/winPipe.test: Test hygiene with makeFile and removeFile.
- * generic/tclCompile.c: Prevent writing to the intrep fields of a
- * tests/subst.test: freed Tcl_Obj. [Bug 3081065]
+ * generic/tclCompile.c: [Bug 3081065]: Prevent writing to the intrep
+ * tests/subst.test: fields of a freed Tcl_Obj.
2010-10-02 Donal K. Fellows <dkf@users.sf.net>
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index c7f3690..65e0b22 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.506 2010/10/13 16:41:27 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.507 2010/10/16 20:27:39 dkf Exp $
*/
#include "tclInt.h"
@@ -513,16 +513,6 @@ VarHashCreateVar(
#else
#define IsErroringNaNType(type) 0
#endif
-
-/*
- * Custom object type only used in this file; values of its type should never
- * be seen by user scripts.
- */
-
-static const Tcl_ObjType dictIteratorType = {
- "dictIterator",
- NULL, NULL, NULL, NULL
-};
/*
* Auxiliary tables used to compute powers of small integers.
@@ -714,6 +704,7 @@ static void IllegalExprOperandType(Tcl_Interp *interp,
const unsigned char *pc, Tcl_Obj *opndPtr);
static void InitByteCodeExecution(Tcl_Interp *interp);
static inline int OFFSET(void *ptr);
+static void ReleaseDictIterator(Tcl_Obj *objPtr);
/* Useful elsewhere, make available in tclInt.h or stubs? */
static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, int numWords);
static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, int numWords);
@@ -735,6 +726,56 @@ static const Tcl_ObjType exprCodeType = {
NULL, /* updateStringProc */
NULL /* setFromAnyProc */
};
+
+/*
+ * Custom object type only used in this file; values of its type should never
+ * be seen by user scripts.
+ */
+
+static const Tcl_ObjType dictIteratorType = {
+ "dictIterator",
+ ReleaseDictIterator,
+ NULL, NULL, NULL
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ReleaseDictIterator --
+ *
+ * This takes apart a dictionary iterator that is stored in the given Tcl
+ * object.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Deallocates memory, marks the object as being untyped.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ReleaseDictIterator(
+ Tcl_Obj *objPtr)
+{
+ Tcl_DictSearch *searchPtr;
+ Tcl_Obj *dictPtr;
+
+ /*
+ * First kill the search, and then release the reference to the dictionary
+ * that we were holding.
+ */
+
+ searchPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ Tcl_DictObjDone(searchPtr);
+ ckfree((char *) searchPtr);
+
+ dictPtr = objPtr->internalRep.twoPtrValue.ptr2;
+ TclDecrRefCount(dictPtr);
+
+ objPtr->typePtr = NULL;
+}
/*
*----------------------------------------------------------------------
@@ -5935,23 +5976,8 @@ TEBCresume(
opnd = TclGetUInt4AtPtr(pc+1);
TRACE(("%u => ", opnd));
statePtr = (*LOCAL(opnd)).value.objPtr;
- if (statePtr == NULL) {
- Tcl_Panic("mis-issued dictDone!");
- }
-
- if (statePtr->typePtr == &dictIteratorType) {
- /*
- * First kill the search, and then release the reference to the
- * dictionary that we were holding.
- */
-
- searchPtr = statePtr->internalRep.twoPtrValue.ptr1;
- Tcl_DictObjDone(searchPtr);
- ckfree((char *) searchPtr);
-
- dictPtr = statePtr->internalRep.twoPtrValue.ptr2;
- TclDecrRefCount(dictPtr);
+ if (statePtr != NULL && statePtr->typePtr == &dictIteratorType) {
/*
* Set the internal variable to an empty object to signify that we
* don't hold an iterator.