Closed Bug 635899 Opened 14 years ago Closed 14 years ago

Remove redundant explicit destructors from managed objects

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Q1 12 - Brannan

People

(Reporter: lhansen, Assigned: lhansen)

References

Details

(Whiteboard: has-patch)

Attachments

(1 file, 7 obsolete files)

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.
Attached patch Patch (obsolete) — Splinter Review
GCFinalizedObject already provides an empty virtual destructor; derived classes need not do it.
Attachment #514185 - Flags: review?(stejohns)
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+
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...
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
Blocks: 627025
Target Milestone: --- → flash11-Nigel
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)
(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')
Attachment #515054 - Flags: review?(treilly)
Attached patch Mark DRC-only destructors (obsolete) — Splinter Review
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)
Empty destructor already inherited from above, we don't need another one here.
Attachment #515083 - Flags: review?(stejohns)
Attachment #515049 - Attachment is obsolete: true
Attachment #515049 - Flags: review?(treilly)
Attachment #515084 - Flags: review?(treilly)
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)
Attachment #515083 - Flags: review?(stejohns) → review+
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.
Attachment #514185 - Attachment is obsolete: true
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
Attachment #515083 - Attachment is obsolete: true
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
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)
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)
Whiteboard: has-patch
Depends on: 636703
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 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+
Attachment #515317 - Flags: review?(stejohns) → review+
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?
(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.
Attachment #515317 - Attachment is obsolete: true
Attachment #515084 - Attachment is obsolete: true
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
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
Attachment #515094 - Flags: review?(treilly) → review+
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
Closing this; work remains on the Flash Player side of the fence though.
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.

Attachment

General

Creator:
Created:
Updated:
Size: