Collection of DefNewGeneration

Abhinav Jangda abhijangda at hotmail.com
Sat Aug 8 16:50:59 UTC 2015


Hello everyone,

I was trying to understand how serial generational gc works in Hotspot. I was able to understand how TenuredGeneration is marked using different OopClosures. I can see how beautifully the concept of Visitor Design Pattern has been used.
But I am having a slight difficulty in understanding how DefNewGeneration works.
I do understand that DefNewGeneration::collect method is called which then calls GenCollectedHeap::gen_process_strong_roots. This is same as the TenuredGeneration::collect calls GenCollectedHeap::gen_process_strong_roots but in both of these cases the OopClosure are different. In TenuredGeneration::collect, FollowRootClosure (There are 3 closures but let us focus on only one of them) is used and in   DefNewGeneration::collect, FastScanClosure is used. Well, the problem starts here. 
In FollowRootClosure::do_oop method, the oop to be traversed is pushed on the marking stack which then is able to follow the contents of this oop. In FastScanClosure there is no such thing. In FastScanClosure::do_oop_work method, the oop is first checked whether it is in this generation and only if it is then oop is transferred to another space/generation. oop's fields are not traversed like they are in FollowRootClosure. Let us suppose the root object is not in the DefNewGeneration but its fields are. So, in this case the fields wouldn't be traversed? 
How, the fields of root objects are traversed in the case of FastScanClosure? If they are traversed by some other way and FastScanClosure use the result of it, then please tell me that.
Please help me, a small function name or hint should be enough for me.

Thank You,

Abhinav
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20150808/d69cffbb/attachment.html>


More information about the hotspot-gc-dev mailing list