[Pharo-project] Problem with CompiledMethodTrailer
siguctua at gmail.com
Tue May 10 17:03:50 CEST 2011
here an example how it works.
so it assigns Block with closure returned by methodWithBlock.
Now go to #methodWithBlock and change its implementation.
And then try to debug
and you can see that when you evaluating a block , it will show you an
original source code of method.
(Except that there is some bug in debugger, which erasing the text
area once you click on frame with block.
But when you click it second time it show it normally).
On 10 May 2011 16:46, Igor Stasenko <siguctua at gmail.com> wrote:
>> oh , and forgot to note, that having a source code available at all
>> times is quite useful in cases,
>> when your methods using some kind of DSL. Because decompiler can only
>> reconstruct a source code of smalltalk methods,
>> but not the ones, which were authored using customized parser/compiler
>> .. like using Helvetia.
> Btw, the change i proposing is _minimal_ and straightforward:
> basicAddSelector: selector withMethod: compiledMethod
> "Add the message selector with the corresponding compiled method to the
> receiver's method dictionary.
> Do this without sending system change notifications"
> | oldMethodOrNil |
> oldMethodOrNil := self lookupSelector: selector.
> self methodDict at: selector put: compiledMethod.
> compiledMethod methodClass: self.
> compiledMethod selector: selector.
> "Now flush Pharo's method cache, either by selector or by method"
> oldMethodOrNil ifNotNil: [
> oldMethodOrNil flushCache.
> ++++ oldMethodOrNil dropSourcePointer.
> selector flushCache.
> Best regards,
> Igor Stasenko AKA sig.
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 826 bytes
Desc: not available
More information about the Pharo-project