<div dir="ltr">Hi Craig,<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 8, 2015 at 4:59 PM, Craig Latta <span dir="ltr">&lt;<a href="mailto:craig@netjam.org" target="_blank">craig@netjam.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
<br>
&gt; If you want to make progress on this you&#39;ll need to<br>
&gt;<br>
&gt; a) build a simulator image (instructions on the blog)<br>
&gt; b) set-up a test case in the simulator to exercise the<br>
&gt; cedeToHigherPriorityThreads logic and replicate the bug<br>
&gt; c) have a go at rewriting cedeToHigherPriorityThreads and/or<br>
&gt; threadSwitchIfNecessary:from: to do the right thing.<br>
<br>
</span>     Hm, I have no idea how to set up such a test case meaningfully.<br>
This seems like one of those situations where you&#39;d use a &quot;plugin<br>
simulator&quot; (like the one for BitBlt) that relies on the behavior you&#39;re<br>
debugging already working properly as simulation support in the<br>
simulation host.<br></blockquote><div><br></div><div>All you&#39;d do is simulate a callback occurring while the VM is doing something.  So...</div><div><br></div><div><br></div><div>a) write a scratch primitive called e.g. primitiveFakeAForeignCallback which forks (at a higher priority?, or at least does a yield?), and calls the relevant machinery with faked up callback data (so you can avoid all the stuff in thinkProcess which is written in C)</div><div>b) use the reader image to run this primitive via a doit containing the primitiveFakeAForeignCallback followed by some time consuming computation like 0 tinyBenchmarks.</div><div><br></div><div>So you start up the reader image, and type in the DoIt (followed by a !) into the dialog that stands in for reading from stdin.  From your DoIt the foreign callback will start its processing in primitiveFakeAForeignCallback, and get blocked trying to take ownership of the vm.  primitiveFakeAForeignCallback will return and the time-consuming computation will start and soon enough get interrupted, so the VM will enter <font color="#000000"><span style="white-space:pre-wrap">checkForEventsMayContextSwitch: and you can step through the system to see the foreign callback attempt to get control of the VM.</span></font></div><div><br></div><div><br></div><div>BTW, this is /monstrously/ cool of you!</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">-C<br>
<br>
--<br>
Craig Latta<br>
<a href="http://netjam.org" rel="noreferrer" target="_blank">netjam.org</a><br>
<a href="tel:%2B31%20%20%206%202757%207177" value="+31627577177">+31   6 2757 7177</a> (SMS ok)<br>
<a href="tel:%2B%201%20415%20%20287%203547" value="+14152873547">+ 1 415  287 3547</a> (no SMS)<br></div></div></blockquote></div><br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>