Attachment "tclCompile.patch" to
ticket [3081065fff]
added by
nijtmans
2010-10-07 04:06:53.
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.189
diff -u -r1.189 tclCompile.c
--- generic/tclCompile.c 6 Oct 2010 18:38:44 -0000 1.189
+++ generic/tclCompile.c 6 Oct 2010 20:58:22 -0000
@@ -439,7 +439,6 @@
static void EnterCmdStartData(CompileEnv *envPtr,
int cmdNumber, int srcOffset, int codeOffset);
static void FreeByteCodeInternalRep(Tcl_Obj *objPtr);
-static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr);
static int GetCmdLocEncodingSize(CompileEnv *envPtr);
#ifdef TCL_COMPILE_STATS
static void RecordByteCodeStats(ByteCode *codePtr);
@@ -479,7 +478,7 @@
static const Tcl_ObjType substCodeType = {
"substcode", /* name */
- FreeSubstCodeInternalRep, /* freeIntRepProc */
+ FreeByteCodeInternalRep, /* freeIntRepProc */
DupByteCodeInternalRep, /* dupIntRepProc - shared with bytecode */
NULL, /* updateStringProc */
NULL, /* setFromAnyProc */
@@ -714,12 +713,12 @@
{
register ByteCode *codePtr = objPtr->internalRep.otherValuePtr;
+ objPtr->typePtr = NULL;
+ objPtr->internalRep.otherValuePtr = NULL;
codePtr->refCount--;
if (codePtr->refCount <= 0) {
TclCleanupByteCode(codePtr);
}
- objPtr->typePtr = NULL;
- objPtr->internalRep.otherValuePtr = NULL;
}
/*
@@ -994,7 +993,7 @@
|| (codePtr->nsEpoch != nsPtr->resolverEpoch)
|| (codePtr->localCachePtr !=
iPtr->varFramePtr->localCachePtr)) {
- FreeSubstCodeInternalRep(objPtr);
+ FreeByteCodeInternalRep(objPtr);
}
}
if (objPtr->typePtr != &substCodeType) {
@@ -1027,40 +1026,6 @@
/*
*----------------------------------------------------------------------
*
- * FreeSubstCodeInternalRep --
- *
- * Part of the substcode Tcl object type implementation. Frees the
- * storage associated with a substcode object's internal representation
- * unless its code is actively being executed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The substcode object's internal rep is marked invalid and its code
- * gets freed unless the code is actively being executed. In that case
- * the cleanup is delayed until the last execution of the code completes.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-FreeSubstCodeInternalRep(
- register Tcl_Obj *objPtr) /* Object whose internal rep to free. */
-{
- register ByteCode *codePtr = objPtr->internalRep.ptrAndLongRep.ptr;
-
- objPtr->typePtr = NULL;
- objPtr->internalRep.otherValuePtr = NULL;
- codePtr->refCount--;
- if (codePtr->refCount <= 0) {
- TclCleanupByteCode(codePtr);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TclInitCompileEnv --
*
* Initializes a CompileEnv compilation environment structure for the