>> Etienne Gagnon wrote: >> > My proposal already argued that vtable bit/byte/word marking is >> > unnecessary for "nursery allocations". You only need to mark the >> vtable >> > of objects that survive collection and pretenured objects.
Alexey Varlamov wrote: > I may have missed it, but I only recall you argued that we just need > to collect mature space for the *final unloading* as CL and classes > are unlikely to die young, which I agree. But chances that a live > object of a candidate class appeared in the nursery are higher. > Otherwise I just do not grok how this algorithm can be proven for > correctness. Alexey, it looks like what you are thinking about is *concurrent* collector, and concurrent garbage collections brings substantial complexity even without class unloading. However, the design we were discussing was for *stop-the-world* garbage collectors, because this is the only thing currently supported by DRLVM, and all existing GCs are stop-the-world. So, the correctness of unloading algorithm can easily be proved if we consider that the "final unloading" collection is a full heap collection, i.e. both nursery and mature space is collected. I have another concern though: just before starting "final unloading" collection, we scan vtable marks and identify the candidates for unloading. During the "final unloading" collection, the candidate classloader roots are reported as week. At the end of the trace, we need to rescan vtable marks and "revive" the classloader which were found in possession of live objects. This techniques is exactly the same as the one used for object finalization. However, in contrast with finalization, we will need to repeat reviving classloaders which have non-0 vtable marks until the process converges, and no new classloaders are revived. (* in finalization, both dead and live objects in finalization queue are revived, and thus the revival converges in just 1 step *).