[Vm-dev] Re: [Pharo-project] VM problem?
Mariano Martinez Peck
marianopeck at gmail.com
Sun May 27 16:15:51 UTC 2012
> More than that, since CompiledMethod redefines #=, it is strange that
> it's not redefines #hash as well,
> because it is one of requirements to make sure they are always in sync.
> > Two conclusions:
> > The solution is to define CompiledMethod>hash such that it does not
> access bytes < initialPC. The hash it is inheriting from ByteArray is fine
> for ByteArray but not at all OK for CompiledMethod.
> Yes, i would just do
> self methodClass hash bitXor: self selector hash
that's one possibility. If we want to continue with the previous kind of
hash we also could do something like:
CompiledMethod >> hash
"#hash is implemented, because #= is implemented"
hashBytes: self bytecodes
startingWith: self species hash
CompiledMethod >> bytecodes
| initialPC endPC bytecodes |
initialPC := self initialPC.
endPC := self endPC.
bytecodes := ByteArray new: (endPC - initialPC + 1).
initialPC to: endPC do: [:index |
bytecodes at: (index - initialPC + 1) put: (self at: index)
I am not a hashing expert. What do you think? which impl should we do?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev