<div dir="ltr"><div>Hi Omer</div><div><br></div><div>The point of the heap scan is to find *info pointers* into objects that we want to unload, since we can't unload those.</div><div><br></div><div>What about static object pointers? Well, those would be found by traversing the static_objects list, which we also do in checkUnload. Except that static_objects doesn't contain all the static objects - that's one of the problems identified by this ticket.</div><div><br></div><div>Primitive objects can't have an info pointer into a dynamically loaded object, because all their info pointers point into the RTS.</div><div><br></div><div>Hope that helps!</div><div><br></div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 15 Apr 2020 at 13:06, Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com">omeragacan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">To answer my own question<br>
<br>
> So if I see a constructor with a reference to an object code in its payload<br>
> I'll not mark the object code.<br>
<br>
We don't visit payload as objects pointed from the payload will be visited<br>
during the scan later (or they're already visited if they come before the<br>
constructor in a block).<br>
<br>
The 'prim' variable in that code is still a little bit confusing. For example we<br>
never check an MVAR for whether it's an unloadable object or not:<br>
<br>
case MVAR_CLEAN:<br>
case MVAR_DIRTY:<br>
prim = true;<br>
size = sizeW_fromITBL(info);<br>
break;<br>
<br>
...<br>
<br>
if (!prim) {<br>
checkAddress(addrs,info, s_indices);<br>
}<br>
<br>
Would be good to know why it's fine to not check MVARs and other kinds of<br>
objects that we skip in that code.<br>
<br>
Ömer<br>
<br>
Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>>, 15 Nis 2020 Çar, 12:35<br>
tarihinde şunu yazdı:<br>
><br>
> Hi Simon,<br>
><br>
> I'm looking at object unloading code in CheckUnload.c. My understanding of how<br>
> unloading works is:<br>
><br>
> - When unloading of an object is requested the object is added to<br>
> `unloaded_objects`.<br>
> - When `unloaded_objects` is not empty, after GC, we scan the heap for any<br>
> references to objects. This is done in `searchHeapBlocks` called by<br>
> `checkUnload`.<br>
> - When `searchHeapBlocks` finds a reference to an object code it marks the<br>
> object code.<br>
> - After scanning the heap any objects in `unloaded_objects` that are not marked<br>
> are unloaded.<br>
><br>
> Does this sound right so far?<br>
><br>
> What I'm confused about is `searchHeapBlocks`. As far as I can see it just skips<br>
> all objects other than stacks. For example here's the code for scanning a<br>
> constructor:<br>
><br>
> case CONSTR:<br>
> case CONSTR_NOCAF:<br>
> case CONSTR_1_0:<br>
> case CONSTR_0_1:<br>
> case CONSTR_1_1:<br>
> case CONSTR_0_2:<br>
> case CONSTR_2_0:<br>
> size = sizeW_fromITBL(info);<br>
> break;<br>
><br>
> So if I see a constructor with a reference to an object code in its payload I'll<br>
> not mark the object code. This looks wrong to me. I don't understand why we only<br>
> care about stacks and nothing else. Could you comment on this?<br>
><br>
> Thanks,<br>
><br>
> Ömer<br>
</blockquote></div>