[Pharo-dev] MetaLink question
thierry.goubier at gmail.com
Tue Oct 3 11:03:21 EDT 2017
2017-10-03 16:45 GMT+02:00 Marcus Denker <marcus.denker at inria.fr>:
> > On 1 Oct 2017, at 14:58, Thierry Goubier <thierry.goubier at gmail.com>
> > Hi,
> > is there a way to look at a method code once it has been added metalinks?
> You can inspect the method. The best is to turn on #
> (just add
> optionCompileOnLinkInstallation: true;
> to the link definition).
> This way the method is recompiled when installing the link, not on
> After you can inspect the method and look at the Bytecode / IR.
This is what I ended up doing: looking at the IR, understanding the code
that the Metalink was generating (an #ensure:, since it was an after link)
rewriting a similar code in smalltalk to check the IR differences, and
finding out where it got it wrong.
I solved this one by making it a weak after link (adding the weak whatever
> > I'm trying to add a metalink after the last statement of a block and it
> fails on IR generation with an unknown temporary...
> If you have a test I can have a look, too
It was trying to add an after link to the last expression of a [:p | p + ml
] block in a #collect:.
The mistake was that when writing the ensure (rewriting as [:p | [ p + ml ]
ensure: [ link ] ] ), it would forget to add the temporary :p as a copied
temp? into the [ p + ml ] block.
The workaround was to ask it not to use an #ensure: block.
Then I encountered more errors of that kind (IR generation errors) on very
simple links (popping one time too much) and given that it took me a long
time to find a workaround for the first one, that I could not find a
workaround for the second one (#after, #instead, #before, #after weak
wouldn't work), and that I was only at the third type of probes (out of
about 20) I needed to do, I stopped there.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev