Closed
Bug 635899
Opened 14 years ago
Closed 14 years ago
Remove redundant explicit destructors from managed objects
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Q1 12 - Brannan
People
(Reporter: lhansen, Assigned: lhansen)
References
Details
(Whiteboard: has-patch)
Attachments
(1 file, 7 obsolete files)
11.21 KB,
patch
|
treilly
:
review+
stejohns
:
review+
|
Details | Diff | Splinter Review |
Destructors in managed objects are undesirable in the glorious non-RC future, and I'm doing some prep work for that project. One item is to remove destructors that are not needed.
Assignee | ||
Comment 1•14 years ago
|
||
GCFinalizedObject already provides an empty virtual destructor; derived classes need not do it.
Attachment #514185 -
Flags: review?(stejohns)
Comment 2•14 years ago
|
||
Comment on attachment 514185 [details] [diff] [review]
Patch
Maybe insert an assert into ~DebugFrame to reinforce that it shouldn't get called.
Attachment #514185 -
Flags: review?(stejohns) → review+
Assignee | ||
Comment 3•14 years ago
|
||
The comment was carefully worded to point out that the GC would never call the destructor; that does not prevent other code from calling the destructor ;) Whether that's a bug or not...
Comment 4•14 years ago
|
||
changeset: 5958:90412070d15c
user: Lars T Hansen <lhansen@adobe.com>
summary: For 635899 - Remove redundant explicit destructors from managed objects: avmplusDebugger.h (r=stejohns)
http://hg.mozilla.org/tamarin-redux/rev/90412070d15c
Assignee | ||
Comment 5•14 years ago
|
||
It's pretty special purpose, and of course it has some known weaknesses, but it's useful and I'd like to land it so that it does not get lost. Let me know what you think.
Attachment #515049 -
Flags: review?(treilly)
Assignee | ||
Comment 6•14 years ago
|
||
(In reply to comment #5)
> Created attachment 515049 [details] [diff] [review]
> A script that find subclasses of GCFinalizedObject
If you want to see it in action, try this at the root of TR:
$ avmshell utils/gcClasses.abc -- $(find . -name '*.h' -o -name '*.cpp')
Assignee | ||
Comment 7•14 years ago
|
||
Attachment #515054 -
Flags: review?(treilly)
Assignee | ||
Comment 8•14 years ago
|
||
This patch introduces an #ifdef, DRC_TRIVIAL_DESTRUCTOR, that can be wrapped around destructors that only exist to clear out fields in the class for DRC. The define is always on and introduces no functional change.
The patch contains an update to the earlier script that ignores those destructors when dumping the class tree with destructor annotations.
The purpose of the new #ifdef is to allow me to go through the Flash Player source code - I've done all the VM classes in this patch - and mark destructors that are candidates to be nuked if DRC goes away. The purpose of that again is of course to find out where there are destructors that need to become finalizers, because knowing what those look like will help us define a reasonable finalization facility.
Alas this approach is not perfect because a member structure of a class without a destructor can itself have a destructor that will be run as part of the outer class's generated destructor. We have to hunt for those cases separately.
Attachment #515057 -
Flags: review?(treilly)
Attachment #515057 -
Flags: review?(stejohns)
Assignee | ||
Comment 9•14 years ago
|
||
Empty destructor already inherited from above, we don't need another one here.
Attachment #515083 -
Flags: review?(stejohns)
Assignee | ||
Comment 10•14 years ago
|
||
Attachment #515049 -
Attachment is obsolete: true
Attachment #515049 -
Flags: review?(treilly)
Attachment #515084 -
Flags: review?(treilly)
Assignee | ||
Comment 11•14 years ago
|
||
Added one more class. This leaves ArrayObject and String as the only ScriptObject subclasses in Tamarin that are finalizable, and in both cases it's to delete dependent memory. The only other RCObject subtype that's finalizable is CompiledRegExp. Another ten subtypes of GCFinalizedObject are finalizable.
Attachment #515057 -
Attachment is obsolete: true
Attachment #515057 -
Flags: review?(treilly)
Attachment #515057 -
Flags: review?(stejohns)
Attachment #515094 -
Flags: review?(treilly)
Attachment #515094 -
Flags: review?(stejohns)
Updated•14 years ago
|
Attachment #515083 -
Flags: review?(stejohns) → review+
Comment 12•14 years ago
|
||
Comment on attachment 515094 [details] [diff] [review]
Mark DRC-only destructors, v2
Technically, ~ScriptObject does more than just zero out fields, it decrements refcounts too.
Assignee | ||
Updated•14 years ago
|
Attachment #514185 -
Attachment is obsolete: true
Comment 13•14 years ago
|
||
changeset: 5991:89d8259130ad
user: Lars T Hansen <lhansen@adobe.com>
summary: For 635899 - Remove redundant explicit destructors from managed objects: Nuke two more trivial, pointless destructors (r pending from treilly)
http://hg.mozilla.org/tamarin-redux/rev/89d8259130ad
Assignee | ||
Updated•14 years ago
|
Attachment #515083 -
Attachment is obsolete: true
Comment 14•14 years ago
|
||
changeset: 5992:91c78477902c
user: Lars T Hansen <lhansen@adobe.com>
summary: For 635899 - Remove redundant explicit destructors from managed objects: Nuke yet another trivial, pointless destructor (r=stejohns)
http://hg.mozilla.org/tamarin-redux/rev/91c78477902c
Assignee | ||
Comment 15•14 years ago
|
||
Comment on attachment 515054 [details] [diff] [review]
Nuke two more trivial, pointless destructors
Pushed while waiting for review.
Attachment #515054 -
Attachment is obsolete: true
Attachment #515054 -
Flags: review?(treilly)
Assignee | ||
Comment 16•14 years ago
|
||
The destructor was never called. It could not be called by the GC (because it was not a GCFinalizedObject) and its effect was only to free memory anyway.
Attachment #515317 -
Flags: review?(stejohns)
Assignee | ||
Updated•14 years ago
|
Whiteboard: has-patch
Comment 17•14 years ago
|
||
Comment on attachment 515084 [details] [diff] [review]
A script that find subclasses of GCFinalizedObject, v2
Didn't review carefully, its doc'd well and I assume it works as advertised.
Attachment #515084 -
Flags: review?(treilly) → review+
Comment 18•14 years ago
|
||
Comment on attachment 515094 [details] [diff] [review]
Mark DRC-only destructors, v2
R+ on the condition that we add a comment to the ifdef around ~ScriptObject; technically it does more than "just zero out" but morally it fits properly with the semantics of the ifdef.
Attachment #515094 -
Flags: review?(stejohns) → review+
Updated•14 years ago
|
Attachment #515317 -
Flags: review?(stejohns) → review+
Comment 19•14 years ago
|
||
Comment on attachment 515094 [details] [diff] [review]
Mark DRC-only destructors, v2
Seems harmless but I'm not sure I see the value, why do we want this? Is this underpinning for future work?
Assignee | ||
Comment 20•14 years ago
|
||
(In reply to comment #19)
> Comment on attachment 515094 [details] [diff] [review]
> Mark DRC-only destructors, v2
>
> Seems harmless but I'm not sure I see the value, why do we want this? Is this
> underpinning for future work?
Yes. I'm analyzing the object population in an effort to discover the objects that truly need finalization, if RC is gone. These markers aid in that analysis and help preserve the analysis results for the future.
Assignee | ||
Updated•14 years ago
|
Attachment #515317 -
Attachment is obsolete: true
Assignee | ||
Updated•14 years ago
|
Attachment #515084 -
Attachment is obsolete: true
Comment 21•14 years ago
|
||
changeset: 6001:503049c1d00e
user: Lars T Hansen <lhansen@adobe.com>
summary: For 635899 - Remove redundant explicit destructors from managed objects: Remove MultinameHashtable destructor (r=stejohns)
http://hg.mozilla.org/tamarin-redux/rev/503049c1d00e
Comment 22•14 years ago
|
||
changeset: 6002:f79ba489cd47
user: Lars T Hansen <lhansen@adobe.com>
summary: For Bug 635899 - Remove redundant explicit destructors from managed objects: A script that find subclasses of GCFinalizedObject, v2 (r=treilly)
http://hg.mozilla.org/tamarin-redux/rev/f79ba489cd47
Updated•14 years ago
|
Attachment #515094 -
Flags: review?(treilly) → review+
Comment 23•14 years ago
|
||
changeset: 6023:601bf912c893
user: Lars T Hansen <lhansen@adobe.com>
summary: For 635899 - Remove redundant explicit destructors from managed objects: Mark DRC-only destructors, v2 (r=stejohns, r=treilly)
http://hg.mozilla.org/tamarin-redux/rev/601bf912c893
Assignee | ||
Comment 24•14 years ago
|
||
Closing this; work remains on the Flash Player side of the fence though.
Assignee | ||
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•