Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Alexey Varlamov
[snip] My proposal has been measured at ~1% overhead in GC time, or 0.1% in execution time (caveats as above). If there is some complexity in establishing classloader reachability from this basis, I would assume it can easliy be absorbed. Sorry if it was already discussed, but I

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Robin Garner
Etienne Gagnon wrote: Alexey Varlamov wrote: Sorry if it was already discussed, but I believe this approach also requires marking vtable bit/byte on each object allocation, unitl the unloading GC pass is strictly stop-the-world full-heap collection. Robin, did you include this particular

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Salikh Zakirov
Robin Garner wrote: Etienne Gagnon wrote: 3- Why would it be so hard to add an unconditional write operation during collection (e.g. during copying or marking of an object) in drlvm? A detailed technical explanation is welcome. :-) I actually believe that this should be implementable in a

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Salikh Zakirov wrote: Technically, it should not be too difficult to add an additional field to the VTable structure, and require GC to write 1 there during object scanning. However, if the VTable mark is located in the same cache line as gcmap, it may severely hit parallel GC performance on

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Robin Garner
Alexey Varlamov wrote: 2006/11/9, Robin Garner [EMAIL PROTECTED]: Etienne Gagnon wrote: Alexey Varlamov wrote: Sorry if it was already discussed, but I believe this approach also requires marking vtable bit/byte on each object allocation, unitl the unloading GC pass is strictly

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
OK. My latest proposal (a few messages ago) was assuming that the nursery was empty when the end of epoch collection is launched. If it is not, you can do 2 things: a) do a minor collection to empty it, or b) i - use a finalization-like list of references to class loader

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Salikh Zakirov
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

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Robin Garner
Etienne Gagnon wrote: OK. My latest proposal (a few messages ago) was assuming that the nursery was empty when the end of epoch collection is launched. If it is not, you can do 2 things: a) do a minor collection to empty it, or b) i - use a finalization-like list of references to class

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Salikh Zakirov wrote: 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

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Etienne Gagnon wrote: Salikh Zakirov wrote: 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

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Salikh Zakirov
Etienne Gagnon wrote: Revival is only needed if you use the finalization-like approach. If you only do class-unloading GC when the nursery is empty, then no revival is needed. Ah, I think I got it. You mean running a minor collection, and then class unloading full heap collection

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Salikh Zakirov wrote: Ah, I think I got it. Yep. 3) trace the heap 4) scan vtable marks and revive marked class unloaders, by adding the strong root from the previously collected unload list. Remove the revived classloaders from unload list. 5) repeat steps (3) and (4) until

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Ivan Volosyuk
On 11/9/06, Etienne Gagnon [EMAIL PROTECTED] wrote: Salikh Zakirov wrote: Technically, it should not be too difficult to add an additional field to the VTable structure, and require GC to write 1 there during object scanning. However, if the VTable mark is located in the same cache line as

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Ivan Volosyuk wrote: We will get rid of false sharing. That's true. But it still be quite expensive to write those '1' values, because of ping-ponging of the cache line between processors. I see only one solution to this: use separate mark bits in vtable per GC thread which should reside in

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Salikh Zakirov
Etienne Gagnon wrote: 3) trace the heap 4) scan vtable marks and revive marked class unloaders, by adding the strong root from the previously collected unload list. Remove the revived classloaders from unload list. 5) repeat steps (3) and (4) until there is no classloaders to

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Salikh Zakirov wrote: 7) let the GC finish collection and reclaim unreachable objects -- this reclaims java objects Just a bit of a warning... This should be integrated within the weak/soft/phantom + finalization framework. We definitely don't want the native resources of a class loader to

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Etienne Gagnon
Ivan Volosyuk wrote: We will get rid of false sharing. That's true. But it still be quite expensive to write those '1' values, because of ping-ponging of the cache line between processors. I see only one solution to this: use separate mark bits in vtable per GC thread which should reside in

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Salikh Zakirov
Etienne Gagnon wrote: Ivan Volosyuk wrote: We will get rid of false sharing. That's true. But it still be quite expensive to write those '1' values, because of ping-ponging of the cache line between processors. I see only one solution to this: use separate mark bits in vtable per GC thread

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Salikh Zakirov
Etienne Gagnon wrote: Salikh Zakirov wrote: 7) let the GC finish collection and reclaim unreachable objects -- this reclaims java objects Just a bit of a warning... This should be integrated within the weak/soft/phantom + finalization framework. We definitely don't want the native

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Ivan Volosyuk
On 11/9/06, Etienne Gagnon [EMAIL PROTECTED] wrote: Ivan Volosyuk wrote: We will get rid of false sharing. That's true. But it still be quite expensive to write those '1' values, because of ping-ponging of the cache line between processors. I see only one solution to this: use separate mark

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Robin Garner
Ivan Volosyuk wrote: On 11/9/06, Etienne Gagnon [EMAIL PROTECTED] wrote: Ivan Volosyuk wrote: We will get rid of false sharing. That's true. But it still be quite expensive to write those '1' values, because of ping-ponging of the cache line between processors. I see only one solution to

