summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2007-06-14 02:43:13 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2007-06-14 02:43:13 (GMT)
commit581f24016c998cd22f2affc43f5fbba975afdb2f (patch)
tree668a7f1170658e5a8066cd6978b97061e3352782 /generic/tclProc.c
parentf5e1bf03c4958605fef78a153d412ae9085fdb61 (diff)
downloadtcl-581f24016c998cd22f2affc43f5fbba975afdb2f.zip
tcl-581f24016c998cd22f2affc43f5fbba975afdb2f.tar.gz
tcl-581f24016c998cd22f2affc43f5fbba975afdb2f.tar.bz2
* generic/tclExecute.c (TclCompEvalObj): missed update to "there
is always a valid frame". * generic/tclProc.c (TclObjInterpProcCore): call TEBC directly instead of going through TclCompEvalObj - no need to check the compilation's freshness, this has already been done. This improves speed and should also provide some relief to [Bug 1066755].
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index f82458f..6450edc 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.116 2007/06/05 17:57:07 dgp Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.117 2007/06/14 02:43:15 msofer Exp $
*/
#include "tclInt.h"
@@ -1249,13 +1249,15 @@ ObjInterpProcEx(
* When we've got bytecode, this is the check for validity. That is,
* the bytecode must be for the right interpreter (no cross-leaks!),
* the code must be from the current epoch (so subcommand compilation
- * is up-to-date), and the namespace must match (so variable handling
- * is right).
+ * is up-to-date), the namespace must match (so variable handling
+ * is right) and the resolverEpoch must match (so that new shadowed
+ * commands and/or resolver changes are considered).
*/
if (((Interp *) *codePtr->interpHandle != iPtr)
|| (codePtr->compileEpoch != iPtr->compileEpoch)
- || (codePtr->nsPtr != nsPtr)) {
+ || (codePtr->nsPtr != nsPtr)
+ || (codePtr->nsEpoch != nsPtr->resolverEpoch)) {
goto doCompilation;
}
} else {
@@ -1324,6 +1326,7 @@ TclObjInterpProcCore(
* results of the overall procedure. */
{
register Proc *procPtr = framePtr->procPtr;
+ ByteCode *codePtr = procPtr->bodyPtr->internalRep.otherValuePtr;
register Var *varPtr;
register CompiledLocal *localPtr;
int localCt, numArgs, argCt, i, imax, result;
@@ -1429,7 +1432,6 @@ TclObjInterpProcCore(
Tcl_IncrRefCount(objPtr); /* Local var is a reference. */
} else {
Tcl_Obj **desiredObjs;
- ByteCode *codePtr;
const char *final;
/*
@@ -1439,7 +1441,6 @@ TclObjInterpProcCore(
incorrectArgs:
final = NULL;
- codePtr = procPtr->bodyPtr->internalRep.otherValuePtr;
InitCompiledLocals(interp, codePtr, localPtr, varPtr, framePtr->nsPtr);
/*
@@ -1508,8 +1509,6 @@ TclObjInterpProcCore(
runProc:
if (localPtr) {
- ByteCode *codePtr = procPtr->bodyPtr->internalRep.otherValuePtr;
-
InitCompiledLocals(interp, codePtr, localPtr, varPtr, framePtr->nsPtr);
}
@@ -1534,13 +1533,20 @@ TclObjInterpProcCore(
*/
procPtr->refCount++;
+ ((Interp *)interp)->numLevels++;
- /*
- * TIP #280: No need to set the invoking context here. The body has
- * already been compiled, so the part of CompEvalObj using it is bypassed.
- */
-
- result = TclCompEvalObj(interp, procPtr->bodyPtr, NULL, 0);
+ if (TclInterpReady(interp) == TCL_ERROR) {
+ result = TCL_ERROR;
+ } else {
+ codePtr->refCount++;
+ result = TclExecuteByteCode(interp, codePtr);
+ codePtr->refCount--;
+ if (codePtr->refCount <= 0) {
+ TclCleanupByteCode(codePtr);
+ }
+ }
+
+ ((Interp *)interp)->numLevels--;
procPtr->refCount--;
if (procPtr->refCount <= 0) {
TclProcCleanupProc(procPtr);
@@ -1683,7 +1689,8 @@ ProcCompileProc(
if (bodyPtr->typePtr == &tclByteCodeType) {
if (((Interp *) *codePtr->interpHandle == iPtr)
&& (codePtr->compileEpoch == iPtr->compileEpoch)
- && (codePtr->nsPtr == nsPtr)) {
+ && (codePtr->nsPtr == nsPtr)
+ && (codePtr->nsEpoch == nsPtr->resolverEpoch)) {
return TCL_OK;
} else {
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
@@ -1838,6 +1845,7 @@ ProcCompileProc(
* resolver cache.
*/
+ codePtr->nsEpoch = nsPtr->resolverEpoch;
codePtr->flags |= TCL_BYTECODE_RESOLVE_VARS;
}
return TCL_OK;