I found at least one problem the NEC: NEC assumes that all global bindings
answer a class but that is not true in cases such as Processor and Transcript.
Here’s a fix:
NECVarTypeGuesser>>pushLiteralVariable: anAssociation
"Push Contents Of anAssociation On Top Of Stack bytecode."
| info |
contextCount > 0 ifTrue:[^self].
info := NECTypeInfo definedByMessageSend: (anAssociation value
isBehavior
ifTrue: [ anAssociation value ]
ifFalse: [ anAssociation value class ]).
types add: info
Issue:
https://pharo.fogbugz.com/f/cases/18513/NEC-fails-to-guess-the-type-of-non-class-bindings
<https://pharo.fogbugz.com/f/cases/18513/NEC-fails-to-guess-the-type-of-non-class-bindings>
Cheers,
Max
> On 05 Jun 2016, at 17:44, Nicolai Hess <[email protected]> wrote:
>
>
>
> 2016-06-04 20:41 GMT+02:00 stepharo <[email protected]
> <mailto:[email protected]>>:
> Just to report (I did not have the time to check in 60a) but I got red square
> of death with komitter.
>
> I also got
>
> NECTypedModel>>initializeSelectorsFor: aClass
> |excludedClasses|
> selectors reset.
> excludedClasses := (expanded ifTrue: [#()] ifFalse: [Object
> withAllSuperclasses]).
> selectors addAll: ((aClass allSelectorsWithout: excludedClasses)
>
> collect: [:each | NECSelectorEntry contents: each
> type: #selector])
>
>
>
> DNU on allSelectorsWithout:
>
>
> with such code
>
>
> mostCommonlyUsedSelectors
> "self mostCommonlyUsedSelectors"
>
> | result |
> result := Bag new.
> environment cla
>
> ^ cursor here
>
> do: [ :each | result addAll: each selectors].
> ^ result sortedCounts
>
>
> Stef
>
> Can not reproduce the NEC- bug.
> What 5.0 image did you use, the release version?
> In what class did you try to add the method mostCommonlyUsedSelectors?
>
> nicolai
>
>
>