[Vm-dev] [Cog] primitiveLoadImageSegment fails

Bert Freudenberg bert at freudenbergs.de
Wed Apr 17 16:58:42 UTC 2013


Hi Eliot,

thanks for looking into this.

On 15.04.2013, at 18:02, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> Hi Bert,
> 
>     the version-compatibility check is failing.  In NewObjectMemory>>loadImageSegmentFrom:outPointers: there's the check
>         (self readableFormat: (data bitAnd: 16rFFFF "low 2 bytes")) ifFalse:
> and this is failing.  The version info in the segment is 6502, which is pre-Cog, BlockContext.  Cog expects either 6504 (closures, but big-endian order floats) or 6505 (closures, platform-order floats).  So one might hope that just munging the project file so that the version is 6504 will work, alas no.
> 
> Adding e.g.
> 
> 	((segment at: 1) bitAnd: 16rFFFF) = 6502 ifTrue:
> 		[(UIManager default confirm: 'Image Segment is version 6502; expecting either 6504 or 6505.  OK to force it to 6504?') ifFalse:
> 			[^self error: 'bad version'].
> 		 segment at: 1 put: ((segment at: 1) bitAnd: 16rffff0000) + 6504].
> 	arrayOfRoots := self loadSegmentFrom: segment outPointers: outPointers.
> 
> to comeUpFullyOnReload: fails because some objects ned up having a null class

Really? How could that be? If it's just the BlockContexts and MethodContexts, the primitive could just replace them with nil.

> and this will just crash the image.  Alas, a) the image code doesn't return primitiveFailed if the load primitive does fail, and b) the failure code in the VM doesn't fail properly.  If invalid objects are created during an attempted load the failure code doesn't nuke them.

Could this be done on the image side, or will it crash before?

> So there's more work to do here, a) to figure out how to convert a project file so that it's compatible with cog images, and b) to make the image segment loading primitive more robust when it fails.

I really don't want to have to convert project files, but load them as they are.

- Bert -


> 
> On Thu, Apr 11, 2013 at 3:52 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 
> That's primitive 99. With an updated Squeak trunk image I can load this project fine in the interpreter:
> 
>         http://etoys.squeak.org/svn/trunk/Etoys/Home.007.pr
> 
> On Cog the primitive fails. Any idea what might be wrong?
> 
> - Bert -
> 
> 
> 
> 
> -- 
> best,
> Eliot



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20130417/6fa52feb/attachment.htm


More information about the Vm-dev mailing list