On Fri, 24 May 2013, Simon Ochsenreither wrote:
>
> Perhaps, but if you only need a few extra bits per object, there
> may be
> more memory-efficient ways to track them than adding a whole
> extra word to
> each instance. �If you separate the bitsets from the objects
> themselves,
> you can store those bitsets much more compactly. �For example,
> if objects
> are allocated on 64KB pages and you need 2 bits per object for
> GC marking,
> you only need 2KB per page to store the bitsets, which is about
> 3%
> overhead, whereas if your average object size is 3 words, you
> end up with
> a 33% overhead when you add another word to each of them.
>
>
> Agree, although if only a few bits were necessary, it would also be possible
> to steal those bits from the class pointer (similar to Oracles compressed
> OOPS). Might be an interesting benchmark: it would add a shift operation to
> every access of the class pointer but would probably be more cache efficient
> than having a separate mark region.
We already do that, actually. We use one bit to determine whether or not
the object is copyable and another to determine whether its identity hash
code has been calculated (which is based on its address, so we need to
remember the original address if it is moved elsewhere in memory). That's
something I'd like to get away from, though, because it means we have to
mask the class pointer every time we want to follow it, including every
virtual method call. I don't know how much that impacts performance in
practice, but it certainly makes the code more complicated and ugly.