<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 14, 2014 at 8:03 AM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
Is it intentional that this package and the previous one are prefixed with dots?</blockquote><div><br></div><div>oops. definitely not.  i must have mistyped during the commit dialog.  fixed this.  David, can you delete the</div>
<div><br></div><div>.VMMaker.oscog-eem.615<br></div><div>..VMMaker.oscog-eem.616<br></div><div>..VMMaker.oscog-eem.617<br></div><div>..VMMaker.oscog-eem.618<br></div><div> </div><div>packages?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><font color="#888888"><br>
<br>
<br>
Levente</font></span><div class=""><div class="h5"><br>
<br>
On Thu, 13 Feb 2014, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:<br>
<a href="http://source.squeak.org/VMMaker/..VMMaker.oscog-eem.618.mcz" target="_blank">http://source.squeak.org/<u></u>VMMaker/..VMMaker.oscog-eem.<u></u>618.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: ..VMMaker.oscog-eem.618<br>
Author: eem<br>
Time: 13 February 2014, 11:51:10.104 am<br>
UUID: 3756532a-fdbf-4e96-8cc9-<u></u>be0f35157864<br>
Ancestors: ..VMMaker.oscog-eem.617<br>
<br>
Some musings on Spur compaction.<br>
<br>
=============== Diff against ..VMMaker.oscog-eem.617 ===============<br>
<br>
Item was added:<br>
+ ----- Method: SpurMemoryManager&gt;&gt;<u></u>abstractCompaction (in category &#39;compaction - analysis&#39;) -----<br>
+ abstractCompaction<br>
+       &quot;This method answers a rough estimate of compactibility.&quot;<br>
+       &lt;doNotGenerate&gt;<br>
+       | lowestFree freeChunks used movable |<br>
+       lowestFree := SmallInteger maxVal.<br>
+       freeChunks := Set new.<br>
+       used := Set new.<br>
+       movable := Set new.<br>
+       self allObjectsInFreeTreeDo:<br>
+               [:f|<br>
+               (self addressAfter: f) &lt; endOfMemory ifTrue:<br>
+                       [freeChunks add: f.<br>
+                        f &lt; lowestFree ifTrue: [lowestFree := f]]].<br>
+       self allOldSpaceObjectsFrom: lowestFree do:<br>
+               [:o| | size delta best |<br>
+               size := self bytesInObject: o.<br>
+               delta := SmallInteger maxVal.<br>
+               freeChunks do: [:f| | fs |<br>
+                       ((fs := self bytesInObject: f) &gt;= size) ifTrue:<br>
+                               [delta &gt; (fs - size) ifTrue:<br>
+                                       [delta := fs - size. best := f]]].<br>
+                best ifNotNil:<br>
+                       [movable add: o.<br>
+                        used add: (freeChunks remove: best)]].<br>
+       ^{ totalFreeOldSpace. movable inject: 0 into: [:s :o| s + (self bytesInObject: o)]. used inject: 0 into: [:s :o| s + (self bytesInObject: o)] }!<br>
<br>
Item was added:<br>
+ ----- Method: SpurMemoryManager&gt;&gt;<u></u>abstractPigCompaction (in category &#39;compaction - analysis&#39;) -----<br>
+ abstractPigCompaction<br>
+       &quot;This method answers a rough estimate of compactibility using a pig (a large free chunk).&quot;<br>
+       &lt;doNotGenerate&gt;<br>
+       | pig pork moved unmoved nmoved nunmoved |<br>
+       pig := self findAPig.<br>
+       pork := self bytesInObject: pig.<br>
+       moved := unmoved := nmoved := nunmoved := 0.<br>
+       self allOldSpaceObjectsFrom: pig do:<br>
+               [:o| | bytes |<br>
+               bytes := self bytesInObject: o.<br>
+               bytes &lt;= pork<br>
+                       ifTrue:<br>
+                               [moved := moved + bytes.<br>
+                                nmoved := nmoved + 1.<br>
+                                pork := pork - bytes]<br>
+                       ifFalse:<br>
+                               [unmoved := unmoved + bytes.<br>
+                                nunmoved := nunmoved + 1]].<br>
+       ^{ self bytesInObject: pig. pork. moved. nmoved. unmoved. nunmoved }!<br>
<br>
Item was added:<br>
+ ----- Method: SpurMemoryManager&gt;&gt;biggies (in category &#39;compaction - analysis&#39;) -----<br>
+ biggies<br>
+       &quot;This method answers a sorted collection of the objects &gt;= 1,000,000 bytes long,<br>
+        above the lowest large free chunk, sandwiched between nilObj and the end of memory.&quot;<br>
+       &lt;doNotGenerate&gt;<br>
+       | lowestFree biggies |<br>
+       lowestFree := SmallInteger maxVal.<br>
+       self allObjectsInFreeTreeDo:<br>
+               [:f| (self addressAfter: f) &lt; endOfMemory ifTrue: [f &lt; lowestFree ifTrue: [lowestFree := f]]].<br>
+       biggies := SortedCollection new.<br>
+       self allOldSpaceObjectsFrom: lowestFree do:<br>
+               [:f|<br>
+               (self bytesInObject: f) &gt;= 1000000 ifTrue:<br>
+                       [biggies add: f]].<br>
+       ^{{nilObj hex. #nil}}, (biggies collect: [:f| {f hex. self bytesInObject: f}]), {{endOfMemory hex. #endOfMemory}}!<br>
<br>
Item was added:<br>
+ ----- Method: SpurMemoryManager&gt;&gt;<u></u>compactionIssues (in category &#39;compaction - analysis&#39;) -----<br>
+ compactionIssues<br>
+       &lt;doNotGenerate&gt;<br>
+       &quot;Compaction isn&#39;t working well.  It rarely moves more than a few tens of kilobytes.  Why?<br>
+        Load an image and before you run it, or just before a GC, run these anaylsis routines.<br>
+        e.g.<br>
+               self abstractCompaction #(63230272 75456 63210648)<br>
+        shows we can move 75456 bytes of objects, but that would use 63210648 of free space.<br>
+        i.e. there are lots of big free chunks in play, not many small ones that fit the bill.<br>
+<br>
+               self largeFreeChunkDistribution<br>
+                       #(      #(&#39;16r31C788&#39; #nil)<br>
+                               #(&#39;16r1423AC0&#39; 2061864)<br>
+                               #(&#39;16r1B705E8&#39; 1515200)<br>
+                               #(&#39;16r1D31D20&#39; 2011152)<br>
+                               #(&#39;16r1F37818&#39; 1491480)<br>
+                               #(&#39;16r2225968&#39; 1450512)<br>
+                               #(&#39;16r24C92C8&#39; 48575672)  (16r24C92C8 + 48575672) hex &#39;16r531C780&#39; a free chunk<br>
+                               #(&#39;16r531C788&#39; #endOfMemory))<br>
+        shows there&#39;s plenty of large free chunks.  And the trailing 16-byte free chunk shows coallescing is not working properly.<br>
+<br>
+               self biggies #(#(&#39;16r31C788&#39; #nil) #(&#39;16r531C788&#39; #endOfMemory))<br>
+        shows there are no large objects to be moved.<br>
+<br>
+        So... looks like compaction should hold onto the lowest large chunk and preferentially move objects into that.<br>
+        Let&#39;s call it a pig.  Compaction needs to whittle away at the pig.<br>
+<br>
+        e.g.<br>
+               self abstractPigCompaction #(2061864 0 2061864 18759 2018224 34757)<br>
+        shows we can move 18759 objects that will occupy 2018224 bytes into that<br>
+        low pig of 2061864 bytes.&quot;!<br>
<br>
Item was added:<br>
+ ----- Method: SpurMemoryManager&gt;&gt;findAPig (in category &#39;compaction - analysis&#39;) -----<br>
+ findAPig<br>
+       &quot;Answer a large low free chuink.&quot;<br>
+       &lt;doNotGenerate&gt;<br>
+       | pig |<br>
+       self allObjectsInFreeTreeDo:<br>
+               [:f|<br>
+               (self bytesInObject: f) &gt;= 1000000 ifTrue:<br>
+                       [(pig isNil or: [pig &gt; f]) ifTrue:<br>
+                               [pig := f]]].<br>
+       ^pig!<br>
<br>
Item was added:<br>
+ ----- Method: SpurMemoryManager&gt;&gt;<u></u>largeFreeChunkDistribution (in category &#39;compaction - analysis&#39;) -----<br>
+ largeFreeChunkDistribution<br>
+       &quot;This method answers a sorted collection of the free chunks &gt;= 1,000,000 bytes long,<br>
+        sandwiched between nilObj and the end of memory (ignoring the large chunk often found at the end of the heap).&quot;<br>
+       &lt;doNotGenerate&gt;<br>
+       | freeChunks |<br>
+       freeChunks := SortedCollection new.<br>
+       self allObjectsInFreeTreeDo:<br>
+               [:f|<br>
+               ((self addressAfter: f) &lt; endOfMemory<br>
+                and: [(self bytesInObject: f) &gt;= 1000000]) ifTrue:<br>
+                       [freeChunks add: f]].<br>
+       ^{{nilObj hex. #nil}}, (freeChunks collect: [:f| {f hex. self bytesInObject: f}]), {{endOfMemory hex. #endOfMemory}}!<br>
<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>