Attachment "451858.patch" to
ticket [451858ffff]
added by
msofer
2001-09-17 18:55:08.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.614
diff -u -r1.614 ChangeLog
--- ChangeLog 2001/09/14 19:20:39 1.614
+++ ChangeLog 2001/09/17 11:48:13
@@ -1,3 +1,13 @@
+2001-09-13 Miguel Sofer <[email protected]>
+
+ * doc/tclvars.n:
+ * generic/tclCompile.c:
+ * generic/tclCompile.h:
+ * generic/tclExecute.c:
+ * generic/tclProc.c: disabled all compile and execution tracing
+ functionality in standard builds; TCL_COMPILE_DEBUG is now
+ necessary to enable it. [Bug 451858]
+
2001-09-14 Andreas Kupries <[email protected]>
* doc/gets.n:
@@ -60,8 +70,8 @@
by the new Tcl_EvalTokensStandard. The new function performs the
same duties but adheres to the standard return convention for Tcl
evaluations; the deprecated function could only return TCL_OK or
- TCL_ERROR, which caused [Bug: 219384] and [Bug: 455151].
- This patch implements [TIP: 56].
+ TCL_ERROR, which caused [Bug 219384] and [Bug 455151].
+ This patch implements [TIP 56].
2001-09-12 Mo DeJong <[email protected]>
@@ -371,7 +381,7 @@
* generic/tclProc.c:
* tests/proc.test: made [proc] check that formal args have
- simple names [Bug: 458548]
+ simple names [Bug 458548]
2001-09-04 Vince Darley <[email protected]>
Index: doc/tclvars.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/tclvars.n,v
retrieving revision 1.8
diff -u -r1.8 tclvars.n
--- doc/tclvars.n 2000/09/07 14:27:51 1.8
+++ doc/tclvars.n 2001/09/17 11:48:14
@@ -346,6 +346,9 @@
tracking down suspected problems with the Tcl compiler.
It is also occasionally useful when converting
existing code to use Tcl8.0.
+
+This variable and functionality only exist if
+TCL_COMPILE_DEBUG was defined during Tcl's compilation.
.TP
\fBtcl_traceExec\fR
The value of this variable can be set to control
@@ -368,6 +371,9 @@
and interpreter.
It is also occasionally useful when converting
code to use Tcl8.0.
+
+This variable and functionality only exist if
+TCL_COMPILE_DEBUG was defined during Tcl's compilation.
.TP
\fBtcl_wordchars\fR
The value of this variable is a regular expression that can be set to
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.23
diff -u -r1.23 tclCompile.c
--- generic/tclCompile.c 2001/09/04 11:54:27 1.23
+++ generic/tclCompile.c 2001/09/17 11:48:16
@@ -34,8 +34,10 @@
* This variable is linked to the Tcl variable "tcl_traceCompile".
*/
+#ifdef TCL_COMPILE_DEBUG
int tclTraceCompile = 0;
static int traceInitialized = 0;
+#endif
/*
* A table describing the Tcl bytecode instructions. Entries in this table
@@ -340,6 +342,7 @@
int length, nested, result;
char *string;
+#ifdef TCL_COMPILE_DEBUG
if (!traceInitialized) {
if (Tcl_LinkVar(interp, "tcl_traceCompile",
(char *) &tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
@@ -347,6 +350,7 @@
}
traceInitialized = 1;
}
+#endif
if (iPtr->evalFlags & TCL_BRACKET_TERM) {
nested = 1;
@@ -384,7 +388,7 @@
TclInitByteCodeObj(objPtr, &compEnv);
#ifdef TCL_COMPILE_DEBUG
- if (tclTraceCompile == 2) {
+ if (tclTraceCompile >= 2) {
TclPrintByteCodeObj(interp, objPtr);
}
#endif /* TCL_COMPILE_DEBUG */
@@ -871,6 +875,7 @@
commandLength -= 1;
}
+#ifdef TCL_COMPILE_DEBUG
/*
* If tracing, print a line for each top level command compiled.
*/
@@ -882,7 +887,7 @@
TclMin(commandLength, 55));
fprintf(stdout, "\n");
}
-
+#endif
/*
* Each iteration of the following loop compiles one word
* from the command.
Index: generic/tclCompile.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.h,v
retrieving revision 1.15
diff -u -r1.15 tclCompile.h
--- generic/tclCompile.h 2001/05/17 02:13:02 1.15
+++ generic/tclCompile.h 2001/09/17 11:48:16
@@ -37,6 +37,7 @@
extern Tcl_ObjType tclCmdNameType;
+#ifdef TCL_COMPILE_DEBUG
/*
* Variable that controls whether compilation tracing is enabled and, if so,
* what level of tracing is desired:
@@ -47,7 +48,9 @@
*/
extern int tclTraceCompile;
+#endif
+#ifdef TCL_COMPILE_DEBUG
/*
* Variable that controls whether execution tracing is enabled and, if so,
* what level of tracing is desired:
@@ -59,6 +62,7 @@
*/
extern int tclTraceExec;
+#endif
/*
*------------------------------------------------------------------------
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.29
diff -u -r1.29 tclExecute.c
--- generic/tclExecute.c 2001/09/03 17:34:16 1.29
+++ generic/tclExecute.c 2001/09/17 11:48:19
@@ -51,6 +51,7 @@
static int execInitialized = 0;
TCL_DECLARE_MUTEX(execMutex)
+#ifdef TCL_COMPILE_DEBUG
/*
* Variable that controls whether execution tracing is enabled and, if so,
* what level of tracing is desired:
@@ -62,6 +63,7 @@
*/
int tclTraceExec = 0;
+#endif
typedef struct ThreadSpecificData {
/*
@@ -358,11 +360,12 @@
* instruction tracing. */
{
Tcl_RegisterObjType(&tclCmdNameType);
+#ifdef TCL_COMPILE_DEBUG
if (Tcl_LinkVar(interp, "tcl_traceExec", (char *) &tclTraceExec,
TCL_LINK_INT) != TCL_OK) {
panic("InitByteCodeExecution: can't create link for tcl_traceExec variable");
}
-
+#endif
#ifdef TCL_COMPILE_STATS
Tcl_CreateCommand(interp, "evalstats", EvalStatsCmd,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
@@ -555,7 +558,9 @@
* instructions and processCatch to
* process break, continue, and errors. */
int result = TCL_OK; /* Return code returned after execution. */
+#ifdef TCL_COMPILE_DEBUG
int traceInstructions = (tclTraceExec == 3);
+#endif
Tcl_Obj *valuePtr, *value2Ptr, *objPtr, *elemPtr;
char *bytes;
int length;
@@ -614,7 +619,6 @@
#ifdef TCL_COMPILE_DEBUG
ValidatePcAndStackTop(codePtr, pc, stackTop, initStackTop,
eePtr->stackEnd);
-#else /* not TCL_COMPILE_DEBUG */
if (traceInstructions) {
fprintf(stdout, "%2d: %2d ", iPtr->numLevels, stackTop);
TclPrintInstruction(codePtr, pc);
@@ -849,8 +853,8 @@
*/
Tcl_ResetResult(interp);
- if (tclTraceExec >= 2) {
#ifdef TCL_COMPILE_DEBUG
+ if (tclTraceExec >= 2) {
if (traceInstructions) {
strncpy(cmdNameBuf, Tcl_GetString(objv[0]), 20);
TRACE(("%u => call ", (isUnknownCmd? objc-1:objc)));
@@ -865,13 +869,8 @@
}
fprintf(stdout, "\n");
fflush(stdout);
-#else /* TCL_COMPILE_DEBUG */
- fprintf(stdout, "%d: (%u) invoking %s\n",
- iPtr->numLevels,
- (unsigned int)(pc - codePtr->codeStart),
- Tcl_GetString(objv[0]));
-#endif /*TCL_COMPILE_DEBUG*/
}
+#endif /*TCL_COMPILE_DEBUG*/
iPtr->cmdCount++;
DECACHE_STACK_INFO();
Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.27
diff -u -r1.27 tclProc.c
--- generic/tclProc.c 2001/09/10 17:04:10 1.27
+++ generic/tclProc.c 2001/09/17 11:48:20
@@ -1058,19 +1058,17 @@
* Invoke the commands in the procedure's body.
*/
- if (tclTraceExec >= 1) {
#ifdef TCL_COMPILE_DEBUG
+ if (tclTraceExec >= 1) {
fprintf(stdout, "Calling proc ");
for (i = 0; i < objc; i++) {
TclPrintObject(stdout, objv[i], 15);
fprintf(stdout, " ");
}
fprintf(stdout, "\n");
-#else /* TCL_COMPILE_DEBUG */
- fprintf(stdout, "Calling proc %.*s\n", nameLen, procName);
-#endif /*TCL_COMPILE_DEBUG*/
fflush(stdout);
}
+#endif /*TCL_COMPILE_DEBUG*/
iPtr->returnCode = TCL_OK;
procPtr->refCount++;
@@ -1172,6 +1170,7 @@
int numChars;
char *ellipsis;
+#ifdef TCL_COMPILE_DEBUG
if (tclTraceCompile >= 1) {
/*
* Display a line summarizing the top level command we
@@ -1187,6 +1186,7 @@
fprintf(stdout, "Compiling %s \"%.*s%s\"\n",
description, numChars, procName, ellipsis);
}
+#endif
/*
* Plug the current procPtr into the interpreter and coerce