<br><br><div class="gmail_quote">On Thu, Jun 9, 2011 at 12:14 PM, Jecel Assumpcao Jr. <span dir="ltr"><<a href="mailto:jecel@merlintec.com">jecel@merlintec.com</a>></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>
> When Squeak was implemented it was decided to use flat objects in the VM,<br>
> following the lead of David Ungar's Berkeley Smalltalk implementation, and of<br>
> 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 "literals" that holds a Vector and another variable<br>
named "bytecodes" 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'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>
> Flat objects makes for faster allocation and faster inst var access (since<br>
> accessing an inst var doesn't require the double indirection of following the<br>
> pointer to the header and then the pointer to the body). But it makes become<br>
> very much more expensive, since in the worst case the VM must scan the entire<br>
> heap looking for references to the objects in the become operation and<br>
> 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'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>
> The solution David Ungar developed, which was adopted by Squeak, was to<br>
> unflatten objects that used become to grow, such as OrderedCollection, Set<br>
> 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'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>