|
From: Andreas R. <and...@gm...> - 2005-01-19 01:28:54
|
Folks, After some talking to Ian today he convinced to finally fix the one remaining issue with weak arrays, namely that weak arrays in old space hold on strongly to values in young space and therefore prevent those values to be garbage collected. Fixing this turned actually out to be almost trivial - it's about ten lines of code or so and I really don't understand why I didn't fix this in the original version (but what the heck...) Since this exercise was so easy, I also added a number of GC related primitives all of which would have saved my day at some point in the past: * primitiveIsYoung: This answers the question whether an object currently lives in young or in old space. * primitiveIsRoot: Answers the question whether any given object is currently a root for young space. * primitiveRootTable: Answers a snapshot of the current root table. Useful to examine the roots table if the analysis requires complex other operations during which the root table might be modified itself. Note that since this primitive can cause GC there is a small chance that it will give an inaccurate answer. * primitiveRootTableAt: Answers a single element of the root table (by one-based index). This primitive can be used to quickly scan the root table for certain objects. * primitiveSetGCSemaphore: Indicates a semaphore (index) to be signaled whenever a garbage collection occurs. I can see at least two uses uses for the GC semaphore: running cleanup actions (for example after full GCs occured) and dynamic parameter tuning for the GC algorithm itself. Tim - is there any chance that we can get these changes into the 3.8 VMMaker? This stuff will be critical for the next Tweak version and having it in the official 3.8 would heavily simplify migration. Cheers, - Andreas |