<div dir="ltr">Yes, spooky action at a distance :)<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 9, 2023 at 1:45 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Florin,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">    I've found the issue, which is an infinite loop in the Decompiler for your undecompilable version.  Strangely enough it has nothing to do with the code you modify. It has to do with the middle ifTrue: of the three at the end of the final block:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">                   mm1 eventHandler<br>                                        ifNotNil: [(morphs includesAllOf: mm1 eventHandler allRecipients)<br>                                                     ifTrue: [mm1 eventHandler: nil]].<br>                                   <b>mm1 isMorphicModel<br>                                       ifTrue: [mm1 model isMorphicModel<br>                                                     ifTrue: [mm1 model breakDependents]].</b><br>                             mm1 isTextMorph<br>                                   ifTrue: [mm1 setContainer: nil]]].<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I can fix it for this one method, but not without breaking decompilation of about 40 other methods.  So I need to understand it better.  Give me a few days.  I've called on a higher power (the original author is Dan himself). So hopefully we'll get this sorted very soon.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 8, 2023 at 7:01 PM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" target="_blank">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div>Hi,</div><div><br></div><div>Happy New Year everybody!</div><div><br></div><div>I hope you will forgive my transgression, I know this is not about the VM, it is about the bytecode compiler, but I am only subscribed to this list, and the Squeak compiler is somewhere in between.</div><div><br></div><div>I have recently stumbled upon a regression introduced by Compiler-eem.483</div><div>One of my generated (transformed) methods is apparently valid Smalltalk - it can still be compiled - but it cannot be decompiled anymore. I am not sure if this is a compiler bug, or a latent decompiler bug exposed by the changes in 
Compiler-eem.483 <br></div><div><br></div><div>My method is below, it is a transformed variant of NativeImageSegment>>findRogueRootsPrep<br></div><div><br></div><div>The bug is somehow caused by the literal #Marker. I have started at the bytecodes and they look ok to me, but the decompiler enters an (apparently unrelated) infinite loop. It is also not just about the literal itself or the immediate surrounding code, the method needs to be big/complex enough (over a certain number of literals?) to trigger the bug.<br></div><div><br></div><div><br></div><div>findRogueRootsPrep1<br>     "Part of the tool to track down unwanted pointers into the segment.  Break all owner pointers in submorphs, scripts, and viewers in flaps."<br>        | wld players morphs |<br>        wld := arrayOfRoots detect: [:obj | obj isMorph and: [obj isWorldMorph]] ifNone: [].<br>  wld == nil ifTrue: [</div><div>  (wld := arrayOfRoots<br>    detect: [:obj1 | obj1 isMorph]<br>    ifNone: [#Marker]</div><div>  ) == #Marker ifTrue: [</div><div>    ^ self error: 'can''t find a root morph']].<br>  morphs := IdentitySet new: 400.<br>       wld allMorphsAndBookPagesInto: morphs.<br>        players := wld presenter allExtantPlayers. "just the cached list"<br>   players do: [:pp | | scriptEditors |<br>  scriptEditors := pp class tileScriptNames collect: [:nn | pp scriptEditorFor: nn].<br>  scriptEditors do: [:se | morphs addAll: se allMorphs]].<br>       wld submorphs do: [:mm | "non showing flaps"<br>  (mm isKindOf: FlapTab) ifTrue: [</div><div>    mm referent allMorphsAndBookPagesInto: morphs]].<br>morphs do: [:mm1 | "break the back pointers"<br>  mm1 isInMemory ifTrue: [</div><div>    (mm1 respondsTo: #target) ifTrue: [</div><div>      mm1 nearestOwnerThat: [:ow | | zzzTemp |<br>        ow == mm1 target ifTrue: [</div><div>          mm1 target: nil.<br>          zzzTemp := true<br>        ] ifFalse: [</div><div>          zzzTemp := false].<br>        zzzTemp]].<br>    (mm1 respondsTo: #arguments) ifTrue: [</div><div>      mm1 arguments do: [:arg | <br></div><div>        arg == nil ifFalse: [</div><div>          mm1 nearestOwnerThat: [:ow1 | | zzzTemp1 |<br>            ow1 == arg ifTrue: [</div><div>              mm1 arguments at: (mm1 arguments indexOf: arg) put: nil.<br>              zzzTemp1 := true<br>            ] ifFalse: [</div><div>              zzzTemp1 := false].<br>            zzzTemp1]]]].<br>    mm1 eventHandler == nil ifFalse: ["recipients point back up"<br>      (morphs includesAllOf: mm1 eventHandler allRecipients) ifTrue: [</div><div>        mm1 eventHandler: nil]].<br>    "temporary, until using Model for PartsBin"<br>    mm1 isMorphicModel ifTrue: [</div><div>      mm1 model isMorphicModel ifTrue: [</div><div>        mm1 model breakDependents]].<br>    mm1 isTextMorph ifTrue: [</div><div>      mm1 setContainer: nil]]].<br>        (Smalltalk includesKey: #Owners) ifTrue: [</div><div>  Smalltalk at: #Owners put: nil].<br>  "in case findOwnerMap: is commented out"<br>    "self findOwnerMap: morphs."<br>        morphs do: [:mm2 | "break the back pointers"<br>  mm2 isInMemory ifTrue: [</div><div>    mm2 privateOwner: nil]]</div><div><br></div><div><br></div><div>Florin<br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</blockquote></div>