Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-07-12
21:59 • Closed ticket [1895546fff]: Problem with method caching plus 8 other changes artifact: 831a9a7f67 user: dkf
2008-05-21
21:45 • Ticket [1895546fff]: 4 changes artifact: d55be7f97b user: dkf
2008-05-01
20:30 • Ticket [1895546fff]: 4 changes artifact: 2b28c9463f user: dkf
2008-02-17
19:08 • New ticket [1895546fff]. artifact: 35e2d3d580 user: wiede

Problem with method caching

Closed / Fixed1895546fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 17 years ago
Descriptionplain2008-02-17 19:08:04
There seems to be a problem with method caching in the case of mapping method names, if there is no real mapping done:

tclOO.c

if (oPtr->mapMethodNameProc != NULL) {
:    
methodNamePtr = Tcl_DuplicateObj(methodNamePtr);
:
}

because of the call to Tcl_DuplicateObj there is no stashing as it seems to me, because 

TclOOStashContext(methodNamePtr, contextPtr);

uses the newly created methodNamePtr.
dkfplain2008-05-01 20:30:19
Logged In: YES 
user_id=79902
Originator: NO

The problem seems to be that there's a need to have a modifiable object and yet to write the cached value to a non-modifiable object. Will probably force a redesign of the API.
dkfplain2008-05-21 21:45:17
Logged In: YES 
user_id=79902
Originator: NO

Turned off caching when class chain traversing is used, which "fixes" things for now. Still need to do that redesign, but it's tricky.
dkfplain2009-07-12 21:59:43
allow_comments - 1

Fixed in Tcl HEAD (I think). At least some of the caches are applied to the string being mapped from. If the method name mapper returns TCL_BREAK, it will now fall back to the standard method lookup rules (don't return anything other than TCL_OK, TCL_ERROR or TCL_BREAK now; won't guarantee behaviour there any more).

I will not backport this change (unless you twist my arm/ask nicely).
Log in (anonymous is fine) to add a comment.