I don't doubt your reasons, but then again, you have what you have right now in D. Asking for more, you have to provide it, or convince others to. If it's the latter, you need to make a very very strong case.
I want to provide it, but before i do, i want to know if there were any decisions made earlier, that would render my work useless. I mean, i have to know all possible cons for not having __monitor in an instance.

What i suggest is the following:
- Object does not have any __monitor field by default.
- One can add a __monitor object to his class.
- Offset to monitor is stored in TypeInfo. -1 if doesn't exist.
- synchronized() inspects typeInfo. If an object has monitor, then it is used. Otherwise, the monitor is allocated/looked up in a global hash-table from object pointer to monitor.

This way we could achieve performance in terms of both speed and memory. Also old code would not break.

Some additional optimizations might always include a __monitor field to a class, if compiler can prove, that this class is being synchronized on.

Reply via email to