summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2002-09-27 01:28:15 (GMT)
committerhobbs <hobbs@noemail.net>2002-09-27 01:28:15 (GMT)
commit857ee230b06edce5c18a8ba1b79ee4c3bd1f3712 (patch)
tree1d04ef995424ad92a7e05d8f6a03fcff3f31069d /generic
parent9a36aeef53f7e211186efe5439c92104d0a2a15c (diff)
downloadtcl-857ee230b06edce5c18a8ba1b79ee4c3bd1f3712.zip
tcl-857ee230b06edce5c18a8ba1b79ee4c3bd1f3712.tar.gz
tcl-857ee230b06edce5c18a8ba1b79ee4c3bd1f3712.tar.bz2
* generic/tclProc.c (Tcl_ProcObjCmd): correct overeager
optimization of noop proc to handle the precompiled case. (sofer) FossilOrigin-Name: f36499ba479608801430f9c1c6ed63985ba750b7
Diffstat (limited to 'generic')
-rw-r--r--generic/tclProc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 2d16c7f..7c6e518 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.41 2002/08/05 03:24:41 dgp Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.42 2002/09/27 01:28:15 hobbs Exp $
*/
#include "tclInt.h"
@@ -150,8 +150,9 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv)
/*
- * Optimize for noop procs: if the argument list is just "args"
- * and the body is empty, define a compileProc.
+ * Optimize for noop procs: if the body is not precompiled, the argument
+ * list is just "args" and the body is empty, define a compileProc to
+ * compile a noop.
*
* Notes:
* - cannot be done for any argument list without having different
@@ -164,9 +165,17 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv)
* compilation of all procs whose argument list is just _args_
*/
+ if (objv[3]->typePtr == &tclByteCodeType) {
+ ByteCode *body = objv[3]->internalRep.otherValuePtr;
+
+ if (body->flags & TCL_BYTECODE_PRECOMPILED) {
+ goto done;
+ }
+ }
+
procArgs = Tcl_GetString(objv[2]);
- while(*procArgs == ' ') {
+ while (*procArgs == ' ') {
procArgs++;
}
@@ -184,7 +193,7 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv)
*/
procBody = Tcl_GetString(objv[3]);
- while(*procBody != '\0') {
+ while (*procBody != '\0') {
if (!isspace(UCHAR(*procBody))) {
goto done;
}