[Vm-dev] New Window VM (Closures, FT2Plugin, Large Cursors)

Eliot Miranda eliot.miranda at gmail.com
Sat Mar 7 19:31:02 UTC 2009

On Sat, Mar 7, 2009 at 11:23 AM, John M McIntosh <
johnmci at smalltalkconsulting.com> wrote:

> Ah, I have a bias opinion for an answer, but I'll not discuss that here.
> However the BIG issue for the 3.8.x and earlier series of macintosh carbon
> VM is their behaviour for opening a closure image.
> What you will find is that if you attempt to open a closure image the
> squeak.app will start then terminate
> It will print a diagnostic message to the console which you can see via
> Apple's Console.app found in Applications/Utilities.
> 07/03/09 11:11:51 AM [0x0-0x8d08d].org.squeak.Squeak[1894] This interpreter
> (vers. 6502) cannot read image file (vers. 6504).
> 07/03/09 11:11:51 AM [0x0-0x8d08d].org.squeak.Squeak[1894] Press CR to
> quit...
> The reason for this behaviour is that 15 some years back John Maloney coded
> up the version checking logic and  there was a question
> what to do now. At the time CodeWarrior under os-7.5.x would helpfully put
> up a dialog window if you printed to the *console* and did
> a getchar for the answer, that code has moved forward for years now and
> no-one really has tested until now.
> Interestingly the getchar on os-x does not block and returns null and we
> terminate the VM, but the behaviour is confusing if you don't
> understand what is going on.
> I will at some point push out a 3.8.22 VM that should put up a more helpful
> dialog message, but people who have older VMs underfoot
> should realize this behaviour should be an indication that perhaps your VM
> is too old.

yes, please.  I stumbled across the code this week and the last few
statements don't make sense on a number of platforms, because they presume a

checkImageVersionFrom: f startingAt: imageOffset
"Read and verify the image file version number and return true if the the
given image file needs to be byte-swapped. As a side effect, position the
file stream just after the version number of the image header. This code
prints a warning and does a hard-exit if it cannot find a valid version
"This code is based on C code by Ian Piumarta."

| version firstVersion |
<var: #f type: 'sqImageFile '>
<var: #imageOffset type: 'squeakFileOffsetType '>

"check the version number"
self sqImageFile: f Seek: imageOffset.
version := firstVersion := self getLongFromFile: f swap: false.
(self readableFormat: version) ifTrue: [^ false].

"try with bytes reversed"
self sqImageFile: f Seek: imageOffset.
version := self getLongFromFile: f swap: true.
(self readableFormat: version) ifTrue: [^ true].

"Note: The following is only meaningful if not reading an embedded image"
imageOffset = 0 ifTrue:[
"try skipping the first 512 bytes (prepended by certain Mac file transfer
self sqImageFile: f Seek: 512.
version := self getLongFromFile: f swap: false.
(self readableFormat: version) ifTrue: [^ false].

"try skipping the first 512 bytes with bytes reversed"
self sqImageFile: f Seek: 512.
version := self getLongFromFile: f swap: true.
(self readableFormat: version) ifTrue: [^ true]].

"hard failure; abort"
self print: 'This interpreter (vers. '.
self printNum: self imageFormatVersion.
self print: ') cannot read image file (vers. '.
self printNum: firstVersion.
self print: ').'.
self cr.
self print: 'Press CR to quit...'.
self getchar.
self ioExit.

 We should replace the last phrase with something like

    self ioReportImageFormat: firstVersion incompatibleWith: self
imageFormatVersion andThenExit: nil

and let the platform deal with this as it chooses.

> On 7-Mar-09, at 8:12 AM, Andreas Raab wrote:
>  Bert Freudenberg wrote:
>>> John bumped the Mac VM's major version to 4 to signify closure support.
>>> Maybe the other platforms should follow suit?
>> I figured v4 would signify the Stack VM or later as this VM will no longer
>> be able to run v3 images. The current set of VMs are fully backwards
>> compatible so I consider them logically to be v3 VMs.
>> But I'm willing to reconsider if people prefer the v4 terminology.
>> Cheers,
>>  - Andreas
> --
> ===========================================================================
> John M. McIntosh <johnmci at smalltalkconsulting.com>
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ===========================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20090307/43cca586/attachment.htm

More information about the Vm-dev mailing list