<div dir="ltr">Ok I think I understand now. Thank you for the explanation. The approach is different. I believe V8 has the same design than you have based on the talk I referenced.<div><br></div><div>There are pros and cons for both techniques.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-14 14:59 GMT+02:00 Stefan Marr <span dir="ltr">&lt;<a href="mailto:smalltalk@stefan-marr.de" target="_blank">smalltalk@stefan-marr.de</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Clément:<br>
<span class=""><br>
&gt; On 14 Aug 2015, at 10:53, Clément Bera &lt;<a href="mailto:bera.clement@gmail.com">bera.clement@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; In some implementations (e.g. Dart [22] and PyPy [3]), object header and attribute storage can be separated, so the attribute storage can be relocated in order to grow.<br>
&gt; [3]C. F. Bolz. Efficiently implementing objects with maps, 2010.<br>
&gt; [22]F. Schneider. Compiling dart to efficient machine code, 2012.<br>
<br>
</span>After a brief discussion with Carl Friedrich, this blog post is slightly outdated.<br>
Each object is allocated with 5 fields. I think the last one can be used, if needed, to refer to an extra extension/storage array.<br>
So, objects are not split in the sense you got in mind. But they can have two parts.<br>
This is pretty common the Truffle Object Model uses the same strategy, as do I in my SOM implementations.<br>
[For Smalltalks, the strategy is also nice, because it gives you fast, object-table like become, without any need for barriers.]<br>
<br>
Main drawback of the approach is that objects have a rather large size. But so far that was neither for PyPy nor Truffle a real issue.<br>
<br>
For details, see <a href="https://bitbucket.org/pypy/pypy/src/7089cedc919340a0c07f78cc952d5760146f7d86/pypy/objspace/std/mapdict.py?at=default#mapdict.py-537" rel="noreferrer" target="_blank">https://bitbucket.org/pypy/pypy/src/7089cedc919340a0c07f78cc952d5760146f7d86/pypy/objspace/std/mapdict.py?at=default#mapdict.py-537</a> (_make_subclass_size_n (only ever used for n==5))<br>
<br>
A little more tangible:<br>
<a href="https://github.com/smarr/RTruffleSOM/blob/master/src/som/vmobjects/object.py" rel="noreferrer" target="_blank">https://github.com/smarr/RTruffleSOM/blob/master/src/som/vmobjects/object.py</a><br>
<span class=""><br>
&gt; When I read F. Boltz. post, it looks like to me that in Pypy each instance of a class has a pointer to its map and its storage. The storage seems to be at a different location than the object&#39;s header and holds the instance variable values. To me it sounds very much like the object is &#39;split&#39; to be able to grow the storage if a new instance variable is added for a specific instance. Accessing an object instance variable requires an extra indirection through the storage pointer. Is there something I miss there ? It looks like the paper we wrote with Eliot could definitely apply there in order to speed up instance variable access by removing the indirection to the storage.<br>
<br>
</span>So, this is only true for fields that don’t fit into the slots that are directly following the ‘header’.<br>
<span class=""><br>
&gt; I am waiting for other people comments but to me it looks like the memory representation where the object’s header is separated from the the object&#39;s fields is used in Javascript V8 and Pypy, as explained in the 2 references, and that they could benefit from our implementation.<br>
<br>
</span>I don’t know about V8 for sure, but for PyPy (and Truffle, and SOM), I would not characterize it this way. The extension array is strictly optional for larger objects. From a conceptual point of view it is not designed as being split from the header. One could reduce the number of inlined fields to zero, and only keep the pointer to the storage array, but, this has a significant cost on my experience. (No, I don’t have numbers handy, but someone with an interest to easily do it by adjusting the min-max field number in PyPy).<br>
<div class="HOEnZb"><div class="h5"><br>
Best regards<br>
Stefan<br>
<br>
--<br>
Stefan Marr<br>
Johannes Kepler Universität Linz<br>
<a href="http://stefan-marr.de/research/" rel="noreferrer" target="_blank">http://stefan-marr.de/research/</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>