---------- Forwarded message ----------
From:
Mariano Martinez Peck <marianopeck@gmail.com>
Date: Tue, May 18, 2010 at 3:35 PM
Subject: problem with CompiledMethod equality
To: Pharo Development <
pharo-project@lists.gforge.inria.fr>
Hi folks. I was debugging a problem with Moose and I realized that 2 different methods can have the same CompiledMethod. This was weird for me. I don't know if this is correct or not.
For example, evaluate:
(InstructionClient>>#methodReturnTop) = (InstructionClient>>#doDup) -> true
If you look at
CompiledMethod = aCompiledMethod
"Answer whether the receiver implements the same code as aCompiledMethod."
| numLits |
self == aCompiledMethod
ifTrue: [ ^ true ].
self class = aCompiledMethod class
ifFalse: [ ^ false ].
self size = aCompiledMethod size
ifFalse: [ ^ false ].
self header = aCompiledMethod header
ifFalse: [ ^ false ].
self initialPC to: self endPC do: [ :i |
(self at: i) = (aCompiledMethod at: i)
ifFalse: [ ^ false ] ].
(self sameLiteralsAs: aCompiledMethod)
ifFalse: [ ^ false ].
self halt.
^ true
It is returning in the last ^ true.
What was weird for me is that (self sameLiteralsAs: aCompiledMethod) returns true also. But if I print both literals:
self literals -> {#methodReturnTop. (#InstructionClient->InstructionClient)}
aCompiledMethod literals -> {#doDup. (#InstructionClient->InstructionClient)}
So...for me they are differnt, but sameLiteralsAs: is returning true. Debugging that, it seems that in that method it is returning in the last ^ true.
So...any hints? is this the expected behavior ? or it is a bug ?
Thanks
Mariano