summaryrefslogtreecommitdiffstats
path: root/generic/tclOOMethod.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-08-20 15:41:20 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-08-20 15:41:20 (GMT)
commitfaa29c2fefd6d227c3dad33bb98df241a38006bf (patch)
tree47c02de5808411400f650d853de4bcf335527b8c /generic/tclOOMethod.c
parent37a1fa926eb75cc4aee1113d06f594adaa5e6f20 (diff)
downloadtcl-faa29c2fefd6d227c3dad33bb98df241a38006bf.zip
tcl-faa29c2fefd6d227c3dad33bb98df241a38006bf.tar.gz
tcl-faa29c2fefd6d227c3dad33bb98df241a38006bf.tar.bz2
Fix performance bug introduced by fix of [Bug 2037727]
Diffstat (limited to 'generic/tclOOMethod.c')
-rw-r--r--generic/tclOOMethod.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index c977a3b..0110283 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOOMethod.c,v 1.13 2008/08/12 17:51:03 dgp Exp $
+ * RCS: @(#) $Id: tclOOMethod.c,v 1.14 2008/08/20 15:41:26 dkf Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -16,6 +16,7 @@
#endif
#include "tclInt.h"
#include "tclOOInt.h"
+#include "tclCompile.h"
/*
* Structure used to help delay computing names of objects or classes for
@@ -787,17 +788,25 @@ PushMethodCallFrame(
fdPtr->cmd.clientData = &fdPtr->efi;
pmPtr->procPtr->cmdPtr = &fdPtr->cmd;
- /*
- * [Bug 2037727] Always call TclProcCompileProc so that we check not
- * only that we have bytecode, but also that it remains valid.
+ /*
+ * [Bug 2037727] Always call TclProcCompileProc so that we check not only
+ * that we have bytecode, but also that it remains valid. Note that we set
+ * the namespace of the code here directly; this is a hack, but the
+ * alternative is *so* slow...
*/
- result = TclProcCompileProc(interp, pmPtr->procPtr,
- pmPtr->procPtr->bodyPtr, (Namespace *) nsPtr,
- "body of method", namePtr);
- if (result != TCL_OK) {
- return result;
- }
+ if (pmPtr->procPtr->bodyPtr->typePtr == &tclByteCodeType) {
+ ByteCode *codePtr =
+ pmPtr->procPtr->bodyPtr->internalRep.otherValuePtr;
+
+ codePtr->nsPtr = nsPtr;
+ }
+ result = TclProcCompileProc(interp, pmPtr->procPtr,
+ pmPtr->procPtr->bodyPtr, (Namespace *) nsPtr, "body of method",
+ namePtr);
+ if (result != TCL_OK) {
+ return result;
+ }
/*
* Make the stack frame and fill it out with information about this call.