Object file questions

Johannes Pfau via D.gnu d.gnu at puremagic.com
Sun Aug 17 01:23:58 PDT 2014


Am Sat, 16 Aug 2014 10:36:19 +0000
schrieb "Mike" <none at none.com>:

> On Saturday, 16 August 2014 at 09:29:14 UTC, Johannes Pfau wrote:
> 
> > I just had a look at this and ClassInfo has a mutable 'monitor' 
> > field,
> > so it can't be placed into read-only data.
> 
> This was discussed at DConf 2014.  
> https://www.youtube.com/watch?v=TNvUIWFy02I#t=1008
> 
> 
> There is currently a pull request to remove the monitor from 
> object field from object and therefore all classes: 
> https://github.com/D-Programming-Language/druntime/pull/789.
> 
> Mike

Great! But I think this pull request addresses a different monitor
problem: There's an implicit __monitor field in every class right now,
which makes every class _instance_ bigger.

But the monitor in TypeInfo/ClassInfo is different: ClassInfo exists
only once per class, it doesn't matter how many class instances you've
got. AFAIR this monitor is to support synchronize(ClassType) which
synchronizes on the class type, not on an instance.


More information about the D.gnu mailing list