<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Look at the code in GenCollectedHeap::gen_process_roots()<br>
    <br>
     704     older_gens->set_generation(_old_gen);<br>
     705     rem_set()->younger_refs_iterate(_old_gen, older_gens,
    scope->n_threads(     ));<br>
     706     older_gens->reset_generation();<br>
    <br>
    The defNew collect() copies live objects that it finds in the defNew
    (young) generation.<br>
    For objects in the young gen that are pointed to from the old
    generation, collect()<br>
    uses a remembered set (in the form of a card table).  The card table
    tells the defNew<br>
    collect() where to look for objects in the young generation
    referenced from the old<br>
    generation.<br>
    <br>
    Jon<br>
    <br>
    <div class="moz-cite-prefix">On 8/8/2015 9:50 AM, Abhinav Jangda
      wrote:<br>
    </div>
    <blockquote cite="mid:BLU184-W650DC0BF5226F685A6179ECA720@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
      <div dir="ltr">Hello everyone,<br>
        <br>
        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.<br>
        But I am having a slight difficulty in understanding how
        DefNewGeneration works.<br>
        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. <br>
        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? <br>
        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.<br>
        Please help me, a small function name or hint should be enough
        for me.<br>
        <br>
        Thank You,<br>
        <br>
        Abhinav<br>
      </div>
    </blockquote>
    <br>
  </body>
</html>