summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-12-24 18:06:53 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-12-24 18:06:53 (GMT)
commit3c1e7bd70247b897a1e6f47d8fcb6d50de880aea (patch)
tree3c5ff4f02494bc5285f2fcf529ccf0a76dd8885c /generic/tclCompile.c
parent3f7f31fb81efcc04c41dcc79f2417a766353ad66 (diff)
downloadtcl-3c1e7bd70247b897a1e6f47d8fcb6d50de880aea.zip
tcl-3c1e7bd70247b897a1e6f47d8fcb6d50de880aea.tar.gz
tcl-3c1e7bd70247b897a1e6f47d8fcb6d50de880aea.tar.bz2
Avoid sharing cmdName literals accross namespaces, and generalise usage of
the TclRegisterNewLiteral macro [Patch 1090905]
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 243cc14..f732f36 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,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.80 2004/12/20 18:27:18 msofer Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.81 2004/12/24 18:06:56 msofer Exp $
*/
#include "tclInt.h"
@@ -1146,10 +1146,11 @@ TclCompileScript(interp, script, numBytes, envPtr)
/*
* No compile procedure so push the word. If the
* command was found, push a CmdName object to
- * reduce runtime lookups.
+ * reduce runtime lookups. Avoid sharing this literal
+ * among different namespaces to reduce shimmering.
*/
- objIndex = TclRegisterNewLiteral(envPtr,
+ objIndex = TclRegisterNewNSLiteral(envPtr,
tokenPtr[1].start, tokenPtr[1].size);
if (cmdPtr != NULL) {
TclSetCmdNameObj(interp,
@@ -1318,9 +1319,9 @@ TclCompileTokens(interp, tokenPtr, count, envPtr)
if (Tcl_DStringLength(&textBuffer) > 0) {
int literal;
- literal = TclRegisterLiteral(envPtr,
+ literal = TclRegisterNewLiteral(envPtr,
Tcl_DStringValue(&textBuffer),
- Tcl_DStringLength(&textBuffer), /*onHeap*/ 0);
+ Tcl_DStringLength(&textBuffer));
TclEmitPush(literal, envPtr);
numObjsToConcat++;
Tcl_DStringFree(&textBuffer);
@@ -1339,9 +1340,9 @@ TclCompileTokens(interp, tokenPtr, count, envPtr)
if (Tcl_DStringLength(&textBuffer) > 0) {
int literal;
- literal = TclRegisterLiteral(envPtr,
+ literal = TclRegisterNewLiteral(envPtr,
Tcl_DStringValue(&textBuffer),
- Tcl_DStringLength(&textBuffer), /*onHeap*/ 0);
+ Tcl_DStringLength(&textBuffer));
TclEmitPush(literal, envPtr);
numObjsToConcat++;
Tcl_DStringFree(&textBuffer);
@@ -1433,8 +1434,8 @@ TclCompileTokens(interp, tokenPtr, count, envPtr)
if (Tcl_DStringLength(&textBuffer) > 0) {
int literal;
- literal = TclRegisterLiteral(envPtr, Tcl_DStringValue(&textBuffer),
- Tcl_DStringLength(&textBuffer), /*onHeap*/ 0);
+ literal = TclRegisterNewLiteral(envPtr, Tcl_DStringValue(&textBuffer),
+ Tcl_DStringLength(&textBuffer));
TclEmitPush(literal, envPtr);
numObjsToConcat++;
}
@@ -1456,7 +1457,7 @@ TclCompileTokens(interp, tokenPtr, count, envPtr)
*/
if (envPtr->codeNext == entryCodeNext) {
- TclEmitPush(TclRegisterLiteral(envPtr, "", 0, /*onHeap*/ 0),
+ TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0),
envPtr);
}
Tcl_DStringFree(&textBuffer);
@@ -1573,7 +1574,7 @@ TclCompileExprWords(interp, tokenPtr, numWords, envPtr)
for (i = 0; i < numWords; i++) {
TclCompileTokens(interp, wordPtr+1, wordPtr->numComponents, envPtr);
if (i < (numWords - 1)) {
- TclEmitPush(TclRegisterLiteral(envPtr, " ", 1, /*onHeap*/ 0),
+ TclEmitPush(TclRegisterNewLiteral(envPtr, " ", 1),
envPtr);
}
wordPtr += (wordPtr->numComponents + 1);