Skip to content
Tcl Source Code View Ticket
Login

View Ticket

oo methods fail to check compile epoch

Closed / Fixed2037727fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-08-04 16:22:18
% proc succeed args {}
% oo::object create example
::example
% oo::objdefine example method foo {} {succeed}
% example foo
% proc succeed {} {return succeed}
% example foo
%

Contrast with:

% proc succeed args {}
% proc foo {} {succeed}
% foo
% proc succeed {} {return succeed}
% foo
succeed

Something in OO method dispatch needs
revision to notice that a bump in
the compile epoch has made the bytecode
invalid before trying to execute it.

Uncovered this tracking down 2023112.
dgpplain2008-08-05 22:59:40
Logged In: YES 
user_id=80530
Originator: YES

dgpok, line 790 of tclOOMethod.c looks like the key to 2037727
miguelsimplified: possible, yes
miguell790 as culprit: guilty as charged
dgpso if I just remove that test and make the TPCP call unconditional...
dgpyes, that works
dgpplain2008-08-05 23:40:44
Logged In: YES 
user_id=80530
Originator: YES


no that doesn't work

This gets into a real mess trying
to call destructors during interp
deletion.
dgp Ticket [2037727fff]: 1 change [History diff]2008-08-06 03:51:16
dgpplain2008-08-07 04:02:02
Logged In: YES 
user_id=80530
Originator: YES


The mess with destructors and
interp deletion was another bug,
2039178.

There's a different mess now
with different instances of a
class trying to share the (Proc *)
of a class method, while also
trying to execute in different
namespaces.  This runs afoul
of the normal rules for verifying
bytecode validity.  Normally
bytecode created compiling a script
in one namespace is not acceptable
as a representation of the same script
in a different namespace.
dgpplain2008-08-07 04:24:43
Logged In: YES 
user_id=80530
Originator: YES


Committed tests to demonstrate the bug.
dgpplain2008-08-13 00:51:09
Logged In: YES 
user_id=80530
Originator: YES


Fix committed.

It appears that this bug fix, combined
with the namespace-per-instance design
of TclOO means that there will be frequent
re-compiles of class method bodies called
on different instances.  The TclOO master
designer may want to take a good look at this.
dkfplain2008-08-20 22:44:28
Logged In: YES 
user_id=79902
Originator: NO

Restored performance. I think I won't backport this stuff to TclOO-for-8.5; the breakage is minor for most code and the fix a little intrusive.
Log in (anonymous is fine) to add a comment.