<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Calibri Light";
panose-1:2 15 3 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
{mso-style-priority:1;
margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";
color:black;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Juan,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#testSuspendAndResume was leaving a blocked process behind, so just a little cleanup - enclosed.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best,</p>
<p class="MsoNoSpacing"><span lang="CS">--</span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;color:#333333;font-weight:normal">Jaromír Matas</span></strong><span style="font-family:"Calibri Light",sans-serif;color:#555555"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="font-family:"Calibri Light",sans-serif;color:#2E75B6">mail@jaromir.net<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:juan@cuis.st">Juan Vuletich</a><br>
<b>Sent: </b>Saturday, January 21, 2023 16:33<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:mail@jaromir.net">Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] Follow-up: #terminate and #suspend update</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">Thanks Jaromir! At GitHub now.<br>
<br>
Cheers,<br>
<br>
On 1/19/2023 3:46 PM, Jaromir Matas via Cuis-dev wrote: <o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Hi Juan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I’m enclosing process and semaphore tests I owe you, illustrating the new #suspend semantics and some more process tests to cover borderline termination cases (single context stack, two ensure contexts on top of
each other and such).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Best,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Jaromir<o:p></o:p></span></p>
<p class="MsoNoSpacing"><span lang="CS" style="color:black">--</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;font-weight:normal">Jaromír Matas</span></strong><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="color:black"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:rgb(225,
225, 225) -moz-use-text-color -moz-use-text-color">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black"><a href="mailto:cuis-dev@lists.cuis.st">Jaromir Matas via Cuis-dev</a><br>
<b>Sent: </b>Thursday, January 19, 2023 12:25<br>
<b>To: </b><a href="mailto:juan@cuis.st">Juan Vuletich</a>; <a href="mailto:cuis-dev@lists.cuis.st">
Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:mail@jaromir.net">Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] Follow-up: #terminate and #suspend update<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Hi Juan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I’ve observed the debugger to pop up all of a sudden a few times when working with the Process Browser. The root cause seems to be my #isDone method:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">isDone<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> "Answer if the receiver has no unexecuted code left."<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> self isDead ifTrue: [^true].<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> self isBottomContext ifTrue: [^self atEnd].<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> self atEnd ifTrue: [^self sender isDone].<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> ^false<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">The second line checks if the sender variable is nil and hence the third line assumes the sender is not nil – however it may still be nil if the method computation is preempted and the higher priority process being
checked terminates in the meantime.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Here’s my improved version (also enclosed):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">isDone<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> "Answer if the receiver has no unexecuted code left."<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> ^sender ifNil: [self isDeadOrAtEnd] ifNotNil: [:ctx | ctx isDone]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I think this should work as expected because ifNil:ifNotNil: is inlined (not a send).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">PS: as a side-effect the ProcessorTest suite now works fine consistently; before, some of the tests failed occasionally (on my Win10/Intel machine).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Best,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Jaromir<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNoSpacing"><span lang="CS" style="color:black">--</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;font-weight:normal">Jaromír Matas</span></strong><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="color:black"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:rgb(225,
225, 225) -moz-use-text-color -moz-use-text-color">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black"><a href="mailto:juan@cuis.st">Juan Vuletich</a><br>
<b>Sent: </b>Tuesday, September 6, 2022 16:25<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:mail@jaromir.net">Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] #terminate and #suspend update<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Hi Jaromir,<br>
<br>
On 8/27/2022 7:12 AM, Jaromir Matas via Cuis-dev wrote: <o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Hi Juan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">> There is one problem left. #isTerminated will always answer false if #suspend primitive failed and old primitive 88 fallback method is called. I just pushed to github update #5458 to address this. Please check
it carefully. Maybe you prefer a different solution, I'll be happy to review and integrate it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Oops, I forgot to mention the backward compatibility consideration but you caught it :) (meaning: to be able to run new images with older VMs, not only older images with the new VM). Squeak decided to maintain
only its ability to run older images with the new VM - so no change in #isTerminated in Squeak; however I agree with you that "fixing" #isTerminated is worth the effort provided the fix is pretty easy.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I'm enclosing my original suggestion for #isTerminated; I think the semantics is very similar to your version (checking whether the remaining context chain has anything useful left) except one thing: Your version
allows a process with its suspended context's pc = nil to be considered not terminated. My understanding was: if a process's suspended context's pc is nil, it implies the process would be considered terminated. Is this right or would you define 'being terminated'
differently?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Check this example:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">ctx _ [] asContextWithSender: [] asContext.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">p _ Process forContext: ctx priority: 40.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">ctx pc: nil.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">p isTerminated. "answers false in your version and true in mine"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I already noticed a while ago my previous version of #isTerminated failed to catch pc = nil in a process's suspended context and evaluate the process as 'terminated'. I wonder now what definition of 'terminated'
state is actually 'the right one'.<o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
I had assumed there would always be sender frames. I believe my code worked correctly unless there were no sender frames of the frame with pc=nil. In any case, your version is more robust and nicer code. I just integrated it. Thanks!<br>
<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Another question: in the example above - how do you look at the bytecodes of ctx? In Squeak the Explorer shows the bytecodes right away but in Cuis I have to open an extra inspector for 'method' and look at 'allBytecodes',
right? <o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
Yes. You are right. The explorer could be improved, to behave like Squeak's in this case. If you happen to have a couple of hours to hack this, it would be useful.<br>
<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">In Squeak the process p answers true to #isTerminated even without nilling its pc, which is expected because each of the two contexts consists only of a single instruction, a return. But in Cuis I'm not sure how
come the answer is false; I suspect I've got confused by the different implementation of Context / ContextPart in Squeak/Cuis. Here's what I mean:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">ctx _ [] asContextWithSender: [] asContext.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">p _ Process forContext: ctx priority: 40.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">p isTerminated. "answers false in Cuis and true in Squeak because ctx atEnd differs"<o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
Just tried the example above, and it answers false in Squeak 6.0 alpha 21576 on my Intel Mac. Maybe this has changed recently? Perhaps it needs fixing in both environments.<br>
<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">... while this works the same in both:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">ctx _ [1] asContextWithSender: [] asContext.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">p _ Process forContext: ctx priority: 40.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">p isTerminated. "answers false in both Cuis and Squeak because ctx is not atEnd"<o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
Yes it does.<br>
<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Thank you for your advice.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Jaromir<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNoSpacing"><span lang="CS" style="color:black">--</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;font-weight:normal">Jaromír Matas</span></strong><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="color:black"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
Thanks,<o:p></o:p></span></p>
<pre>-- </pre>
<pre>Juan Vuletich</pre>
<pre>cuis.st</pre>
<pre>github.com/jvuletich</pre>
<pre>researchgate.net/profile/Juan-Vuletich</pre>
<pre>independent.academia.edu/JuanVuletich</pre>
<pre>patents.justia.com/inventor/juan-manuel-vuletich</pre>
<pre>linkedin.com/in/juan-vuletich-75611b3</pre>
<pre>twitter.com/JuanVuletich</pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal"><span style="color:black"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>-- </pre>
<pre>Juan Vuletich</pre>
<pre>cuis.st</pre>
<pre>github.com/jvuletich</pre>
<pre>researchgate.net/profile/Juan-Vuletich</pre>
<pre>independent.academia.edu/JuanVuletich</pre>
<pre>patents.justia.com/inventor/juan-manuel-vuletich</pre>
<pre>linkedin.com/in/juan-vuletich-75611b3</pre>
<pre>twitter.com/JuanVuletich</pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
</div>
</body>
</html>