hotspot cms root?

Jon Masamitsu jon.masamitsu at oracle.com
Fri Jan 30 17:21:14 UTC 2015


On 1/29/2015 9:30 PM, Robin Wong wrote:
> Hi,
>
> I have some knowledge about JVM but I'm still new to hotspot. Recently 
> I started reading cms code in jdk-8 but I got some questions. The 
> first question I have is about how scan/mark root really works. In 
> Initial mark phase, I went through the code path along 
> CMSParInitialMarkTask::work() > 
> CMSParMarkTask::work_on_young_gen_roots() > 
> CMSParMarkTask::do_young_space_rescan() > 
> ContiguousSpace::par_oop_iterate() > oopDesc::oop_iterate() > ... > 
> Par_MarkRefsIntoClosure::do_oop(). It seems to me the gc thread would 
> simply iterate each address slot in young generation here (edan space, 
> from space, to space), as seen from 
> ContiguousSpace::par_oop_iterate(), and when the address points to an 
> address in cms, mark that address in cms (_span.contains(addr) in 
> Par_MarkRefsIntoClosure::do_oop()) if I'm right interpreting _span as 
> part of cms space.

I think above you're looking at the code that specifically treats the
objects in the young gen as roots for the collection  of the CMS
(tenured) gen.

>
> From what I know about JVM root, it should include stack, static slots 
> and registers, and when gc starts, the thread should scan from the 
> root and then objects transitively reachable from the root, and mark 
> them. But here in hotspot, I couldn't figure out how JVM root is involved.

Look farther down in CMSParInitialMarkTask::work() for a call to
gen_process_roots().   Follow it to find the processing of other
roots such as those you list.

>
> BTW, I find simply reading hotspot code is not very easy, so I wonder 
> if some one can tell me where I can get the technical reports or other 
> sources regarding GC implementation inside hotspot if possible?

It had been comment practice to put documentation into the sources. That
varies from engineer to engineer though.

>
> I'm not sure whether this is the right place to post. If not, please 
> forward to the right place.

This is the right place.

Jon
>
> Thanks,
> Robin



More information about the hotspot-gc-dev mailing list