Pharo 2.0: Just need a recompileAll or a real problem in background?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Pharo 2.0: Just need a recompileAll or a real problem in background?

Mariano Martinez Peck
(Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >> #shrinkToCore) literalAt: 4)
gives false when it should be true.  If I do a Compiler recompileAll it gets fixed. So, my question is, is that normal? how could that happen?
is there any real problem behind?

anyway, can we do a recompileAll for the moment?

thanks!

--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Francisco Garau-2
Your code snippet is comparing the associations. The below one evaluates to true: 

(Smalltalk globals associationAt: #ScriptLoader) value 
 == 
((SmalltalkImage >> #shrinkToCore) literalAt: 4) value 


On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
(Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >> #shrinkToCore) literalAt: 4)
gives false when it should be true.  If I do a Compiler recompileAll it gets fixed. So, my question is, is that normal? how could that happen?
is there any real problem behind?

anyway, can we do a recompileAll for the moment?

thanks!

--
Mariano
http://marianopeck.wordpress.com


Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Mariano Martinez Peck


On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]> wrote:
Your code snippet is comparing the associations. The below one evaluates to true: 

(Smalltalk globals associationAt: #ScriptLoader) value 
 == 
((SmalltalkImage >> #shrinkToCore) literalAt: 4) value 


Yes, but the literals of CompiledMethod that refer to classes should have the SAME association as Smalltalk globals. In fact, that's the reason why we have:

Association >> #literalEqual: otherLiteral
    "Answer true if the receiver and otherLiteral represent the same literal.
    Variable bindings are literally equals only if identical.
    This is how variable sharing works, by preserving identity and changing only the value."
    ^self == otherLiteral
 
instead of the Object implementation.



On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
(Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >> #shrinkToCore) literalAt: 4)
gives false when it should be true.  If I do a Compiler recompileAll it gets fixed. So, my question is, is that normal? how could that happen?
is there any real problem behind?

anyway, can we do a recompileAll for the moment?

thanks!

--
Mariano
http://marianopeck.wordpress.com





--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Igor Stasenko
On 1 May 2012 21:45, Mariano Martinez Peck <[hidden email]> wrote:

>
>
> On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]>
> wrote:
>>
>> Your code snippet is comparing the associations. The below one evaluates
>> to true:
>>
>> (Smalltalk globals associationAt: #ScriptLoader) value
>>  ==
>> ((SmalltalkImage >> #shrinkToCore) literalAt: 4) value
>>
>
> Yes, but the literals of CompiledMethod that refer to classes should have
> the SAME association as Smalltalk globals. In fact, that's the reason why we
> have:
>
indeed.
The question is what leads to creation of multiple associations
pointing to same global?

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Mariano Martinez Peck


On Tue, May 1, 2012 at 10:05 PM, Igor Stasenko <[hidden email]> wrote:
On 1 May 2012 21:45, Mariano Martinez Peck <[hidden email]> wrote:
>
>
> On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]>
> wrote:
>>
>> Your code snippet is comparing the associations. The below one evaluates
>> to true:
>>
>> (Smalltalk globals associationAt: #ScriptLoader) value
>>  ==
>> ((SmalltalkImage >> #shrinkToCore) literalAt: 4) value
>>
>
> Yes, but the literals of CompiledMethod that refer to classes should have
> the SAME association as Smalltalk globals. In fact, that's the reason why we
> have:
>
indeed.
The question is what leads to creation of multiple associations
pointing to same global?


Exactly. I can easily fix it with a Compiler recompileAll. But the main question is if we have a bug or something that could let us in that state.
 

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Mariano Martinez Peck


On Tue, May 1, 2012 at 10:17 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:05 PM, Igor Stasenko <[hidden email]> wrote:
On 1 May 2012 21:45, Mariano Martinez Peck <[hidden email]> wrote:
>
>
> On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]>
> wrote:
>>
>> Your code snippet is comparing the associations. The below one evaluates
>> to true:
>>
>> (Smalltalk globals associationAt: #ScriptLoader) value
>>  ==
>> ((SmalltalkImage >> #shrinkToCore) literalAt: 4) value
>>
>
> Yes, but the literals of CompiledMethod that refer to classes should have
> the SAME association as Smalltalk globals. In fact, that's the reason why we
> have:
>
indeed.
The question is what leads to creation of multiple associations
pointing to same global?


Exactly. I can easily fix it with a Compiler recompileAll. But the main question is if we have a bug or something that could let us in that state.
 

 Ok, I wrote an ugly test and I noticed that the ONLY method with this problem in the image is


| behaviorAssociations broken |
behaviorAssociations := Smalltalk globals associations select: [:each | each value isBehavior or: [each value isTrait]].
broken := OrderedCollection new.
(CompiledMethod allInstances select: [:each | each isInstalled])
    do: [:aMethod | aMethod literals
                    do: [:aLiteral |  aLiteral isVariableBinding
                                        ifTrue: [  ((behaviorAssociations includes: aLiteral)
                                                    and: [(behaviorAssociations identityIncludes: aLiteral) not])
                                                        ifTrue: [broken add: (aMethod -> aLiteral)]
                                        ]
                    ]
    ].
broken inspect

And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
Any idea?

For the moment I will update the test and do a Compiler recompileAll.


 

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.




--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Marcus Denker-4
In reply to this post by Mariano Martinez Peck

On May 2, 2012, at 10:27 AM, Mariano Martinez Peck wrote:

>
>  Ok, I wrote an ugly test and I noticed that the ONLY method with this problem in the image is
>
>
> | behaviorAssociations broken |
> behaviorAssociations := Smalltalk globals associations select: [:each | each value isBehavior or: [each value isTrait]].
> broken := OrderedCollection new.
> (CompiledMethod allInstances select: [:each | each isInstalled])
>     do: [:aMethod | aMethod literals
>                     do: [:aLiteral |  aLiteral isVariableBinding
>                                         ifTrue: [  ((behaviorAssociations includes: aLiteral)
>                                                     and: [(behaviorAssociations identityIncludes: aLiteral) not])
>                                                         ifTrue: [broken add: (aMethod -> aLiteral)]
>                                         ]
>                     ]
>     ].
> broken inspect
>
> And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
> Any idea?
>
Maybe monticello does not recompile sometimes a method when it should?

> For the moment I will update the test and do a Compiler recompileAll.
>
ok.

--
Marcus Denker -- http://marcusdenker.de


Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Eliot Miranda-2
In reply to this post by Mariano Martinez Peck
Hi Mariano,

On Wed, May 2, 2012 at 1:27 AM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:17 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:05 PM, Igor Stasenko <[hidden email]> wrote:
On 1 May 2012 21:45, Mariano Martinez Peck <[hidden email]> wrote:
>
>
> On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]>
> wrote:
>>
>> Your code snippet is comparing the associations. The below one evaluates
>> to true:
>>
>> (Smalltalk globals associationAt: #ScriptLoader) value
>>  ==
>> ((SmalltalkImage >> #shrinkToCore) literalAt: 4) value
>>
>
> Yes, but the literals of CompiledMethod that refer to classes should have
> the SAME association as Smalltalk globals. In fact, that's the reason why we
> have:
>
indeed.
The question is what leads to creation of multiple associations
pointing to same global?


Exactly. I can easily fix it with a Compiler recompileAll. But the main question is if we have a bug or something that could let us in that state.
 

 Ok, I wrote an ugly test and I noticed that the ONLY method with this problem in the image is


| behaviorAssociations broken |
behaviorAssociations := Smalltalk globals associations select: [:each | each value isBehavior or: [each value isTrait]].
broken := OrderedCollection new.
(CompiledMethod allInstances select: [:each | each isInstalled])
    do: [:aMethod | aMethod literals
                    do: [:aLiteral |  aLiteral isVariableBinding
                                        ifTrue: [  ((behaviorAssociations includes: aLiteral)
                                                    and: [(behaviorAssociations identityIncludes: aLiteral) not])
                                                        ifTrue: [broken add: (aMethod -> aLiteral)]
                                        ]
                    ]
    ].
broken inspect

This doesn't look for unbound class variables.  I just wrote something that handles this in Squeak trunk:

methodsWithUnboundGlobals
"Get all methods that use undeclared global objects that are not listed in Undeclared. For a clean image the result should be empty."

"SystemNavigation new methodsWithUnboundGlobals"

^self allSelect:
[:m|
m literals anySatisfy:
[:l|
l isVariableBinding
and: [l key isSymbol "avoid class-side methodClass literals"
and: [(m methodClass bindingOf: l key) isNil
and: [(Undeclared associationAt: l key ifAbsent: []) ~~ l]]]]] 

so the test would be
    self assert: SystemNavigation new methodsWithUnboundGlobals isEmpty


And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
Any idea?

For the moment I will update the test and do a Compiler recompileAll.


 

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.




--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com




--
best,
Eliot


SystemNavigation-methodsWithUnboundGlobals.st (866 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Mariano Martinez Peck


On Wed, May 2, 2012 at 8:21 PM, Eliot Miranda <[hidden email]> wrote:
Hi Mariano,

On Wed, May 2, 2012 at 1:27 AM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:17 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:05 PM, Igor Stasenko <[hidden email]> wrote:
On 1 May 2012 21:45, Mariano Martinez Peck <[hidden email]> wrote:
>
>
> On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]>
> wrote:
>>
>> Your code snippet is comparing the associations. The below one evaluates
>> to true:
>>
>> (Smalltalk globals associationAt: #ScriptLoader) value
>>  ==
>> ((SmalltalkImage >> #shrinkToCore) literalAt: 4) value
>>
>
> Yes, but the literals of CompiledMethod that refer to classes should have
> the SAME association as Smalltalk globals. In fact, that's the reason why we
> have:
>
indeed.
The question is what leads to creation of multiple associations
pointing to same global?


Exactly. I can easily fix it with a Compiler recompileAll. But the main question is if we have a bug or something that could let us in that state.
 

 Ok, I wrote an ugly test and I noticed that the ONLY method with this problem in the image is


| behaviorAssociations broken |
behaviorAssociations := Smalltalk globals associations select: [:each | each value isBehavior or: [each value isTrait]].
broken := OrderedCollection new.
(CompiledMethod allInstances select: [:each | each isInstalled])
    do: [:aMethod | aMethod literals
                    do: [:aLiteral |  aLiteral isVariableBinding
                                        ifTrue: [  ((behaviorAssociations includes: aLiteral)
                                                    and: [(behaviorAssociations identityIncludes: aLiteral) not])
                                                        ifTrue: [broken add: (aMethod -> aLiteral)]
                                        ]
                    ]
    ].
broken inspect

This doesn't look for unbound class variables.

Indeed.
 
 I just wrote something that handles this in Squeak trunk:

methodsWithUnboundGlobals
"Get all methods that use undeclared global objects that are not listed in Undeclared. For a clean image the result should be empty."

"SystemNavigation new methodsWithUnboundGlobals"

^self allSelect:
[:m|
m literals anySatisfy:
[:l|
l isVariableBinding
and: [l key isSymbol "avoid class-side methodClass literals"
and: [(m methodClass bindingOf: l key) isNil
and: [(Undeclared associationAt: l key ifAbsent: []) ~~ l]]]]] 

so the test would be
    self assert: SystemNavigation new methodsWithUnboundGlobals isEmpty



Ok. If I understand this correctly, this is yet ANOTHER thing to test, right?  I mean, it does not cover my original problem but another one possible ;)
right?

Thanks Eliot.


 
And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
Any idea?

For the moment I will update the test and do a Compiler recompileAll.


 

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.




--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com




--
best,
Eliot




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Eliot Miranda-2


On Wed, May 2, 2012 at 11:44 AM, Mariano Martinez Peck <[hidden email]> wrote:


On Wed, May 2, 2012 at 8:21 PM, Eliot Miranda <[hidden email]> wrote:
Hi Mariano,

On Wed, May 2, 2012 at 1:27 AM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:17 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Tue, May 1, 2012 at 10:05 PM, Igor Stasenko <[hidden email]> wrote:
On 1 May 2012 21:45, Mariano Martinez Peck <[hidden email]> wrote:
>
>
> On Tue, May 1, 2012 at 9:22 PM, Francisco Garau <[hidden email]>
> wrote:
>>
>> Your code snippet is comparing the associations. The below one evaluates
>> to true:
>>
>> (Smalltalk globals associationAt: #ScriptLoader) value
>>  ==
>> ((SmalltalkImage >> #shrinkToCore) literalAt: 4) value
>>
>
> Yes, but the literals of CompiledMethod that refer to classes should have
> the SAME association as Smalltalk globals. In fact, that's the reason why we
> have:
>
indeed.
The question is what leads to creation of multiple associations
pointing to same global?


Exactly. I can easily fix it with a Compiler recompileAll. But the main question is if we have a bug or something that could let us in that state.
 

 Ok, I wrote an ugly test and I noticed that the ONLY method with this problem in the image is


| behaviorAssociations broken |
behaviorAssociations := Smalltalk globals associations select: [:each | each value isBehavior or: [each value isTrait]].
broken := OrderedCollection new.
(CompiledMethod allInstances select: [:each | each isInstalled])
    do: [:aMethod | aMethod literals
                    do: [:aLiteral |  aLiteral isVariableBinding
                                        ifTrue: [  ((behaviorAssociations includes: aLiteral)
                                                    and: [(behaviorAssociations identityIncludes: aLiteral) not])
                                                        ifTrue: [broken add: (aMethod -> aLiteral)]
                                        ]
                    ]
    ].
broken inspect

This doesn't look for unbound class variables.

Indeed.
 
 I just wrote something that handles this in Squeak trunk:

methodsWithUnboundGlobals
"Get all methods that use undeclared global objects that are not listed in Undeclared. For a clean image the result should be empty."

"SystemNavigation new methodsWithUnboundGlobals"

^self allSelect:
[:m|
m literals anySatisfy:
[:l|
l isVariableBinding
and: [l key isSymbol "avoid class-side methodClass literals"
and: [(m methodClass bindingOf: l key) isNil
and: [(Undeclared associationAt: l key ifAbsent: []) ~~ l]]]]] 

so the test would be
    self assert: SystemNavigation new methodsWithUnboundGlobals isEmpty



Ok. If I understand this correctly, this is yet ANOTHER thing to test, right?  I mean, it does not cover my original problem but another one possible ;)
right?

I was assuming that my test is a superset of yours, but now I see it is not strict enough.  It also needs to compare bindings to see that they're identical. I've attached a stricter version.  This says that for any global, it should match either the class's notion of what bindingOf: the key is, or bindingOf: should be nil and the binding should be in Undeclared.   If the class answers a different binding through bindingOf: or answers no binding and the binding is not in Undeclared then the variable in the method is wrong.

methodsWithUnboundGlobals
"Get all methods that use undeclared global objects that are not listed in Undeclared. For a clean image the result should be empty."

"SystemNavigation new methodsWithUnboundGlobals"

^self allSelect:
[:m|
m literals anySatisfy:
[:l|
l isVariableBinding
and: [l key isSymbol "avoid class-side methodClass literals"
and: [(m methodClass bindingOf: l key)
ifNil: [(Undeclared associationAt: l key ifAbsent: []) ~~ l]
ifNotNil: [:b| b ~~ l]]]]]


So I think with this stricter definition self assert: SystemNavigation new methodsWithUnboundGlobals isEmpty is an adequate test.


Thanks Eliot.


 
And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
Any idea?

For the moment I will update the test and do a Compiler recompileAll.


 

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.




--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com




--
best,
Eliot




--
Mariano
http://marianopeck.wordpress.com




--
best,
Eliot


SystemNavigation-methodsWithUnboundGlobals.st (898 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Mariano Martinez Peck


Ok. If I understand this correctly, this is yet ANOTHER thing to test, right?  I mean, it does not cover my original problem but another one possible ;)
right?

I was assuming that my test is a superset of yours, but now I see it is not strict enough.  It also needs to compare bindings to see that they're identical. I've attached a stricter version.  This says that for any global, it should match either the class's notion of what bindingOf: the key is, or bindingOf: should be nil and the binding should be in Undeclared.   If the class answers a different binding through bindingOf: or answers no binding and the binding is not in Undeclared then the variable in the method is wrong.


Ok, now we agree :)
I commited this version and removed my previous test.

Thanks!

 
methodsWithUnboundGlobals
"Get all methods that use undeclared global objects that are not listed in Undeclared. For a clean image the result should be empty."

"SystemNavigation new methodsWithUnboundGlobals"

^self allSelect:
[:m|
m literals anySatisfy:
[:l|
l isVariableBinding
and: [l key isSymbol "avoid class-side methodClass literals"
and: [(m methodClass bindingOf: l key)
ifNil: [(Undeclared associationAt: l key ifAbsent: []) ~~ l]
ifNotNil: [:b| b ~~ l]]]]]


So I think with this stricter definition self assert: SystemNavigation new methodsWithUnboundGlobals isEmpty is an adequate test.


Thanks Eliot.


 
And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
Any idea?

For the moment I will update the test and do a Compiler recompileAll.


 

> Association >> #literalEqual: otherLiteral
>     "Answer true if the receiver and otherLiteral represent the same
> literal.
>     Variable bindings are literally equals only if identical.
>     This is how variable sharing works, by preserving identity and changing
> only the value."
>     ^self == otherLiteral
>
> instead of the Object implementation.
>
>
>>
>> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
>>>
>>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
>>> #shrinkToCore) literalAt: 4)
>>> gives false when it should be true.  If I do a Compiler recompileAll it
>>> gets fixed. So, my question is, is that normal? how could that happen?
>>> is there any real problem behind?
>>>
>>> anyway, can we do a recompileAll for the moment?
>>>
>>> thanks!
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com
>>>
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



--
Best regards,
Igor Stasenko.




--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com




--
best,
Eliot




--
Mariano
http://marianopeck.wordpress.com




--
best,
Eliot




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 2.0: Just need a recompileAll or a real problem in background?

Stéphane Ducasse
Mariano

did you add a nice comment to the test because I love when I can read a nice explanation like the one of eliot
and then only read the code :).

Stef

On May 3, 2012, at 6:49 PM, Mariano Martinez Peck wrote:

>
>
> Ok. If I understand this correctly, this is yet ANOTHER thing to test, right?  I mean, it does not cover my original problem but another one possible ;)
> right?
>
> I was assuming that my test is a superset of yours, but now I see it is not strict enough.  It also needs to compare bindings to see that they're identical. I've attached a stricter version.  This says that for any global, it should match either the class's notion of what bindingOf: the key is, or bindingOf: should be nil and the binding should be in Undeclared.   If the class answers a different binding through bindingOf: or answers no binding and the binding is not in Undeclared then the variable in the method is wrong.
>
>
> Ok, now we agree :)
> I commited this version and removed my previous test.
>
> Thanks!
>
>  
> methodsWithUnboundGlobals
> "Get all methods that use undeclared global objects that are not listed in Undeclared. For a clean image the result should be empty."
>
> "SystemNavigation new methodsWithUnboundGlobals"
>
> ^self allSelect:
> [:m|
> m literals anySatisfy:
> [:l|
> l isVariableBinding
> and: [l key isSymbol "avoid class-side methodClass literals"
> and: [(m methodClass bindingOf: l key)
> ifNil: [(Undeclared associationAt: l key ifAbsent: []) ~~ l]
> ifNotNil: [:b| b ~~ l]]]]]
>
>
> So I think with this stricter definition self assert: SystemNavigation new methodsWithUnboundGlobals isEmpty is an adequate test.
>
>
> Thanks Eliot.
>
>
>  
> And I have 6 methods from the classes SmalltalkImage and ScriptLoader and all the 6 literals are pointing to ScriptLoader. So something weird happened with this class.
> Any idea?
>
> For the moment I will update the test and do a Compiler recompileAll.
>
>
>  
>
> > Association >> #literalEqual: otherLiteral
> >     "Answer true if the receiver and otherLiteral represent the same
> > literal.
> >     Variable bindings are literally equals only if identical.
> >     This is how variable sharing works, by preserving identity and changing
> > only the value."
> >     ^self == otherLiteral
> >
> > instead of the Object implementation.
> >
> >
> >>
> >> On 1 May 2012 17:52, Mariano Martinez Peck <[hidden email]> wrote:
> >>>
> >>> (Smalltalk globals associationAt: #ScriptLoader) == ((SmalltalkImage >>
> >>> #shrinkToCore) literalAt: 4)
> >>> gives false when it should be true.  If I do a Compiler recompileAll it
> >>> gets fixed. So, my question is, is that normal? how could that happen?
> >>> is there any real problem behind?
> >>>
> >>> anyway, can we do a recompileAll for the moment?
> >>>
> >>> thanks!
> >>>
> >>> --
> >>> Mariano
> >>> http://marianopeck.wordpress.com
> >>>
> >>
> >
> >
> >
> > --
> > Mariano
> > http://marianopeck.wordpress.com
> >
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>
>
> --
> best,
> Eliot
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>
>
> --
> best,
> Eliot
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>