<br><br><div class="gmail_quote">On Feb 11, 2008 12:29 PM, tim Rowledge &lt;<a href="mailto:tim@rowledge.org">tim@rowledge.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><br><div><div class="Ih2E3d"><div>On 10-Feb-08, at 2:53 PM, Michael van der Gulik wrote:</div><blockquote type="cite"><div class="gmail_quote"><div><br>But the execution of that block (a BlockContext?) will be added to the top of the current execution stack thus preserving the linearity of the stack, right?</div>
</div></blockquote><div><br></div></div>Nope.&nbsp;</div><div>A stack is linear last-in first-out. In C you branch to a subroutine, a stackframe is built on the stack and you excute code based on that. When you return from the subroutine all the memory in that stackframe is known to be free to reuse immediately if wanted by the next subroutine call.&nbsp;</div>
<div><br></div><div>If you can get a handle to the actual stackframe and pass it to some other code then you *cannot* reuse that memory until you have some way of knowing it is no longer needed. So now you have a sandbar in your stack and a tricky problem to solve. &nbsp;In squeak we do it the simple minded way and don&#39;t have contiguous stack but instead have actual explicitly allocated objects in the heap. That completely avoids the problem, at a cost in performance. VW uses a lot of very clever code to allow the system to live with a linearised machine compatible stack and yet present a &#39;proper&#39; object to the programmer. It works, it&#39;s fast, but the complexity is at times bewildering.</div>
<div><br></div><div>I&#39;m reasonably sure this is explained in the Blue Book and certainly in various seminal papers such as the Deutsch-Schiffman 84 paper &#39;<span><font color="#000000"><span style="background-color: transparent;">Efficient implementation of the smalltalk-80 system&#39; (</span></font><span><span><font color="#000000"><span style="background-color: transparent;"><a href="http://portal.acm.org/citation.cfm?id=800542" target="_blank">http://portal.acm.org/citation.cfm?id=800542</a></span></font></span><span><font color="#000000"><span style="background-color: transparent;">) and the Miranda &#39;87 paper &#39;BrouHaHa- A portable Smalltalk Interpreter&#39;.</span></font></span></span></span></div>
</div></blockquote><div><br><br>Oh - that&#39;s what he meant by a linear stack - stack frames are contiguous in memory.<br></div></div><br>Gulik.<br><br clear="all"><br>-- <br><a href="http://people.squeakfoundation.org/person/mikevdg">http://people.squeakfoundation.org/person/mikevdg</a><br>
<a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a>