[Vm-dev] CogVM/StackVM fail to read in image, fine on Squeak 4.2.1 MacVM

David T. Lewis lewis at mail.msen.com
Mon Jul 18 12:34:21 UTC 2011


On Mon, Jul 18, 2011 at 02:02:10PM +0200, Stefan Marr wrote:
> 
> Hi:
> 
> I recently added support to load images that have been saved with the 
> CogVM in image format 6505 to the RoarVM.
> However, now I noticed that the CogVM/StackVM crash when they are asked 
> to load an image which is saved by our RoarVM.
> 
> Interestingly, the Squeak 4.2.1 and earlier are able to load this image.
> 
> To reproduce the problem, I put online an image [1] which is a stock 
> Squeak4.2-10966, just downloaded, opened and saved with the RoarVM.
> 
> The Cog/StackVM fail to open it with an error in "0   
> org.squeakfoundation.Squeak       0x00033462 
> readImageFromFileHeapSizeStartingAt + 3058"
> 
> Interestingly, if I open the image with Squeak 4.2.1, and save it and 
> then open it in Cog, Cog does not crash.
> So, there might be some inconsistencies in our image loading/saving 
> routines.
> 
> Could someone give it a try on a VM instrumented for debugging and 
> explain me what the problem is?
> There could be a bug in the RoarVM with filing out the image, but it is 
> strange that Squeak 4.2.1 handles it just fine.
> 
> Thanks
> Stefan
> 
> [1] http://soft.vub.ac.be/~smarr/roarvm/squeak-saved-with-rvm.zip

The difference between the 6505 format at 6504 format is the word
reversal for floats when running on little-endian. That is the only
difference in the image itself, but Cog/StackInterpreter also add
some additional information in the image file header. This means
that if you load a 6505 format image into RoarVM, and later save
it in that same format (as opposed to converting back to 6504),
then your image file header will be missing some information that
an actual Cog VM would expect to see.

For the standard VM, I adopted the convention of accepting a
6505 format image, converting the float word ordering back to
6504 format at load time, and always saving it as 6504. Since
Cog and StackVM know how to read a 6504 format, and the standard
VM knows how to read a 6505 format, everything works as expected
with this policy.

The ImageFormat package in SqueakSource/VMMaker is my attempt
to document these image formats as they evolve.

Dave



More information about the Vm-dev mailing list