On 01 Dec 2011, at 10:03, Mariano Martinez Peck wrote:
That' would be very nice to have :)
Well, it is a bit of work, I suppose. You will need to adapt the image reading and spread them wider into your memory, adding that extra space in front of every object.
That also means you'll have to correct all the pointers in the objects. That's all kind of trivial with an object table you haven't got, I think. Perhaps, someone has code for that lying around on a dusty shelf?
Afterwards, if I remember correctly, it is mostly heap traversal that needs to be adapted.
We have all pointers still pointing to the real objects, and only the GC and traversal routines do know about the preheader. They just skip it. (Depending on what you want to put into the header, you might want to make the GC aware of that. I actually keep pointer there, and I think, that is currently not taken into account by the GC. oops...)
From there, you can just access it at a negative offset, almost like a normal object field (be careful with the variable width object header).
Here some hints in our code:
https://github.com/smarr/RoarVM/commit/2750484e5cf29248390d8c56a2a250a30e899... https://github.com/smarr/RoarVM/commit/5dcd6a1662d87a7d06a934957b1f2cce90778...
Best regards Stefan