<div dir="ltr">Hi Ben,<div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 17, 2018 at 4:11 PM, Ben Coman <span dir="ltr"><<a href="mailto:btc@openinworld.com" target="_blank">btc@openinworld.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr">Hi Clement,<div><br></div><div>Nice article...</div><div><a href="https://clementbera.wordpress.com/2018/06/07/free-chunk-management-in-the-cog-vm/" target="_blank">https://clementbera.wordpress.<wbr>com/2018/06/07/free-chunk-<wbr>management-in-the-cog-vm/</a><br></div><div><br></div><div>A random thought, I wonder if size-1 chunks can be managed packed into size-2 chunks.</div></div></blockquote><div><br></div><div>A key design feature of Spur is that every object has at least one field to function as a forwarding pointer.  Hence even zero-sized objects occupy 128 bits.  Each object has a 64-bit header (large objects have a 128-bit header).  The allocation unit is 64-bits.  All objects must have room for a forwarding pointer.  Hence the minimum sized chunk is 128-bits.</div><div><br></div><div>Hence there isn't room for two size 1 chunks inside a size-2 chunk, only inside a size three chunk.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Have a variable size1_active_double</span> initially nil.<br></div><div>First 

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">size-1</span> allocation, grab a size-2 chunk into 

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">size1_active_double</span>.</div><div>First half returned as the size-1-chunk. Second half marked at "empty".</div><div><br></div><div>Second size-1 allocation, return second half of <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">size1_active_double</span>

</div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">as size-1-chunk.  Set 

<span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">size1_active_double to nil.</span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Releasing a size-1-chunk. Dependent on whether memory alignment can inform of which half of size-2-chunk is being released. Check if other half is empty ==> add it to the size-2-chunk-list.</span></span></div><div><br></div><div>If other half not empty, add it to one of two singly-linked-lists depending on which half is empty, the empty half used for the linked-list.  Next size-1 allocations made from these lists first to fill in the empty half.</div><div><br></div><div>Considerations</div><div>* Added complexity</div><div>* Remaining size-1 singly-linked-list might have minimal impact - added complexity not worth the gain.</div><div><br></div><div>____________</div><div>Or another random thought *grin* - and this is probably completely off base because of my limited understanding.  </div><div>Piggyback the size-1-chunk management on top of the size-3-chunk-list.</div><div>Consider one end of the size-3-chunk-list to be "size1-filled-end" with references to free size-1-chunks, and the other end of the size-3-chunk-list to be "size1-empty-end".</div><div><br></div><div>To release a size-1-chunk, move a size-3-chunk from the "size1-empty-end" to the "size1-filled-end" and store the size-1-chunk reference there.</div><div><br></div><div>To allocate a size-1-chunk, get it from the "size1-filled" end of the size-3-chunk-list and move that size-3-chunk to the "size1-empty-end" of its list.</div><div><br></div><div>To compact a size-3-chunk that refers to a size-1-chunk, copy that into another chunk from the size1-empty-end moved to the size1-filled-end.</div><div><br></div><div><br></div><div>I wonder if that even makes sense. </div><div>Anyway, it hurts less to let the ideas roam free...</div><div><br></div><div>cheers -ben </div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"></span></span></div></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>