diff options
author | hobbs <hobbs@noemail.net> | 2000-03-30 04:36:09 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2000-03-30 04:36:09 (GMT) |
commit | 79acf4143b91b7505f32e41e84c3664e4b14a2d6 (patch) | |
tree | 6b5f76b81d605204fdd5800eab13e5da6f72abeb /generic/tclCompile.c | |
parent | e57d523765ab57b3ede9686e23085a6e4fcbfe52 (diff) | |
download | tcl-79acf4143b91b7505f32e41e84c3664e4b14a2d6.zip tcl-79acf4143b91b7505f32e41e84c3664e4b14a2d6.tar.gz tcl-79acf4143b91b7505f32e41e84c3664e4b14a2d6.tar.bz2 |
* generic/tclCompile.c (TclCleanupByteCode): made ByteCode cleanup
more aware of TCL_BYTECODE_PRECOMPILED flagged structs (gen'd by
tbcload), to correctly clean them up.
* generic/tclClock.c (FormatClock): moved check for empty format
earlier, commented 0 result return value
FossilOrigin-Name: 95a7cc28319fc286bba482496238fd3fd67c0ca2
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index ed7500f..7a9f64d 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.19 1999/12/12 02:26:41 hobbs Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.20 2000/03/30 04:36:11 hobbs Exp $ */ #include "tclInt.h" @@ -553,9 +553,26 @@ TclCleanupByteCode(codePtr) * only need to 1) decrement the ref counts of the LiteralEntry's in * its literal array, 2) call the free procs for the auxiliary data * items, and 3) free the ByteCode structure's heap object. + * + * The case for TCL_BYTECODE_PRECOMPILED (precompiled ByteCodes, + * like those generated from tbcload) is special, as they doesn't + * make use of the global literal table. They instead maintain + * private references to their literals which must be decremented. */ - if (interp != NULL) { + if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) { + register Tcl_Obj *objPtr; + + objArrayPtr = codePtr->objArrayPtr; + for (i = 0; i < numLitObjects; i++) { + objPtr = *objArrayPtr; + if (objPtr) { + Tcl_DecrRefCount(objPtr); + } + objArrayPtr++; + } + codePtr->numLitObjects = 0; + } else if (interp != NULL) { /* * If the interp has already been freed, then Tcl will have already * forcefully released all the literals used by ByteCodes compiled |