<br><br><div class="gmail_quote">On Fri, Dec 31, 2010 at 7:25 PM, Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
 <br>Hi Mariano,<br><br><div class="gmail_quote">On Fri, Dec 31, 2010 at 7:48 AM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
 <br>Hi Eliot. I am very newbie in all this stuff, so I would directly ask you if you could explain me my doubt ;)<br><br><br>StackInterpreter &gt;&gt;  flushMethodCacheFrom: memStart to: memEnd <br>    &quot;Flush entries in the method cache only if the oop address is within the given memory range. <br>


    This reduces overagressive cache clearing. Note the AtCache is fully flushed, 70% of the time <br>    cache entries live in newspace, new objects die young&quot;<br>    | probe |<br>    probe := 0.<br>    1 to: MethodCacheEntries do: [:i | <br>


            (methodCache at: probe + MethodCacheSelector) = 0<br>                ifFalse: [((((self oop: (methodCache at: probe + MethodCacheSelector) isGreaterThanOrEqualTo: memStart)<br>                                        and: [self oop: (methodCache at: probe + MethodCacheSelector) isLessThan: memEnd])<br>


                                    or: [(self oop: (methodCache at: probe + MethodCacheClass) isGreaterThanOrEqualTo: memStart)<br>                                            and: [self oop: (methodCache at: probe + MethodCacheClass) isLessThan: memEnd]])<br>


                                or: [(self oop: (methodCache at: probe + MethodCacheMethod) isGreaterThanOrEqualTo: memStart)<br>                                        and: [self oop: (methodCache at: probe + MethodCacheMethod) isLessThan: memEnd]])<br>


                        ifTrue: [methodCache at: probe + MethodCacheSelector put: 0]].<br>            probe := probe + MethodCacheEntrySize].<br>    1 to: AtCacheTotalSize do: [:i | atCache at: i put: 0]<br><br><br>But if I see <br>


<br>CoInterpreter &gt;&gt; flushMethodCache<br>    &quot;Flush the method cache. The method cache is flushed on every programming change and garbage collect.&quot;<br><br>    1 to: MethodCacheSize do: [ :i | methodCache at: i put: 0 ].<br>


    lastMethodCacheProbeWrite := 0. &quot;this for primitiveExternalMethod&quot;<br>    cogit unlinkAllSends<br><br><br>So....my newbie question is just why the &quot;cogit unlinkAllSends&quot; is not need in Cog?   I mean, why cog doesn&#39;t need to do:<br>


<br>CoInterpreter &gt;&gt;  flushMethodCacheFrom: memStart to: memEnd <br>
   super  flushMethodCacheFrom: memStart to: memEnd .<br>   self unlinkAllSends.<br></blockquote><div><br></div><div>Good question.  The answer is that  flushMethodCacheFrom:to: is being used to cheaply avoid having to remap entries in the method cache.  It gets called from mapPointersInObjectsFrom:to: during GC (which moves objects) and which could  actually remap the entries in the method cache instead of just throwing them away.  The issue for remapping is that there is no ordering of the objects in the method cache so one has to scan all of its entries, but since its small that&#39;s not likely to be an issue.  In any case, throwing away or unlinking sends in Cog is much more expensive, so I don&#39;t do it.</div>

<div><br></div><div>Instead, Cog object references are updated in mapInterpreterOops (also called from mapPointersInObjectsFrom:to:) and high cost is avoided by maintaining a flag, inFullGC, that tells Cog whether it has to remap all object references or just young object references, and a list of Cog methods containing young references (see selectors matching youngReferrers).  So during a young space scavenge when doing mapMachineCode Cog only looks at the methods containing young referrers, and typically there aren&#39;t any.</div>

<div><br></div></div></blockquote><div><br>Ahh okok, I think I got it :)<br>Thanks for the explanation Eliot!<br><br>Mariano<br><br><br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>Thanks for the explanation in advance,<br><br>Mariano<br>
<br>
<br></blockquote></div><br>
<br></blockquote></div><br>