[Pharo-project] Reliable method change detection

Martin Dias tinchodias at gmail.com
Sat Mar 17 01:17:39 EDT 2012


In Fuel (bleeding edge), a compiled method can be serialized as a global.
Basically, we store the class name and selector, so loading it is
straightforward... this can be fine if we suppose there were not any change
in the system between save and load time. This can be a huge supposition,
but maybe it's acceptable in some uses, for example to "log" exceptions.

Well, actually we can discuss if this is a good approach, but anyway I am
interested on how to detect a BIG change, for example the one I show in the
following code (which produces a vm crash):

| byteArray aClass aClosure materializedClosure |

aClass := Object subclass: #A.
 aClass compileSilently: 'methodWithClosure  ^ [ 42 ] '.

aClosure := aClass new perform: #methodWithClosure.

byteArray := FLSerializer serializeToByteArray: aClosure.

aClass compileSilently: 'methodWithClosure  ^ 42'.

materializedClosure := FLMaterializer materializeFromByteArray: byteArray.
materializedClosure value.

What can we do to detect this change?
- generate a checksum with bytecodes
- just compare the size
- something else?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120317/6766dd62/attachment-0001.html>

More information about the Pharo-dev mailing list