by davidsiems · 14y ago · 0 comments
Adding another variable was thrashing the cache, so instead the GC would tag the VFT pointer (making it unusable obviously) and then untag it before GC ended, fixing the object.
I wasn't sure if I should be horrified or applaud when I found out about this.
So I wrote some code that constructed a new object of the same type on the stack, then
memcpy(&realObject, &stackObject,
(char * )&stackObject.m_firstDataMember - (char * )&stackObject));
It worked. I'm not proud of it, but I am amused by it. I'm sure it wasn't guaranteed to work by any standard, but in practice worked fine for us.