Re: [drlvm] Class unloading support - tested one approach

2006-11-09 Thread Alexey Varlamov
[snip] Alexey, it looks like what you are thinking about is *concurrent* collector, and concurrent garbage collections brings substantial complexity even without class unloading. Salikh, You are correct. Maybe I'm running ahead of the train, but my concern is that scalability of unloading

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Robin Garner
Aleksey Ignatenko wrote: Hi, Robin. I do really like this proposed idea of marking VTables from objects via additional word field in VTable. But I have one question about detecting reachability of the classloaders (sweep the vtables and check the reachability of the classloaders). Possibly I

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Pavel Pervov
Robin, The kind of model I had in mind was along the lines of: - VM maintains a linked list (or other collection type) of the currently loaded classloaders, each of which in turn maintains the collection of classes loaded by that type. The sweep of classloaders goes something like: for

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Aleksey Ignatenko
Robin. OK, well how about keeping a weak reference to the j.l.ClassLoader object instead of a strong one. When the reference becomes (strong)ly unreachable, invoke the class-unloading phase. If you have weak reference to j.l.Classloader - GC will collect it (with all appropriate jlClasses)

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Robin Garner
Aleksey Ignatenko wrote: Robin. OK, well how about keeping a weak reference to the j.l.ClassLoader object instead of a strong one. When the reference becomes (strong)ly unreachable, invoke the class-unloading phase. If you have weak reference to j.l.Classloader - GC will collect it (with

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Robin Garner
Robin Garner wrote: Aleksey Ignatenko wrote: Robin. OK, well how about keeping a weak reference to the j.l.ClassLoader object instead of a strong one. When the reference becomes (strong)ly unreachable, invoke the class-unloading phase. If you have weak reference to j.l.Classloader - GC

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Ivan Volosyuk
Robin, thank you for detailed description of the algorithm. IMHO, this was the most complicated place of the whole story: how to have a weak reference to classloader and still be able to get it alive again. This shouldn't be performance critical part and is quite doable. I absolutely agree with

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Robin
On Thu, 2006-11-09 at 02:01 +0300, Ivan Volosyuk wrote: Robin, thank you for detailed description of the algorithm. IMHO, this was the most complicated place of the whole story: how to have a weak reference to classloader and still be able to get it alive again. This shouldn't be

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Etienne Gagnon
[First, let me say that, as I am not contributing a class unloading *implementation* to drlvm, I will understand if the project was more inclined to chose an actually contributed piece of code over a design without contributed implementation. :-)] There was a -1 vote... Hmmm... As I voted +1,

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Etienne Gagnon
I was making it more complex than it needs... Here's an improvement... 1- During normal operation, the VM keeps hard references to all class loader instances. [This prevents any premature class loader death]. 2- At the start of an epoch (or just before), all vtable bits (or byte or word) are

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Etienne Gagnon
Note: For preventing collection of class loaders related to active method frames, there are various solutions. One could simply walk all method frame stacks just before the end of epoch collection (my preferred approach) and mark the bit of related vtables. Another approach would be to add an

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Robin Garner
Etienne Gagnon wrote: I was making it more complex than it needs... Here's an improvement... 1- During normal operation, the VM keeps hard references to all class loader instances. [This prevents any premature class loader death]. 2- At the start of an epoch (or just before), all vtable bits

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Robin Garner
Etienne Gagnon wrote: 3- Why would it be so hard to add an unconditional write operation during collection (e.g. during copying or marking of an object) in drlvm? A detailed technical explanation is welcome. :-) I actually believe that this should be implementable in a GC-neutral way,

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Alexey Varlamov
2006/11/8, Robin Garner [EMAIL PROTECTED]: Robin Garner wrote: Aleksey Ignatenko wrote: Robin. OK, well how about keeping a weak reference to the j.l.ClassLoader object instead of a strong one. When the reference becomes (strong)ly unreachable, invoke the class-unloading phase. If you

