[Pharo-project] Problem with CompiledMethodTrailer

Igor Stasenko siguctua at gmail.com
Tue May 10 17:03:50 CEST 2011


here an example how it works.

first evaluate

TTT blockValue
so it assigns Block with closure returned by methodWithBlock.
Now go to #methodWithBlock and change its implementation.

And then try to debug

TTT blockValue

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.
>



-- 
Best regards,
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TTT.st
Type: application/octet-stream
Size: 826 bytes
Desc: not available
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110510/041c0238/attachment.obj>


More information about the Pharo-project mailing list