<div dir="ltr">Hi All,<div><br></div><div>    I just got a little burned.  I was searching through an Array of symbols and integers (it is the PrimitiveTable from the VM), wanting to filter-out methods with a with a certain pragma.  The code looks like:</div>
<div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>anArray doWithIndex:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[:entry :index|</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(self whichClassIncludesSelector: entry) ifNotNil:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>[:c| | m |</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>m := c &gt;&gt; entry.</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>(m pragmaAt: #option:) ifNotNil:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>[:pragma|</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>(initializationOptions at: (pragma arguments first) ifAbsent: [true]) ifFalse:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>[anArray at: index put: 0]]]]</div><div><br></div><div>the error was a keyNotFound error for c &gt;&gt; entry.  Turns out entry was the integer 306, a code for a quick primitive that returns some inst var.  The question is why did (self whichClassIncludesSelector: entry) evaluate to other than nil given that 306 is /not/ a selector in any of the classes from self on up.  Well, it&#39;s MethodDictionary&#39;s use of pointsTo: that is at fault:</div>
<div><br></div><div><div>MethodDictionary&gt;&gt;includesKey: aSymbol</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;This override assumes that pointsTo is a fast primitive&quot;</div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>aSymbol ifNil: [^ false].</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^ self pointsTo: aSymbol</div></div><div><br></div><div>
<div>ProtoObject&gt;&gt;pointsTo: anObject</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;This method returns true if self contains a pointer to anObject,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>and returns false otherwise&quot;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;primitive: 132&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1 to: self class instSize do:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[:i | (self instVarAt: i) == anObject ifTrue: [^ true]].</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>1 to: self basicSize do:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[:i | (self basicAt: i) == anObject ifTrue: [^ true]].</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>^ false</div></div><div><div><br></div><div>Turns out that 306 was the tally of one of the method dictionaries along self&#39;s superclass chain.  This seems to be to be completely bogus.  Do we really need crude performance hacks like this any more?</div>
-- <br>best,<div>Eliot</div>
</div></div></div>