<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>>#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="">"local1:=25. <-- evaluate during debugging"</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 "local:=25" after the debugger halts for <br></div><div>"i halt" will modify the var "remote1" instead of "local1", 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>"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".<br>)<br><br></div>But the implementation (OCCopyingTempVariable>>#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 "local1:=25" 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't checked (the argument "two"), therefore<br></div><div>the test succeed. In spur, this testcase modifes a different outer context var "remote1", 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>