diff options
author | escoffon <escoffon> | 1998-07-15 11:08:17 (GMT) |
---|---|---|
committer | escoffon <escoffon> | 1998-07-15 11:08:17 (GMT) |
commit | f916e7601c396671e9dd7747b0d143673ae45c2b (patch) | |
tree | f12332afa1a5987e074292fc8185b5e7e05d197a /generic/tclProc.c | |
parent | 383a24c0e1eb4e32a171bcd66addac9264206802 (diff) | |
download | tcl-f916e7601c396671e9dd7747b0d143673ae45c2b.zip tcl-f916e7601c396671e9dd7747b0d143673ae45c2b.tar.gz tcl-f916e7601c396671e9dd7747b0d143673ae45c2b.tar.bz2 |
Added check for precompiled ByteCodes, to avoid recompilation if the epoch
has changed in the interpreter. Instead, reset the epoch in the ByteCode.
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index 4c1a9a4..0679fc5 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.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. * - * SCCS: %Z% $Id: tclProc.c,v 1.6 1998/07/14 10:34:43 escoffon Exp $ + * SCCS: %Z% $Id: tclProc.c,v 1.7 1998/07/15 11:08:17 escoffon Exp $ */ #include "tclInt.h" @@ -694,6 +694,9 @@ TclObjInterpProc(clientData, interp, objc, objv) * different interpreter, we recompile it. Note that compiling the body * might increase procPtr->numCompiledLocals if new local variables are * found while compiling. + * + * Precompiled procedure bodies, however, are immutable and therefore + * they are not recompiled, even if the epoch has changed. */ if (bodyPtr->typePtr == &tclByteCodeType) { @@ -701,8 +704,15 @@ TclObjInterpProc(clientData, interp, objc, objv) if ((codePtr->iPtr != iPtr) || (codePtr->compileEpoch != iPtr->compileEpoch)) { - tclByteCodeType.freeIntRepProc(bodyPtr); - bodyPtr->typePtr = (Tcl_ObjType *) NULL; + if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) { + if (codePtr->iPtr != iPtr) { + panic("TclObjInterpProc: compiled body jumped interps"); + } + codePtr->compileEpoch = iPtr->compileEpoch; + } else { + tclByteCodeType.freeIntRepProc(bodyPtr); + bodyPtr->typePtr = (Tcl_ObjType *) NULL; + } } } if (bodyPtr->typePtr != &tclByteCodeType) { |