<br><br><div class="gmail_quote">On Thu, Jun 9, 2011 at 12:14 PM, Jecel Assumpcao Jr. <span dir="ltr">&lt;<a href="mailto:jecel@merlintec.com">jecel@merlintec.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Eliot Miranda wrote on Wed, 8 Jun 2011 10:01:17 -0700<br>
&gt; When Squeak was implemented it was decided to use flat objects in the VM,<br>
&gt; following the lead of David Ungar&#39;s Berkeley Smalltalk implementation, and of<br>
&gt; the subsequent Self implementations, all of which also use flat objects.<br>
<br>
Given the background you mention and that all Vector objects in Self<br>
(Array in Smalltalk-80) can have named slots as well as indexed ones,<br>
you would think that the use of flat objects would be popular. But they<br>
are actually very rare. Methods objects, for example, have a named<br>
variable called &quot;literals&quot; that holds a Vector and another variable<br>
named &quot;bytecodes&quot; that holds a ByteVector. The same is true for the<br>
various kinds of Collections.<br></blockquote><div><br></div><div>Are you sure that Self allows named and indexable slots?  What&#39;s an example in Self?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
&gt; Flat objects makes for faster allocation and faster inst var access (since<br>
&gt; accessing an inst var doesn&#39;t require the double indirection of following the<br>
&gt; pointer  to the header and then the pointer to the body).  But it makes become<br>
&gt; very much more expensive, since in the worst case the VM must scan the entire<br>
&gt; heap looking for references to the objects in the become operation and<br>
&gt; replacing them by references to their corresponding objects.<br>
<br>
In theory there is no become in Self. In practice, the various object<br>
building primitives (such as _AddSlots: or _RemoveSlots:) do their work<br>
in place and so have the same cost as become. They are normally invoked<br>
by the user from the GUI and not used programatically, so their<br>
performance isn&#39;t too critical (and scanning the entire heap is the most<br>
optimized operation of all, obtained by a special tag for header words<br>
and by allocating bytes and pointers from different ends of the heap).<br>
<br>
&gt; The solution David Ungar developed, which was adopted by Squeak, was to<br>
&gt; unflatten objects that used become to grow, such as OrderedCollection, Set<br>
&gt; and DIctionary, and use an array to hold their variable part.<br>
<br>
Do you mean at runtime or at design time (converting the image once)? If<br>
the latter, I had the impression that this was first proposed at<br>
Tektronix (after the versions described in the green book). But I don&#39;t<br>
trust my memory on this.<br></blockquote><div><br></div><div>Im sure it was incremental.  There is a full become: in BS but its slow and hence to speed the system up changes were made to certain core classes to reduce becomming.  IIRC these changes were available in a change set called <a href="http://unbecomming.st">unbecomming.st</a> :)</div>
<div><br></div><div>cheers</div><div>Eliot</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
-- Jecel<br>
<br>
</font></blockquote></div><br>