D-Programming-Language/dmd — pull request #3547 by yglukhov (2014-05-14 07:54:21+00:00)
Title: Optional monitors

This PR introduces optional monitors feature.
The whole idea is that Object doesn't contain __monitor field anymore.
TypeInfo_Class will hold a monitor offset, if a class defines one (like void* __monitor), or -1.
Monitor lookup is done with a hash map, if monitorOffset is -1.
The hash map is protected by a primitive RW spin lock.
Monitor finalization will only lookup for monitors, if a monitor was allocated at least once for the type of object being finalized.

druntime counterpart: https://github.com/D-Programming-Language/druntime/pull/789