summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-02-06 17:21:56 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-02-06 17:21:56 (GMT)
commit5894df49560c27bd2e8a613912674b7f6392ae84 (patch)
tree597c89d3a8efa09752f9f09fcaaf4bc9588a86f6 /generic/tclCmdMZ.c
parent20c67d8109205fb42d5bd4c5ea2b7b2848c93989 (diff)
downloadtcl-5894df49560c27bd2e8a613912674b7f6392ae84.zip
tcl-5894df49560c27bd2e8a613912674b7f6392ae84.tar.gz
tcl-5894df49560c27bd2e8a613912674b7f6392ae84.tar.bz2
3484621 Invalidate bytecode when exec traces are added/removed from compiled cmd.
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 27e4055..fb15062 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -4019,8 +4019,18 @@ Tcl_TraceCommand(interp, cmdName, flags, proc, clientData)
tracePtr->nextPtr = cmdPtr->tracePtr;
tracePtr->refCount = 1;
cmdPtr->tracePtr = tracePtr;
- if (tracePtr->flags & TCL_TRACE_ANY_EXEC) {
+ if ((tracePtr->flags & TCL_TRACE_ANY_EXEC)
+ && !(cmdPtr->flags & CMD_HAS_EXEC_TRACES)) {
cmdPtr->flags |= CMD_HAS_EXEC_TRACES;
+
+ /*
+ * Bug 3484621: New execution trace means we no longer compile
+ * this command if we normally would. Invalidate bytecode.
+ */
+
+ if (cmdPtr->compileProc != NULL) {
+ ((Interp *)interp)->compileEpoch++;
+ }
}
return TCL_OK;
}
@@ -4123,6 +4133,15 @@ Tcl_UntraceCommand(interp, cmdName, flags, proc, clientData)
* traces. We therefore remove this flag:
*/
cmdPtr->flags &= ~CMD_HAS_EXEC_TRACES;
+
+ /*
+ * Bug 3484621: No more execution trace means we can compile
+ * the command again. If we will, invalidate bytecode.
+ */
+
+ if (cmdPtr->compileProc != NULL) {
+ ((Interp *)interp)->compileEpoch++;
+ }
}
}