[hazards] Virtual method resolution is incorrect/incomplete
Categories
(Core :: JavaScript: GC, enhancement)
Tracking
()
People
(Reporter: sfink, Assigned: sfink)
References
(Blocks 1 open bug)
Details
Fix the search path for virtual method implementations: for example static types that inherit their implementations from a base class will currently think that "sibling" classes' implementations are possible.
Base
| \
| \
Class Sibling
|
|
Subclass
Class *c = ...;
c->foo();
If Base::foo is declared as pure virtual, and Subclass and Sibling both override foo() but Class does not, then the call of c->foo() can only invoke Subclass::foo. Previously, we would see that c->foo() calls Base.foo (because foo is inherited from Base) and do a descendant search starting from Base rather than Class.
In the same situation except where Base::foo is defined (as a virtual method), then c->foo() might call either Subclass::foo() or Base::foo(), but still not Sibling::foo().
This turns out to be important for handling methods that are defined at the base of a large class hierarchy that overrides the implementation in the leaves but not the middle ("interface-y") classes. With this patch, you'll only consider the subtree rooted at your static type. Without, you'll assume it could call any of the implementations in the tree.
Assignee | ||
Updated•6 years ago
|
Description
•