diff options
author | msofer <msofer@noemail.net> | 2007-08-08 18:34:38 (GMT) |
---|---|---|
committer | msofer <msofer@noemail.net> | 2007-08-08 18:34:38 (GMT) |
commit | b3eb9436b469f5095d4d6b59a10b9d01efe5bfb5 (patch) | |
tree | 8f7b3647d35f90908687ff19cb3c93e59198afdf /generic/tclProc.c | |
parent | 464311d2a9b27a9a3a3027e03b8d2abc1653c5f6 (diff) | |
download | tcl-b3eb9436b469f5095d4d6b59a10b9d01efe5bfb5.zip tcl-b3eb9436b469f5095d4d6b59a10b9d01efe5bfb5.tar.gz tcl-b3eb9436b469f5095d4d6b59a10b9d01efe5bfb5.tar.bz2 |
* generic/tclInt.h: remove comments refering to VAR_SCALAR, as
that flag bit does not exist any longer.
* generic/tclProc.c (InitCompiledLocals): removed optimisation for
non-resolved case, as the function is never called in that case.
FossilOrigin-Name: b9cc3486dd8ef1b6413f1fca7b05c9b086b3d1dd
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 135 |
1 files changed, 59 insertions, 76 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index 9a7a422..eb3f7e8 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.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: tclProc.c,v 1.127 2007/08/04 18:32:27 msofer Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.128 2007/08/08 18:34:40 msofer Exp $ */ #include "tclInt.h" @@ -1170,6 +1170,8 @@ InitCompiledLocals( int haveResolvers = (nsPtr->compiledVarResProc || iPtr->resolverPtr); CompiledLocal *firstLocalPtr, *localPtr; int varNum; + Tcl_ResolvedVarInfo *resVarInfo; + /* * Find the localPtr corresponding to varPtr @@ -1181,11 +1183,6 @@ InitCompiledLocals( localPtr = localPtr->nextPtr; } - /* - //FIXME: old bytecompiled code: drop whatever flags are coming in (except - //maybe for VAR_TEMPORARY? Who cares really?) A job for tbcload, not us. - */ - if (!(haveResolvers && (codePtr->flags & TCL_BYTECODE_RESOLVE_VARS))) { /* * Initialize the array of local variables stored in the call frame. @@ -1195,91 +1192,77 @@ InitCompiledLocals( */ doInitCompiledLocals: - if (!haveResolvers) { + for (; localPtr != NULL; varPtr++, localPtr = localPtr->nextPtr) { + varPtr->flags = 0; + varPtr->value.objPtr = NULL; + /* - * Should not be called: deadwood. + * Now invoke the resolvers to determine the exact variables + * that should be used. */ - for (; localPtr != NULL; varPtr++, localPtr = localPtr->nextPtr) { - varPtr->flags = localPtr->flags; - varPtr->value.objPtr = NULL; - } - return; - } else { - Tcl_ResolvedVarInfo *resVarInfo; - - for (; localPtr != NULL; varPtr++, localPtr = localPtr->nextPtr) { - varPtr->flags = localPtr->flags; - varPtr->value.objPtr = NULL; - - /* - * Now invoke the resolvers to determine the exact variables - * that should be used. - */ - - resVarInfo = localPtr->resolveInfo; - if (resVarInfo && resVarInfo->fetchProc) { - Var *resolvedVarPtr = (Var *) - (*resVarInfo->fetchProc)(interp, resVarInfo); - if (resolvedVarPtr) { - VarHashRefCount(resolvedVarPtr)++; - varPtr->flags = VAR_LINK; - varPtr->value.linkPtr = resolvedVarPtr; - } + resVarInfo = localPtr->resolveInfo; + if (resVarInfo && resVarInfo->fetchProc) { + Var *resolvedVarPtr = (Var *) + (*resVarInfo->fetchProc)(interp, resVarInfo); + if (resolvedVarPtr) { + VarHashRefCount(resolvedVarPtr)++; + varPtr->flags = VAR_LINK; + varPtr->value.linkPtr = resolvedVarPtr; } } - return; } - } else { - /* - * This is the first run after a recompile, or else the resolver epoch - * has changed: update the resolver cache. - */ + return; + } - firstLocalPtr = localPtr; - for (; localPtr != NULL; localPtr = localPtr->nextPtr) { - if (localPtr->resolveInfo) { - if (localPtr->resolveInfo->deleteProc) { - localPtr->resolveInfo->deleteProc(localPtr->resolveInfo); - } else { - ckfree((char *) localPtr->resolveInfo); - } - localPtr->resolveInfo = NULL; + /* + * This is the first run after a recompile, or else the resolver epoch + * has changed: update the resolver cache. + */ + + firstLocalPtr = localPtr; + for (; localPtr != NULL; localPtr = localPtr->nextPtr) { + if (localPtr->resolveInfo) { + if (localPtr->resolveInfo->deleteProc) { + localPtr->resolveInfo->deleteProc(localPtr->resolveInfo); + } else { + ckfree((char *) localPtr->resolveInfo); + } + localPtr->resolveInfo = NULL; + } + localPtr->flags &= ~VAR_RESOLVED; + + if (haveResolvers && + !(localPtr->flags & (VAR_ARGUMENT|VAR_TEMPORARY))) { + ResolverScheme *resPtr = iPtr->resolverPtr; + Tcl_ResolvedVarInfo *vinfo; + int result; + + if (nsPtr->compiledVarResProc) { + result = (*nsPtr->compiledVarResProc)(nsPtr->interp, + localPtr->name, localPtr->nameLength, + (Tcl_Namespace *) nsPtr, &vinfo); + } else { + result = TCL_CONTINUE; } - localPtr->flags &= ~VAR_RESOLVED; - - if (haveResolvers && - !(localPtr->flags & (VAR_ARGUMENT|VAR_TEMPORARY))) { - ResolverScheme *resPtr = iPtr->resolverPtr; - Tcl_ResolvedVarInfo *vinfo; - int result; - if (nsPtr->compiledVarResProc) { - result = (*nsPtr->compiledVarResProc)(nsPtr->interp, + while ((result == TCL_CONTINUE) && resPtr) { + if (resPtr->compiledVarResProc) { + result = (*resPtr->compiledVarResProc)(nsPtr->interp, localPtr->name, localPtr->nameLength, (Tcl_Namespace *) nsPtr, &vinfo); - } else { - result = TCL_CONTINUE; - } - - while ((result == TCL_CONTINUE) && resPtr) { - if (resPtr->compiledVarResProc) { - result = (*resPtr->compiledVarResProc)(nsPtr->interp, - localPtr->name, localPtr->nameLength, - (Tcl_Namespace *) nsPtr, &vinfo); - } - resPtr = resPtr->nextPtr; - } - if (result == TCL_OK) { - localPtr->resolveInfo = vinfo; - localPtr->flags |= VAR_RESOLVED; } + resPtr = resPtr->nextPtr; + } + if (result == TCL_OK) { + localPtr->resolveInfo = vinfo; + localPtr->flags |= VAR_RESOLVED; } } - localPtr = firstLocalPtr; - codePtr->flags &= ~TCL_BYTECODE_RESOLVE_VARS; - goto doInitCompiledLocals; } + localPtr = firstLocalPtr; + codePtr->flags &= ~TCL_BYTECODE_RESOLVE_VARS; + goto doInitCompiledLocals; } void |