<br><br><div class="gmail_quote">On Mon, Apr 13, 2009 at 2:08 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div class="im">On Sat, Apr 11, 2009 at 11:55 PM, John M McIntosh <span dir="ltr"><<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Ok, I'm confused about the comments in initialCleanup, since in testing with a Pharo image from feb it DOES call the flushExternalPrimitives, but the comments imply a 3.8 or later image shouldn't have the root bit set.<br>
<br>
Also then the flushExternalPrimitiveOf: seems to be invoked by the snapshotCleanUp.<br>
<br>
So is the comment in initialCleanup wrong?<br>
<br>
Could in the Closure VM could we skip flushExternalPrimitives for the new image type, since we *know* any closure image would have been processed by snapshotCleanUp, versus being a 3.2 image?<br></blockquote><div><br></div>
</div><div>Good point. So initialCleanup would then become</div><div><br></div><div><div>flushExternalPrimitives</div><div><span style="white-space:pre">        </span>self flushMethodCache.</div><div><span style="white-space:pre">        </span>self flushAtCache.</div>
<div><span style="white-space:pre">        </span>self flushExternalPrimitiveTable</div></div></div></blockquote><div><br></div><div>Oops; copy paste error. I meant of course </div><div><br></div><div>initialCleanup<br></div><div>
<span style="white-space: pre; ">        </span>self flushMethodCache.</div><div><span style="white-space: pre; ">        </span>self flushAtCache.</div><div><span style="white-space: pre; ">        </span>self flushExternalPrimitiveTable</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div><div></div></div><div><div></div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
initialCleanup<br>
"Images written by VMs earlier than 3.6/3.7 will wrongly have the root bit set on the active context. Besides clearing the root bit, we treat this as a marker that these images also lack a cleanup of external primitives (which has been introduced at the same time when the root bit problem was fixed). In this case, we merely flush them from here."<br>
<br>
((self longAt: activeContext) bitAnd: RootBit) = 0 ifTrue:[^nil]. "root bit is clean"<br>
"Clean root bit of activeContext"<br>
self longAt: activeContext put: ((self longAt: activeContext) bitAnd: AllButRootBit).<br>
"Clean external primitives"<br>
self flushExternalPrimitives.<br>
<br>
<br>
then<br>
<br>
<br>
flushExternalPrimitives<br>
"Flush the references to external functions from plugin<br>
primitives. This will force a reload of those primitives when<br>
accessed next.<br>
Note: We must flush the method cache here so that any<br>
failed primitives are looked up again."<br>
| oop primIdx |<br>
oop := self firstObject.<br>
[self oop: oop isLessThan: endOfMemory]<br>
whileTrue: [(self isFreeObject: oop)<br>
ifFalse: [(self isCompiledMethod: oop)<br>
ifTrue: ["This is a compiled method"<br>
primIdx := self primitiveIndexOf: oop.<br>
primIdx = PrimitiveExternalCallIndex<br>
ifTrue: ["It's primitiveExternalCall"<br>
self flushExternalPrimitiveOf: oop]]].<br>
oop := self objectAfter: oop].<br>
self flushMethodCache.<br>
self flushObsoleteIndexedPrimitives.<br>
self flushExternalPrimitiveTable<br>
<br>
<br>
snapshotCleanUp<br>
"Clean up right before saving an image, sweeping memory and:<br>
* nilling out all fields of contexts above the stack pointer.<br>
* flushing external primitives<br>
* clearing the root bit of any object in the root table "<br>
| oop header fmt sz |<br>
oop := self firstObject.<br>
[self oop: oop isLessThan: endOfMemory]<br>
whileTrue: [(self isFreeObject: oop)<br>
ifFalse: [header := self longAt: oop.<br>
fmt := header >> 8 bitAnd: 15.<br>
"Clean out context"<br>
(fmt = 3 and: [self isContextHeader: header])<br>
ifTrue: [sz := self sizeBitsOf: oop.<br>
(self lastPointerOf: oop) + BytesPerWord<br>
to: sz - BaseHeaderSize by: BytesPerWord<br>
do: [:i | self longAt: oop + i put: nilObj]].<br>
"Clean out external functions"<br>
fmt >= 12<br>
ifTrue: ["This is a compiled method"<br>
(self primitiveIndexOf: oop) = PrimitiveExternalCallIndex<br>
ifTrue: ["It's primitiveExternalCall"<br>
self flushExternalPrimitiveOf: oop]]].<br>
oop := self objectAfter: oop].<br>
self clearRootsTable<br><font color="#888888">
<br>
<br>
--<br>
===========================================================================<br>
John M. McIntosh <<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>><br>
Corporate Smalltalk Consulting Ltd. <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>
===========================================================================<br>
<br>
<br>
<br>
</font></blockquote></div></div></div><br>
</blockquote></div><br>