Re: [drlvm] Class unloading support - tested one approach

2006-11-08 Thread Alexey Varlamov
Uhm, Etienne overtook me with earlier posts. Seems we are beginning to converge with design. 2006/11/9, Alexey Varlamov [EMAIL PROTECTED]: 2006/11/8, Robin Garner [EMAIL PROTECTED]: Robin Garner wrote: Aleksey Ignatenko wrote: Robin. OK, well how about keeping a weak reference to the

Re: [drlvm] Class unloading support - tested one approach

2006-11-07 Thread Aleksey Ignatenko
Hi, Robin. I do really like this proposed idea of marking VTables from objects via additional word field in VTable. But I have one question about detecting reachability of the classloaders (sweep the vtables and check the reachability of the classloaders). Possibly I missed something, but here

Re: [drlvm] Class unloading support - tested one approach

2006-11-02 Thread Rana Dasgupta
On 11/2/06, Xiao-Feng Li [EMAIL PROTECTED] wrote: Robin, thanks for all the clarifications. Now it seems clear to me and I am convinced by this proposal. :-) Yes, this proposal is the simplest and has the least perf impact. Thanks Robin.

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Ivan Volosyuk
+1 for this approach. It will give us some kind of class unloading without much performance impact on GC. -- Ivan On 11/1/06, Robin Garner [EMAIL PROTECTED] wrote: Actually, just thinking about how I would implement this in JikesRVM, I would use the reachability based algorithm, but piggyback

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Etienne Gagnon
Robin Garner wrote: - Allocate a byte (or word) in each vtable for the purpose of tracking class reachability. Yep, there's no reason to keep the bits (or words, for performance) in the class loader, even in the approach I've proposed. They could be moved to the vtable. Etienne -- Etienne

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Robin Garner
Interesting idea! It seems the real issue is marking and sweeping the vtables. A stab at categorizing the approaches: a) Force vtables to be as similar to ordinary java objects as possible. The upside: existing GC algorithms will work unaltered. The downside is vtables of vtables of

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Weldon Washburn
On 11/1/06, Robin Garner [EMAIL PROTECTED] wrote: Interesting idea! It seems the real issue is marking and sweeping the vtables. A stab at categorizing the approaches: a) Force vtables to be as similar to ordinary java objects as possible. The upside: existing GC algorithms will work

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Rana Dasgupta
Robin, The basic difference of this with Etienne's method is that the flag is on the vtable, instead of the CL instance. Do I understand correctly ? The GC perf impact is therefore reduced because you need to lookup object-vtable instead of object-class-CLinstancewhen tracing the heap. The

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Robin Garner
Rana Dasgupta wrote: Robin, The basic difference of this with Etienne's method is that the flag is on the vtable, instead of the CL instance. Do I understand correctly ? The GC perf impact is therefore reduced because you need to lookup object-vtable instead of object-class-CLinstancewhen

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Weldon Washburn
On 11/1/06, Robin Garner [EMAIL PROTECTED] wrote: Rana Dasgupta wrote: Robin, The basic difference of this with Etienne's method is that the flag is on the vtable, instead of the CL instance. Do I understand correctly ? The GC perf impact is therefore reduced because you need to lookup

Re: [drlvm] Class unloading support - tested one approach

2006-11-01 Thread Robin Garner
Weldon Washburn wrote: Its probably in the noise but it might be possible to even reduce the overhead of clearing the vtable mark by using a epoch number instead of a boolean. The idea is that after every major GC, increment the value used for the mark. When sweeping the

Re: [drlvm] Class unloading support - tested one approach

2006-10-31 Thread Robin Garner
Actually, just thinking about how I would implement this in JikesRVM, I would use the reachability based algorithm, but piggyback on the existing GC mechanisms: - Allocate a byte (or word) in each vtable for the purpose of tracking class reachability. - Periodically, at a time when no GC is

Re: [drlvm] Class unloading support - tested one approach

2006-10-31 Thread Weldon Washburn
Interesting idea! It seems the real issue is marking and sweeping the vtables. A stab at categorizing the approaches: a) Force vtables to be as similar to ordinary java objects as possible. The upside: existing GC algorithms will work unaltered. The downside is vtables of vtables of