<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Okay. A full re-compilation of macos64ARMv8 seems to do the trick. Maybe my experiments did the partial re-compilation wrong?<div><br></div><div>Here is what I did after changing some code:</div><div><br></div><div>rm -r Squeak.app</div><div>./mvm -f</div><div><br></div><div>But after this, it seems to work without segfaults:</div><div><br></div><div>make cleanall</div><div>./mvm -f</div><div><br></div><div>Is this expected? Anyway. I am now working with that VM for over an hour and there are no segfaults. Yay!</div><div><br></div><div>Best,</div><div>Marcel</div><div><br></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;'>
                        <p style='color: #AAAAAA; margin-top: 10px;'>Am 05.04.2022 09:02:12 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:</p><div style='font-family:Arial,Helvetica,sans-serif'><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Eliot --<div><br></div><div>> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">No; I see no such issues in my use of the M1 vm.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">This begs the question ... did you try to use PR 620 for some minutes?</span></div><div><span style="font-size: 13px;font-family: Arial, Helvetica, sans-serif">https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/620</span><br></div><div><span style="font-size: 13px;font-family: Arial, Helvetica, sans-serif"><br></span></div><div><span style="font-size: 13px;font-family: Arial, Helvetica, sans-serif">I will take another look but I am almost certain that this issue is not caused by PR 620 but just triggers an issue present in the ARMv8 JIT. Hmm...</span></div><div><span style="font-size: 13px;font-family: Arial, Helvetica, sans-serif"><br></span></div><div><span style="font-size: 13px;font-family: Arial, Helvetica, sans-serif">Best,</span></div><div><span style="font-size: 13px;font-family: Arial, Helvetica, sans-serif">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 05.04.2022 00:26:18 schrieb Eliot Miranda <eliot.miranda@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite" style="min-width: 500px">On Apr 4, 2022, at 12:05 AM, Marcel Taeumel <marcel.taeumel@hpi.de> wrote:<br><br></blockquote></div><blockquote type="cite" style="min-width: 500px"><div dir="ltr"><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Eliot --<div class="mb_sig"></div>
                                        <div><br></div><div>Thanks for the report! :-) I assume that you were able to reproduce the segfaults.</div></div></div></blockquote><div dir="ltr"><br></div>No; I see no such issues in my use of the M1 vm.</div><div dir="ltr"><br><blockquote type="cite" style="min-width: 500px"><div dir="ltr"><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr"><div>> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 10pt">Why x8 is getting changed I don't know.  More investigation is needed :-)</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 10pt"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 10pt">Indeed. I am now (kind of) certain that those segfaults do not occur in the macos64x64 build.Thus, I think that PR 620 is safe to merge.</span></div><div><a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/620"><span style="font-size: 10pt;font-family: Arial, Helvetica, sans-serif">https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/620</span></a><span style="font-family: Arial, Helvetica, sans-serif;font-size: 10pt"> </span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 10pt"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 10pt">Let's assume that those changes, which enqueue display events on a regular basis, are somehow related to the more frequent segfaults. Using the -metal backend, the place where those events are likely to be scheduled is here:</span></div><div><br></div><div><a title="platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m" class="Link--primary" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/620/files#diff-3508089726a0912d666567b311fcb68d8d83be6ee5f94395830c2557b2e27cb6">platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m</a><br></div><div>249: <span style="font-size: 10pt">[</span><span class="pl-c1" style="font-size: 10pt">self</span><span style="font-size: 10pt"> </span><span class="pl-c1" style="font-size: 10pt">setNeedsDisplayInRect:</span><span style="font-size: 10pt"> [</span><span class="pl-c1" style="font-size: 10pt">self</span><span style="font-size: 10pt"> </span><span class="pl-c1" style="font-size: 10pt">frame</span><span style="font-size: 10pt">]];</span></div><div><span style="font-size: 10pt"><br></span></div><div><span style="font-size: 10pt">Then, the place where that event gets processed frequently is here:</span></div><div><span style="font-size: 10pt"><br></span></div><div><a title="platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m" class="Link--primary" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/620/files#diff-49a3a3e74d7f53b7b188157183daf83ca041c5c3cbec2ef2a4a21746440bb962">platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m</a><span style="font-size: 10pt"><br></span></div><div>81: <span style="font-size: 10pt">[</span><span class="pl-smi" style="font-size: 10pt">gDelegateApp</span><span style="font-size: 10pt">.squeakApplication </span><span class="pl-c1 x x-first" style="font-size: 10pt">pumpRunLoopEventSendAndSignal:</span><span class="pl-c1 x x-last" style="font-size: 10pt">NO</span><span style="font-size: 10pt">];</span></div><div><span style="font-size: 10pt"><br></span></div><div><a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/54519ffe59d4b0e5dfccd5684f8a4af505325dbf/platforms/iOS/vm/OSX/sqSqueakOSXApplication%2Bevents.m#L147"><span style="font-size: 10pt">platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m</span></a><br></div><div>147: <span style="font-size: 10pt">[</span><span class="pl-c1" style="font-size: 10pt">NSApp</span><span style="font-size: 10pt"> </span><span class="pl-c1" style="font-size: 10pt">sendEvent:</span><span style="font-size: 10pt"> event];</span></div><div><span style="font-size: 10pt"><br></span></div><div><span style="font-size: 10pt">It may be useful to monitor the integrity of x8 while display events are being handled.</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><br></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 02.04.2022 04:34:35 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,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 1, 2022 at 2:37 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_7845037568732718066__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr">
                                        Hi Eliot --<div><br></div><div>The segfaults might be related to #checkForEventsMayContextSwitch:. Currently, it directly pumps all events, which now include some display events. But before that, it tries to go some compacted-code path:</div><div><br></div><div><span style="font-size: 13.3333px">checkForEventsMayContextSwitch: bool</span><br></div><div>   ...</div><div><span style="font-size: 13.3333px">   self checkCogCompiledCodeCompactionCalledFor.</span><br></div><div><span style="font-size: 13.3333px">   ...</span></div><div><span style="font-size: 13.3333px">   self ioProcessEvents.</span></div><div><span style="font-size: 13.3333px">   ...</span></div><div><span style="font-size: 13.3333px"><br></span></div><div>Now, #ioProcessEvents may end up reading the displayBits. Yes, those are pinned ... and "commenceCogCompiledCodeCompaction" seems to always show up at the C stack backtrace ...</div></div></blockquote><div><br></div><div class="gmail_default" style="font-size: 10pt">The last thing in the crash dump is **CompactCode**, which shows that the VM is in code compaction.  It just so happens that code compaction is almost always invoked from <span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px">checkForEventsMayContextSwitch:, so that isn't interesting.  Why the VM is crashing in </span><span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px">commenceCogCompiledCodeCompact</span><span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px">ion is the question. Looking at the function in lldb it seems that the crash is on return from </span>compactCogCompiledCode.  The stack trace points us to compactCogCompiledCode + 204:</div><div class="gmail_default" style="font-size: 10pt"><br></div><div class="gmail_default" style="font-size: 10pt">2   squeak                              0x0000000100a0cd1c sigsegv + 240<br>3   libsystem_platform.dylib            0x0000000195d82c44 _sigtramp + 56<br>4   squeak                              0x00000001009bfb04 <b>commenceCogCompiledCodeCompaction + 204</b><br>5   squeak                              0x000000010098a7e8 checkForEventsMayContextSwitch + 104<br>6   squeak                              0x000000010098ed24 ceStackOverflow + 136<br></div><div class="gmail_default" style="font-size: 10pt"><span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px"><br></span></div><div class="gmail_default" style="font-size: 10pt"><span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px">disassembling in lldb we see:</span></div><div class="gmail_default" style="font-size: 10pt"><span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px"><br></span></div><div class="gmail_default" style="font-size: 10pt">(lldb) dis -n commenceCogCompiledCodeCompaction<span style="color: rgb(0,0,0);font-family: Arial;font-size: 13.333333015441895px"><br></span></div><div class="gmail_default" style="font-size: 10pt">...</div><div class="gmail_default" style="font-size: 10pt">Squeak[0x10004caa0] <+196>: str    x9, [x8, #0x8]<br>Squeak[0x10004caa4] <+200>: bl     0x100056e7c               ; compactCogCompiledCode at cogitARMv8.c:10187<br>Squeak[0x10004caa8] <+204>: adrp   x8, 251<br>Squeak[0x10004caac] <+208>: str    xzr, [x8, #0xb00]<br>Squeak[0x10004cab0] <+212>: nop<br>Squeak[0x10004cab4] <+216>: str    xzr, [x8, #0xaf8]<br>Squeak[0x10004cab8] <+220>: ldr    x8, [x20, #0xdc8]<br></div><div class="gmail_default" style="font-size: 10pt">...</div><div class="gmail_default" style="font-size: 10pt"><br></div><div class="gmail_default" style="font-size: 10pt">So it looks like the crash is actually the store</div><div class="gmail_default" style="font-size: 10pt">Squeak[0x10004caac] <+208>: str    xzr, [x8, #0xb00]<br></div><div class="gmail_default" style="font-size: 10pt">and perhaps x8 has been corrupted.  It has the value 6, which isn't going to work for the store.  Why x8 is getting changed I don't know.  More investigation is needed :-)</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_7845037568732718066__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 31.03.2022 18:23:26 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_7845037568732718066__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr">Hi Eliot --<div></div><div><br></div><div>I am trying to understand some sporadic segfaults while fixing some things around -core-graphics and -metal backends: <a href="https://github.com/marceltaeumel/opensmalltalk-vm/tree/marceltaeumel/high-resolution-fix" style="font-size: 10pt" target="_blank"><span style="font-size: 10pt">https://github.com/marceltaeumel/opensmalltalk-vm/tree/marceltaeumel/high-resolution-fix</span></a></div><div><br></div><div>The current changes for -core-graphics and -metal backends in this branch put more "pressure" on the applications event loop. In that area, I could tweak vmIOProcessEvents a little bit to get less segfaults. I think it was some old Carbon-related code. However, the sporadic segfaults remain. At one point, I could just try to open a new MVC or Morphic project and the VM would segfault. :-/ Sometimes it takes a little bit longer.</div><div><br></div><div>Please find attached an exemplary crash report.</div><div><br></div><div>I have not yet managed to reproduce that segfault in an X86_64 builds (i.e., macos64x64) ... Am I doing this or is there some bug in the ARM JIT? :-/</div><div><br></div><div>If you try out this branch, make sure to have a recent Squeak Trunk and do-it:</div><div>"WorldState disableDeferredUpdates: true"</div><div><br></div><div>Otherwise you will see flickering and not see dragging within Morphic.</div><div><br></div><div>Best,</div><div>Marcel</div><div><br></div></div></div></blockquote></div></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></div></blockquote></div></div></div></div></blockquote></div></div></blockquote>
                                        </div></body>