summaryrefslogtreecommitdiffstats
path: root/generic/tclOOCall.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-07-12 14:51:30 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-07-12 14:51:30 (GMT)
commit08c08fbd919645722f3a2fe5db61c2e4dfa97d2c (patch)
tree6e718b7c6384b7ada1efaa63ce6b8177eb7ca225 /generic/tclOOCall.c
parent044907f34579d3b64afa81854a8b9ffce76562ad (diff)
downloadtcl-08c08fbd919645722f3a2fe5db61c2e4dfa97d2c.zip
tcl-08c08fbd919645722f3a2fe5db61c2e4dfa97d2c.tar.gz
tcl-08c08fbd919645722f3a2fe5db61c2e4dfa97d2c.tar.bz2
Reorganize method cache handling a bit to better support itcl nasty cases.
[Bug 1895546]
Diffstat (limited to 'generic/tclOOCall.c')
-rw-r--r--generic/tclOOCall.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c
index c4b9ab2..e9760f7 100644
--- a/generic/tclOOCall.c
+++ b/generic/tclOOCall.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOOCall.c,v 1.13 2008/10/16 22:34:18 nijtmans Exp $
+ * RCS: @(#) $Id: tclOOCall.c,v 1.14 2009/07/12 14:51:30 dkf Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -897,10 +897,13 @@ TclOOGetCallContext(
Tcl_Obj *methodNameObj, /* The name of the method to get the context
* for. NULL when getting a constructor or
* destructor chain. */
- int flags) /* What sort of context are we looking for.
+ int flags, /* What sort of context are we looking for.
* Only the bits PUBLIC_METHOD, CONSTRUCTOR,
* PRIVATE_METHOD, DESTRUCTOR and
* FILTER_HANDLING are useful. */
+ Tcl_Obj *cacheInThisObj) /* What object to cache in, or NULL if it is
+ * to be in the same object as the
+ * methodNameObj. */
{
CallContext *contextPtr;
CallChain *callPtr;
@@ -909,6 +912,9 @@ TclOOGetCallContext(
Tcl_HashEntry *hPtr;
Tcl_HashTable doneFilters;
+ if (cacheInThisObj == NULL) {
+ cacheInThisObj = methodNameObj;
+ }
if (flags&(SPECIAL|FILTER_HANDLING) || (oPtr->flags&FILTER_HANDLING)) {
hPtr = NULL;
doFilters = 0;
@@ -944,13 +950,13 @@ TclOOGetCallContext(
const int reuseMask = ((flags & PUBLIC_METHOD) ? ~0 : ~PUBLIC_METHOD);
- if (methodNameObj->typePtr == &methodNameType) {
- callPtr = methodNameObj->internalRep.otherValuePtr;
+ if (cacheInThisObj->typePtr == &methodNameType) {
+ callPtr = cacheInThisObj->internalRep.otherValuePtr;
if (IsStillValid(callPtr, oPtr, flags, reuseMask)) {
callPtr->refCount++;
goto returnContext;
}
- methodNameObj->typePtr->freeIntRepProc(methodNameObj);
+ cacheInThisObj->typePtr->freeIntRepProc(cacheInThisObj);
}
if (oPtr->flags & USE_CLASS_CACHE) {
@@ -1067,7 +1073,7 @@ TclOOGetCallContext(
}
callPtr->refCount++;
Tcl_SetHashValue(hPtr, callPtr);
- StashCallChain(methodNameObj, callPtr);
+ StashCallChain(cacheInThisObj, callPtr);
} else if (flags & CONSTRUCTOR) {
if (oPtr->selfCls->constructorChainPtr) {
TclOODeleteChain(oPtr->selfCls->constructorChainPtr);