[Gc] Switching the atomic property of an object

Alex Rønne Petersen xtzgzorex at gmail.com
Wed Jun 13 17:40:26 PDT 2012


Hi,

In my virtual machine where I'm using libgc, every object has a header
that contains a potential pointer into GC-allocated memory. This
currently forces me to never allocate memory as atomic, even if I know
that the object body itself will contain no GC pointers. The potential
pointer in object headers is simply a user data field of sorts. For
the vast majority of objects, it will never be set. This is a bit of
an annoying situation, since I have to be conservative just because of
that one potential pointer.

So my question is this: Is there any way to flag on/off whether an
object is atomic? If there is, I could simply set the atomic flag when
the potential GC pointer is set to a non-null value, and unset it when
it's set to null. Also, relatedly, do you think this would be too
wasteful and/or not worth the effort?

Thanks in advance!

Regards,
Alex


More information about the Gc mailing list