summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authormsofer <msofer@noemail.net>2005-04-02 02:08:21 (GMT)
committermsofer <msofer@noemail.net>2005-04-02 02:08:21 (GMT)
commit01655d82fb04103dca5f97c88a67536f67b58ddc (patch)
tree60e127a56dc4b46c2944f5cd3e2270be9489cdca /generic/tclExecute.c
parent3249c3774db6798eabb2ac608cc9ef829e6dc5c5 (diff)
downloadtcl-01655d82fb04103dca5f97c88a67536f67b58ddc.zip
tcl-01655d82fb04103dca5f97c88a67536f67b58ddc.tar.gz
tcl-01655d82fb04103dca5f97c88a67536f67b58ddc.tar.bz2
Changed the internal representation of lists to (a) reduce the malloc/free
calls at list creation (from 2 to 1), (b) reduce the cost of handling empty lists (we now never create a list internal rep for them), (c) allow refcounting of the list internal rep. The latter permits insuring that the pointers returned by Tcl_ListObjGetElements remain valid even if the object shimmers away from its original list type. This is [Patch 1158008] FossilOrigin-Name: 20cba22d4264a71bbc3de27278a9ed12fbe42004
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index a66f278..395b7ef 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -11,7 +11,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.176 2005/04/01 19:08:30 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.177 2005/04/02 02:08:32 msofer Exp $
*/
#include "tclInt.h"
@@ -4677,7 +4677,7 @@ TclExecuteByteCode(interp, codePtr)
ForeachVarList *varListPtr;
int numLists;
Tcl_Obj *listPtr,*valuePtr, *value2Ptr;
- List *listRepPtr;
+ Tcl_Obj **elements;
Var *iterVarPtr, *listVarPtr;
int iterNum, listTmpIndex, listLen, numVars;
int varIndex, valIndex, continueLoop, j;
@@ -4739,8 +4739,7 @@ TclExecuteByteCode(interp, codePtr)
listVarPtr = &(compiledLocals[listTmpIndex]);
listPtr = listVarPtr->value.objPtr;
- listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1;
- listLen = listRepPtr->elemCount;
+ TclListObjGetElements(listPtr, listLen, elements);
valIndex = (iterNum * numVars);
for (j = 0; j < numVars; j++) {
@@ -4749,7 +4748,7 @@ TclExecuteByteCode(interp, codePtr)
setEmptyStr = 1;
TclNewObj(valuePtr);
} else {
- valuePtr = listRepPtr->elements[valIndex];
+ valuePtr = elements[valIndex];
}
varIndex = varListPtr->varIndexes[j];