summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-08-21 21:43:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-08-21 21:43:16 (GMT)
commitc42f34e33320fc95bf80bdca0da2bae7bebbbe0f (patch)
treee045a34d312e2e08725507f0d2e43c6d65bc400a /generic/tclProc.c
parent64a63fa7c5594097d782968787ad37e46f9e4f5e (diff)
parent916d72ec1ce61ebd585a78c6a9565f5c49bb8d24 (diff)
downloadtcl-c42f34e33320fc95bf80bdca0da2bae7bebbbe0f.zip
tcl-c42f34e33320fc95bf80bdca0da2bae7bebbbe0f.tar.gz
tcl-c42f34e33320fc95bf80bdca0da2bae7bebbbe0f.tar.bz2
Merge 8.7
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 17635e7..e6b1372 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -1587,12 +1587,15 @@ TclPushProcCallFrame(
* is up-to-date), the namespace must match (so variable handling
* is right) and the resolverEpoch must match (so that new shadowed
* commands and/or resolver changes are considered).
+ * Ensure the ByteCode's procPtr is the same (or it's precompiled).
*/
if (((Interp *) *codePtr->interpHandle != iPtr)
|| (codePtr->compileEpoch != iPtr->compileEpoch)
|| (codePtr->nsPtr != nsPtr)
- || (codePtr->nsEpoch != nsPtr->resolverEpoch)) {
+ || (codePtr->nsEpoch != nsPtr->resolverEpoch)
+ || ((codePtr->procPtr != procPtr) && procPtr->bodyPtr->bytes)
+ ) {
goto doCompilation;
}
} else {
@@ -1932,6 +1935,7 @@ TclProcCompileProc(
* procPtr->numCompiledLocals if new local variables are found while
* compiling.
*
+ * Ensure the ByteCode's procPtr is the same (or it is pure precompiled).
* Precompiled procedure bodies, however, are immutable and therefore they
* are not recompiled, even if things have changed.
*/
@@ -1940,7 +1944,9 @@ TclProcCompileProc(
if (((Interp *) *codePtr->interpHandle == iPtr)
&& (codePtr->compileEpoch == iPtr->compileEpoch)
&& (codePtr->nsPtr == nsPtr)
- && (codePtr->nsEpoch == nsPtr->resolverEpoch)) {
+ && (codePtr->nsEpoch == nsPtr->resolverEpoch)
+ && ((codePtr->procPtr == procPtr) || !bodyPtr->bytes)
+ ) {
return TCL_OK;
}
@@ -2155,6 +2161,13 @@ TclProcCleanupProc(
Interp *iPtr = procPtr->iPtr;
if (bodyPtr != NULL) {
+ /* procPtr is stored in body's ByteCode, so ensure to reset it. */
+ ByteCode *codePtr;
+
+ ByteCodeGetInternalRep(bodyPtr, &tclByteCodeType, codePtr);
+ if (codePtr != NULL && codePtr->procPtr == procPtr) {
+ codePtr->procPtr = NULL;
+ }
Tcl_DecrRefCount(bodyPtr);
}
for (localPtr = procPtr->firstLocalPtr; localPtr != NULL; ) {