<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style='font-size:10pt;font-family:Verdana,Arial,Helvetica,sans-serif;'>The notes at Eliot's blog here: http://www.squeakvm.org/svn/squeak/branches/Cog/image/Workspace.text<br>imply the difference is important when building a Cog Development Image.<br><br><pre>i.e.<br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>N.B. do *not* load VMMaker or VMMaker-oscog. N.B. VMMaker.oscog packages may be listed with VMMaker packages depending on Monticello version.</div></blockquote> <br>I don't know the implied difference.<br><br><br>cheers<br><br>tty<br></pre><br><div id="1"><br>---- On Fri, 14 Feb 2014 08:03:00 -0800 <b>Levente Uzonyi&lt;leves@elte.hu&gt;</b> wrote ---- <br></div><br><blockquote style="border-left: 1px solid #0000FF; padding-left: 6px; margin:0 0 0 5px">  <br>Is it intentional that this package and the previous one are prefixed with  <br>dots? <br> <br> <br>Levente <br> <br>On Thu, 13 Feb 2014, <a subj="" mailid="commits%40source.squeak.org" href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote: <br> <br>&gt; <br>&gt; Eliot Miranda uploaded a new version of VMMaker to project VM Maker: <br>&gt; <a href="http://source.squeak.org/VMMaker/..VMMaker.oscog-eem.618.mcz" target="_blank">http://source.squeak.org/VMMaker/..VMMaker.oscog-eem.618.mcz</a> <br>&gt; <br>&gt; ==================== Summary ==================== <br>&gt; <br>&gt; Name: ..VMMaker.oscog-eem.618 <br>&gt; Author: eem <br>&gt; Time: 13 February 2014, 11:51:10.104 am <br>&gt; UUID: 3756532a-fdbf-4e96-8cc9-be0f35157864 <br>&gt; Ancestors: ..VMMaker.oscog-eem.617 <br>&gt; <br>&gt; Some musings on Spur compaction. <br>&gt; <br>&gt; =============== Diff against ..VMMaker.oscog-eem.617 =============== <br>&gt; <br>&gt; Item was added: <br>&gt; + ----- Method: SpurMemoryManager&gt;&gt;abstractCompaction (in category 'compaction - analysis') ----- <br>&gt; + abstractCompaction <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;"This method answers a rough estimate of compactibility." <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&lt;doNotGenerate&gt; <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;| lowestFree freeChunks used movable | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;lowestFree := SmallInteger maxVal. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;freeChunks := Set new. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;used := Set new. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;movable := Set new. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allObjectsInFreeTreeDo: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:f| <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(self addressAfter: f) &lt; endOfMemory ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[freeChunks add: f. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f &lt; lowestFree ifTrue: [lowestFree := f]]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allOldSpaceObjectsFrom: lowestFree do: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:o| | size delta best | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size := self bytesInObject: o. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delta := SmallInteger maxVal. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;freeChunks do: [:f| | fs | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((fs := self bytesInObject: f) &gt;= size) ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[delta &gt; (fs - size) ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[delta := fs - size. best := f]]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; best ifNotNil: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[movable add: o. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; used add: (freeChunks remove: best)]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;^{ totalFreeOldSpace. movable inject: 0 into: [:s :o| s + (self bytesInObject: o)]. used inject: 0 into: [:s :o| s + (self bytesInObject: o)] }! <br>&gt; <br>&gt; Item was added: <br>&gt; + ----- Method: SpurMemoryManager&gt;&gt;abstractPigCompaction (in category 'compaction - analysis') ----- <br>&gt; + abstractPigCompaction <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;"This method answers a rough estimate of compactibility using a pig (a large free chunk)." <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&lt;doNotGenerate&gt; <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;| pig pork moved unmoved nmoved nunmoved | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;pig := self findAPig. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;pork := self bytesInObject: pig. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;moved := unmoved := nmoved := nunmoved := 0. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allOldSpaceObjectsFrom: pig do: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:o| | bytes | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bytes := self bytesInObject: o. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bytes &lt;= pork <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[moved := moved + bytes. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nmoved := nmoved + 1. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pork := pork - bytes] <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ifFalse: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[unmoved := unmoved + bytes. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nunmoved := nunmoved + 1]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;^{ self bytesInObject: pig. pork. moved. nmoved. unmoved. nunmoved }! <br>&gt; <br>&gt; Item was added: <br>&gt; + ----- Method: SpurMemoryManager&gt;&gt;biggies (in category 'compaction - analysis') ----- <br>&gt; + biggies <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;"This method answers a sorted collection of the objects &gt;= 1,000,000 bytes long, <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; above the lowest large free chunk, sandwiched between nilObj and the end of memory." <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&lt;doNotGenerate&gt; <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;| lowestFree biggies | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;lowestFree := SmallInteger maxVal. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allObjectsInFreeTreeDo: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:f| (self addressAfter: f) &lt; endOfMemory ifTrue: [f &lt; lowestFree ifTrue: [lowestFree := f]]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;biggies := SortedCollection new. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allOldSpaceObjectsFrom: lowestFree do: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:f| <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(self bytesInObject: f) &gt;= 1000000 ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[biggies add: f]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;^{{nilObj hex. #nil}}, (biggies collect: [:f| {f hex. self bytesInObject: f}]), {{endOfMemory hex. #endOfMemory}}! <br>&gt; <br>&gt; Item was added: <br>&gt; + ----- Method: SpurMemoryManager&gt;&gt;compactionIssues (in category 'compaction - analysis') ----- <br>&gt; + compactionIssues <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&lt;doNotGenerate&gt; <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;"Compaction isn't working well.  It rarely moves more than a few tens of kilobytes.  Why? <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; Load an image and before you run it, or just before a GC, run these anaylsis routines. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; e.g. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self abstractCompaction #(63230272 75456 63210648) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; shows we can move 75456 bytes of objects, but that would use 63210648 of free space. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; i.e. there are lots of big free chunks in play, not many small ones that fit the bill. <br>&gt; + <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self largeFreeChunkDistribution <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#(&nbsp;&nbsp;&nbsp;&nbsp;#('16r31C788' #nil) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r1423AC0' 2061864) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r1B705E8' 1515200) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r1D31D20' 2011152) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r1F37818' 1491480) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r2225968' 1450512) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r24C92C8' 48575672)  (16r24C92C8 + 48575672) hex '16r531C780' a free chunk <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#('16r531C788' #endOfMemory)) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; shows there's plenty of large free chunks.  And the trailing 16-byte free chunk shows coallescing is not working properly. <br>&gt; + <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self biggies #(#('16r31C788' #nil) #('16r531C788' #endOfMemory)) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; shows there are no large objects to be moved. <br>&gt; + <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; So... looks like compaction should hold onto the lowest large chunk and preferentially move objects into that. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; Let's call it a pig.  Compaction needs to whittle away at the pig. <br>&gt; + <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; e.g. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self abstractPigCompaction #(2061864 0 2061864 18759 2018224 34757) <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; shows we can move 18759 objects that will occupy 2018224 bytes into that <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; low pig of 2061864 bytes."! <br>&gt; <br>&gt; Item was added: <br>&gt; + ----- Method: SpurMemoryManager&gt;&gt;findAPig (in category 'compaction - analysis') ----- <br>&gt; + findAPig <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;"Answer a large low free chuink." <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&lt;doNotGenerate&gt; <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;| pig | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allObjectsInFreeTreeDo: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:f| <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(self bytesInObject: f) &gt;= 1000000 ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[(pig isNil or: [pig &gt; f]) ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[pig := f]]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;^pig! <br>&gt; <br>&gt; Item was added: <br>&gt; + ----- Method: SpurMemoryManager&gt;&gt;largeFreeChunkDistribution (in category 'compaction - analysis') ----- <br>&gt; + largeFreeChunkDistribution <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;"This method answers a sorted collection of the free chunks &gt;= 1,000,000 bytes long, <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp; sandwiched between nilObj and the end of memory (ignoring the large chunk often found at the end of the heap)." <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&lt;doNotGenerate&gt; <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;| freeChunks | <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;freeChunks := SortedCollection new. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;self allObjectsInFreeTreeDo: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[:f| <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((self addressAfter: f) &lt; endOfMemory <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and: [(self bytesInObject: f) &gt;= 1000000]) ifTrue: <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[freeChunks add: f]]. <br>&gt; + &nbsp;&nbsp;&nbsp;&nbsp;^{{nilObj hex. #nil}}, (freeChunks collect: [:f| {f hex. self bytesInObject: f}]), {{endOfMemory hex. #endOfMemory}}! <br>&gt; <br>&gt; <br></blockquote><br></div></body></html>