[hazards] Virtual method resolution is incorrect/incomplete
Categories
(Core :: JavaScript: GC, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox71 | --- | affected |
People
(Reporter: sfink, Assigned: sfink)
References
(Depends on 4 open bugs, Blocks 1 open bug)
Details
Attachments
(7 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
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•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D46542
Assignee | ||
Comment 4•5 years ago
|
||
Allows future support for attributes on virtual method declarations.
Also fixes 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.
Depends on D46543
Assignee | ||
Comment 5•5 years ago
|
||
Pushed by sfink@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/42d646d94f82 Clean up some test code warnings and switch to python3 for print(flush=True). r=jonco
Pushed by sfink@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a250a3f9b5db Minor improvement to type display r=jonco https://hg.mozilla.org/integration/autoland/rev/8c6f9730f77d [hazards] Comments and refactoring r=jonco
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/42d646d94f82
https://hg.mozilla.org/mozilla-central/rev/a250a3f9b5db
https://hg.mozilla.org/mozilla-central/rev/8c6f9730f77d
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Oops, I should have marked this leave-open. The 4th patch still needs to land, and can't. I landed the others because they are refactoring prerequisites for some other bugs to land. But the final patch here is the only one that really matters for this bug.
Updated•5 years ago
|
Comment 10•4 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:sfink, maybe it's time to close this bug?
Assignee | ||
Comment 11•4 years ago
|
||
(In reply to Release mgmt bot [:sylvestre / :calixte / :marco for bugbug] from comment #10)
The leave-open keyword is there and there is no activity for 6 months.
:sfink, maybe it's time to close this bug?
I should probably comment on at least one of these.
The patches are still good, still ready to land, but cannot land until I sort out some issues in Gecko code that block this landing. I'd like to get back to it, but it's lower priority behind some other stuff.
Comment 12•4 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:sfink, maybe it's time to close this bug?
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 13•3 years ago
|
||
Comment 14•3 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:sfink, maybe it's time to close this bug?
Assignee | ||
Comment 15•3 years ago
|
||
Still blocked. Working on the blockage, somewhat.
Assignee | ||
Comment 16•3 years ago
|
||
Assignee | ||
Comment 17•3 years ago
|
||
Comment 18•3 years ago
|
||
Pushed by sfink@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fdf6082fd2f7 [hazards] Manually mark more things as non-overridable (necessary to fix virtual method resolution without causing hazards, as it will now be able to see paths to these methods.) Temporary measure until this can be automated. r=jonco https://hg.mozilla.org/integration/autoland/rev/51209698131d [hazards] Rework how virtual methods are handled, r=jonco https://hg.mozilla.org/integration/autoland/rev/6ecec0210bf1 Suppress hazard false alarms coming from std::swap calling refcounted operator=() in a context that will never drop a refcount to zero r=jonco https://hg.mozilla.org/integration/autoland/rev/30d9c0309fcb Handle virtual destructors r=jonco
Comment 19•3 years ago
|
||
Pushed by nbeleuzu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/63468c1ba08f Fix lint failure. r=fix CLOSED TREE
Comment 20•3 years ago
|
||
bugherder |
Assignee | ||
Comment 21•3 years ago
|
||
(removing leave-open)
Description
•