[Vm-dev] [COG] should cog unlinkSends in #flushMethodCacheFrom:to:

Mariano Martinez Peck marianopeck at gmail.com
Fri Dec 31 15:48:23 UTC 2010

Hi Eliot. I am very newbie in all this stuff, so I would directly ask you if
you could explain me my doubt ;)

StackInterpreter >>  flushMethodCacheFrom: memStart to: memEnd
    "Flush entries in the method cache only if the oop address is within the
given memory range.
    This reduces overagressive cache clearing. Note the AtCache is fully
flushed, 70% of the time
    cache entries live in newspace, new objects die young"
    | probe |
    probe := 0.
    1 to: MethodCacheEntries do: [:i |
            (methodCache at: probe + MethodCacheSelector) = 0
                ifFalse: [((((self oop: (methodCache at: probe +
MethodCacheSelector) isGreaterThanOrEqualTo: memStart)
                                        and: [self oop: (methodCache at:
probe + MethodCacheSelector) isLessThan: memEnd])
                                    or: [(self oop: (methodCache at: probe +
MethodCacheClass) isGreaterThanOrEqualTo: memStart)
                                            and: [self oop: (methodCache at:
probe + MethodCacheClass) isLessThan: memEnd]])
                                or: [(self oop: (methodCache at: probe +
MethodCacheMethod) isGreaterThanOrEqualTo: memStart)
                                        and: [self oop: (methodCache at:
probe + MethodCacheMethod) isLessThan: memEnd]])
                        ifTrue: [methodCache at: probe + MethodCacheSelector
put: 0]].
            probe := probe + MethodCacheEntrySize].
    1 to: AtCacheTotalSize do: [:i | atCache at: i put: 0]

But if I see

CoInterpreter >> flushMethodCache
    "Flush the method cache. The method cache is flushed on every
programming change and garbage collect."

    1 to: MethodCacheSize do: [ :i | methodCache at: i put: 0 ].
    lastMethodCacheProbeWrite := 0. "this for primitiveExternalMethod"
    cogit unlinkAllSends

So....my newbie question is just why the "cogit unlinkAllSends" is not need
in Cog?   I mean, why cog doesn't need to do:

CoInterpreter >>  flushMethodCacheFrom: memStart to: memEnd
   super flushMethodCacheFrom: memStart to: memEnd .
   self unlinkAllSends.

Thanks for the explanation in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101231/28a97f6e/attachment.htm

More information about the Vm-dev mailing list