diff options
author | hobbs <hobbs> | 2002-09-27 01:28:15 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-09-27 01:28:15 (GMT) |
commit | 44a654f87ce617105b45247c98294c46410dbb70 (patch) | |
tree | 1d04ef995424ad92a7e05d8f6a03fcff3f31069d /generic | |
parent | b96b459a4907a164acb205a2b024c2c8419ea496 (diff) | |
download | tcl-44a654f87ce617105b45247c98294c46410dbb70.zip tcl-44a654f87ce617105b45247c98294c46410dbb70.tar.gz tcl-44a654f87ce617105b45247c98294c46410dbb70.tar.bz2 |
* generic/tclProc.c (Tcl_ProcObjCmd): correct overeager
optimization of noop proc to handle the precompiled case. (sofer)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclProc.c | 19 |
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; } |