Bug 6103 – hasFinalizer field in ClassInfo

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-06-04T09:55:00Z
Last change time
2011-12-28T06:51:42Z
Keywords
performance
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-06-04T09:55:52Z
ClassInfo needs a hasFinalizer field that is true iff the class or its ancestor has a non-empty finalizer. This way, instead of conservatively flagging all GC-allocated objects with GC.BlkAttr.FINALIZE, only those that need to be finalized could be flagged. On this benchmark (https://github.com/dsimcha/druntime/blob/master/gcBench/tree1.d) avoiding calling empty finalizers results in about a 20% speedup.
Comment #1 by dsimcha — 2011-12-28T06:51:42Z
I'm marking this invalid even though it could be implemented because I realized it won't be useful. rt_finalize needs to be called to finalize the monitor object if one exists, even if the class has no explicit finalizer.