<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hello,<br><br></div>we have a failing test (OCClosureCompilerTest&gt;&gt;#testDebuggerTempAccess)<br>(fails since spur, but not related - I think).<br><br></div>A simple example to reproduce the behavior:<br><pre class=""><span class="">|</span><span class=""> local1 remote1</span><span class="">|</span><span class="">
remote1</span><span class="">:=</span><span class="">4.</span><span class="">
local1 </span><span class="">:=</span><span class="">3.</span><span class="">
</span><span class="">[:</span><span class="">i </span><span class="">|</span><span class=""> </span><span class="">|</span><span class="">c</span><span class="">|</span><span class="">
    c </span><span class="">:=</span><span class=""> local1</span><span class="">.</span><span class="">
    remote1 </span><span class="">:=</span><span class=""> i</span><span class="">.</span><span class="">
    i halt</span><span class="">.</span><span class="">
    </span><span class="">&quot;local1:=25.  &lt;-- evaluate during debugging&quot;</span><span class="">
     </span><span class="">]</span><span class=""> value</span><span class="">:</span><span class="">1.</span><span class=""><br></span><span class=""><span class="">Transcript show:local1;cr.<br></span>Transcript show:remote1;cr</span><span class="">.</span></pre>(Executing this code and evaluating &quot;local:=25&quot; after the debugger halts for <br></div><div>&quot;i halt&quot; will modify the var &quot;remote1&quot; instead of &quot;local1&quot;, as this is a vector tempvar , proceeding<br></div><div>the execution will crash at accessing the remote1 value).<br></div><div><br></div><div><br></div>The purpose of the testDebuggerTempAccess test case is, evaluating code<br></div>that changes the value of a copied temp var *does not* change the value of<br></div>this var in the outer context. (see comment in the test case:<br>&quot;this is not 25 as the var is a local, non escaping variable that was copied into the block,<br>    If the compiler would have known about the write, it would have made the var escaping&quot;.<br>)<br><br></div>But the implementation (OCCopyingTempVariable&gt;&gt;#writeFromContext: aContext scope: contextScope value: aValue)<br></div>explicitly iterates through all outer context(s) and changes the vars as well.<br><br></div>1. Question: Who is right?<br><br></div>But the reason why the test actually fails is different. It is because evaluating<br></div>the code that modifies the var &quot;local1:=25&quot; ends up to a call<br></div>aContext tempAt: self indexFromIR put: aValue<br></div>but the index (indexFromIR) can be different for every context (method context / inner block<br></div>context(s)).<br><br></div>2. Question: should the index be always the same?<br><br></div>thanks inadvance<br></div><br></div>Nicolai<br><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><br><br></div><div>ps: since spur (resp. compiler changes that were done for new spur images), the index of tempvars can be different.<br>In pre-spur, this testcase modifies an outer context var, but one that isn&#39;t checked (the argument &quot;two&quot;), therefore<br></div><div>the test succeed. In spur, this testcase modifes a different outer context var &quot;remote1&quot;, and the test<br></div><div>fails.<br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>