summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-07 12:54:51 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-07 12:54:51 (GMT)
commitea21bb5de3ca09b64d101656f0613cd10f877aa6 (patch)
treec23482e15f548dd69d16c9749aeb85e3b4cd06d5 /generic/tclCompile.c
parent907e3ead5a3a2615c5721af947895bb4cacd3c99 (diff)
parent2a4281604ab70d1943a74f592e151c6a203f0bdd (diff)
downloadtcl-ea21bb5de3ca09b64d101656f0613cd10f877aa6.zip
tcl-ea21bb5de3ca09b64d101656f0613cd10f877aa6.tar.gz
tcl-ea21bb5de3ca09b64d101656f0613cd10f877aa6.tar.bz2
Fix [d4e7780ca1681cd095dbd81fe264feff75c988f7|d4e7780ca1]: "global" cmd literal sharing vs. per-interp resolvers
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index c0203dd..f6b3c52 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1781,9 +1781,17 @@ CompileCmdLiteral(
CompileEnv *envPtr)
{
int numBytes;
- const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes);
- int cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes);
- Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
+ const char *bytes;
+ Command *cmdPtr;
+ int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
+
+ cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
+ if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
+ extraLiteralFlags |= LITERAL_UNSHARED;
+ }
+
+ bytes = Tcl_GetStringFromObj(cmdObj, &numBytes);
+ cmdLitIdx = TclRegisterLiteral(envPtr, (char *)bytes, numBytes, extraLiteralFlags);
if (cmdPtr) {
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr);