<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>> <span style="font-size:12pt">As ctxt is *not* a top context as required by #jump, we need to put a (fake) return value (nil) on its stack. Otherwise, #jump will pop something different from the stack. Concretely, this caused the bug described in [1] (Scenario
 1) because the latest stack top was the closure vector {chain}. This closure vector was accidently popped away so that in the final return statement, #pushRemoteTemp:inVectorAt: raised an error subscript bounds (because the next stack item was not variable).</span></p>
<div><br>
</div>
<p></p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">
<div class="x__rp_U4 x_ms-font-weight-regular x_ms-font-color-neutralDark x_rpHighlightAllClass x_rpHighlightBodyClass" id="x_Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="x_divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="x_Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">To refine this description even more: From the perspective of the #jump context, the latest stack top of its receiver was the block closure in #contextEnsure: (or #contextOn:do:) rather than the closure vector.
 So after returning from #jump, the closure vector was on the stack top and thus got popped by the next bytecode statement. But that's rather a detail; it does not affect the problem and its solution. Just for protocol.</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Btw: I found the new <a href="http://forum.world.st/Changeset-Concept-BytecodeDebugger-3-cs-td5110352.html" class="x_OWAAutoLink">
BytecodeDebugger</a> quite useful for investigating this bug :-)</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Best,</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Christoph</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Montag, 27. Januar 2020 12:59:29<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Inbox: Kernel-ct.1296.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">A new version of Kernel was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Kernel-ct.1296.mcz">http://source.squeak.org/inbox/Kernel-ct.1296.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-ct.1296<br>
Author: ct<br>
Time: 27 January 2020, 12:59:15.057199 pm<br>
UUID: e60f4637-b4fc-9947-94d3-50e7aa58ab82<br>
Ancestors: Kernel-tonyg.1293<br>
<br>
Fixes context simulation bug in #contextEnsure: and #contextOn:do:<br>
<br>
As ctxt is *not* a top context as required by #jump, we need to put a (fake) return value (nil) on its stack. Otherwise, #jump will pop something different from the stack. Concretely, this caused the bug described in [1] (Scenario 1) because the latest stack
 top was the closure vector {chain}. This closure vector was accidently popped away so that in the final return statement, #pushRemoteTemp:inVectorAt: raised an error subscript bounds (because the next stack item was not variable). Read the linked bug report
 for more details.<br>
<br>
[1] <a href="http://forum.world.st/BUG-s-in-Context-control-jump-runUntilErrorOrReturnFrom-td5107263.html">
http://forum.world.st/BUG-s-in-Context-control-jump-runUntilErrorOrReturnFrom-td5107263.html</a><br>
<br>
=============== Diff against Kernel-tonyg.1293 ===============<br>
<br>
Item was changed:<br>
  ----- Method: Context class>>contextEnsure: (in category 'special context creation') -----<br>
  contextEnsure: block<br>
         "Create an #ensure: context that is ready to return from executing its receiver"<br>
  <br>
         | ctxt chain |<br>
         ctxt := thisContext.<br>
+        [chain := thisContext sender cut: ctxt.<br>
+        ctxt push: nil.<br>
+        ctxt jump] ensure: block.<br>
-        [chain := thisContext sender cut: ctxt. ctxt jump] ensure: block.<br>
         "jump above will resume here without unwinding chain"<br>
         ^ chain!<br>
<br>
Item was changed:<br>
  ----- Method: Context class>>contextOn:do: (in category 'special context creation') -----<br>
  contextOn: exceptionClass do: block<br>
         "Create an #on:do: context that is ready to return from executing its receiver"<br>
  <br>
         | ctxt chain |<br>
         ctxt := thisContext.<br>
+        [chain := thisContext sender cut: ctxt.<br>
+        ctxt push: nil.<br>
+        ctxt jump] on: exceptionClass do: block.<br>
-        [chain := thisContext sender cut: ctxt. ctxt jump] on: exceptionClass do: block.<br>
         "jump above will resume here without unwinding chain"<br>
         ^ chain!<br>
<br>
<br>
</div>
</span></font>
</body>
</html>