RFR: Fix/improve traversal CLD processing

Roman Kennke rkennke at redhat.com
Fri Feb 2 15:42:48 UTC 2018


In final traversal, we need to process CLDs specially: we need to rescan 
modified CLDs. If there are handles or dependencies added to a CLD 
during traversal, we would not notice. Normal root scan only covers 
strong roots. But there may be CLD roots that are not strong (let's not 
call them weak here to avoid confusion): CLDs that are only reachable 
via their ClassLoader Java objects. Any oops held by them might not get 
visited by GC.

There's a mechanism in CLD to handle this: has_modified_oops(), and we 
have a special pass to use this to rescan CLD roots, however I made a 
mistake: I never clear that flag. All CLDs will eventually have that 
flag set, which means traversal never unloads any CLDs :-)

The fix here is to clear the flag in init-traversal, and then check the 
flag in final-traversal. As a bonus I made this piggy-back on normal 
root scan (including multithreading) by allowing to pass a 'weak_cld' to 
process_strong_roots().

http://cr.openjdk.java.net/~rkennke/traversal-cld-proc/webrev.00/

ok?

Roman


More information about the shenandoah-dev mailing list