<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Eliot --<div><br></div><div>Thanks. Here is a changeset that drops #methodForDecompile and that changes CompiledCodeInspector to better support CompiledBlock instances.</div><div><br></div><div>The recent implementation of MethodWrappers here (https://github.com/hpi-swa/MethodWrappers) does not need #<span style="font-size: 10pt">methodForDecompile .</span></div><div><span style="font-size: 10pt"><br></span></div><div><span style="font-size: 10pt">Which other applications of object-as-method are out there working in recent Squeak needing the #methodForDecompile hook? </span></div><div><span style="font-size: 10pt"><br></span></div><div><span style="font-size: 10pt">Best,</span></div><div><span style="font-size: 10pt">Marcel</span></div><div class="mb_sig"></div>
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 16.12.2021 08:01:05 schrieb Eliot Miranda <eliot.miranda@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size: 10pt">Hi Marcel,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 15, 2021 at 12:48 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_7045963913954553040__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr">
                                        Hi Eliot --<div><br></div><div>Here is an example to clarify the issue:</div><div><br></div><div><div><span style="font-size: 13.3333px">| method block |</span></div><div><span style="font-size: 13.3333px">method := WorldState >> #doOneCycleNowFor:.</span></div><div><span style="font-size: 13.3333px">block := method literalAt: 7.</span></div><div><span style="font-size: 13.3333px">block method decompileWithTemps nodesDo:</span></div><div><span style="font-size: 13.3333px">    [:node| (node pc isVariableBinding and: [node pc key == block method]) ifTrue: [^node]].</span></div></div><div><span style="font-size: 13.3333px">self error.</span></div><div><br></div><div>There are not valid pc's set in this scenario.</div></div></blockquote><div><br></div><div class="gmail_default" style="font-size: 10pt">Yes there are :-)  You're confusing blocks and block methods.  This works:</div><div class="gmail_default" style="font-size: 10pt"><br></div>| method compiledBlock |<br>method := WorldState >> #doOneCycleNowFor:.<br>compiledBlock := method literalAt: 7.<br>compiledBlock decompileWithTemps nodesDo:<br>    [:node| (node pc isVariableBinding and: [node pc key == compiledBlock]) ifTrue:             [^node]].<br><div class="gmail_default" style="font-size: 10pt">self error</div><div class="gmail_default" style="font-size: 10pt"><br></div><div class="gmail_default" style="font-size: 10pt">CompiledBlock>>method answers the CompiledMethod the CompiledBlock is nested within.</div><div class="gmail_default" style="font-size: 10pt"><br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_7045963913954553040__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr"><div><br></div><div>Best,</div><div>Marcel</div><div></div>
                                        <blockquote type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 15.12.2021 09:39:36 schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_7045963913954553040__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr">
                                        Hi Eliot --<div><br></div><div>(Full)BlockClosure works fine. I am talking about CompiledBlock.</div><div><br></div><div>Best,</div><div>Marcel</div><div></div><blockquote type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 14.12.2021 23:29:42 schrieb Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div dir="ltr"><div style="font-size: 10pt"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 14, 2021 at 2:27 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div dir="ltr"><div dir="ltr"><div style="font-size: 10pt"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 14, 2021 at 5:19 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_7045963913954553040gmail-m_4256451230450006763gmail-m_-6590189067939936233__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr">Hi all --<div></div><div><br></div><div>Decompilation for instances of CompiledBlock is currently wrong. It just treats the CompiledMethod where the CompiledBlock is embedded.</div></div></blockquote><div><br></div><div style="font-size: 10pt">Well, it's been that way for a long time and there's something to do with method wrappers (see methodForDecompile) that I don't understand that makes me leery of just changing this.</div><div style="font-size: 10pt"><br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_7045963913954553040gmail-m_4256451230450006763gmail-m_-6590189067939936233__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr"><div><br></div><div>Compare the following two examples:</div><div><br></div><div><div><span style="font-size: 13.3333px">[3+4] method "i.e., compiledCode" decompile decompileString.</span></div><div><span style="font-size: 13.3333px">[3+4] decompile decompileString.</span></div></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Well, first, the message #method on FullBlockClosure  is misleading because we are looking for the compiled-code object, which is an instance of CompiledBlock here.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Anyway, I then tried to understand how to make Decompiler >> decompileBlock: work for CompiledBlock and not just FullBlockClosure. It turns out, that there is no #pc set in any decompiled parse node.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">How to find a CompiledBlock's parse node in a CompiledMethod's parse tree?</span></div></div></blockquote><div><br></div><div><div style="font-size: 10pt">See Decompiler>>decompileBlock:</div><br></div><span class="gmail_default" style="font-size: 10pt">| block |</span></div><div class="gmail_quote"><span class="gmail_default" style="font-size: 10pt">block := [3+4].</span></div><div class="gmail_quote"><span class="gmail_default" style="font-size: 10pt">block</span> method decompileWithTemps nodesDo:<br><div><span class="gmail_default" style="font-size: 10pt">    </span>[:node| (node pc isVariableBinding and: [node pc key = <span class="gmail_default" style="font-size: 10pt">block</span> method]) ifTrue: [^node]] </div><div><br></div><div><div style="font-size: 10pt">=>  {[3 + 4]} </div><div style="font-size: 10pt"><br></div><div style="font-size: 10pt">i.e. the decompiler carefully sets the pc of a full block node to an association so you can find the thing.</div></div></div></div></blockquote><div><br></div><div style="font-size: 10pt">and #== works the same/is to be preferred:</div><div style="font-size: 10pt"><br></div>| block |<br>block := [3+4].<br>block method decompileWithTemps nodesDo:<br><div style="font-size: 10pt">    [:node| (node pc isVariableBinding and: [node pc key == block method]) ifTrue: [^node]]</div><div style="font-size: 10pt"></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left-width: 1px;border-left-style: solid;border-left-color: rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div dir="ltr"><div class="gmail_quote"><div><div style="font-size: 10pt"><br></div><div style="font-size: 10pt">Now, as far as changing things to work the way you expect, I don't object, provided you check out MethodWrappers, etc.</div></div><div style="font-size: 10pt">CompiledMethod>>methodForDecompile has my initials on it, but I didn't write it.  So what its comment means I don't know but we shoud find out before we break things.</div><div style="font-size: 10pt"><br></div><div style="font-size: 10pt">CompiledMethod>>methodForDecompile<br>    "This is a hook to allow recursive methods like MwMethodWrapper to avoid infinite recursion."<br>    ^self<br></div><div style="font-size: 10pt"><br></div><div style="font-size: 10pt">I *really* don't like this method, but presumably it's there for a reason.</div><div style="font-size: 10pt"><br></div></div><div dir="ltr"><div dir="ltr"><div><span style="font-size: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><span style="font-size: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
</div></blockquote>
                                        </div></div></blockquote></div><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
</div></blockquote></div>