VM Maker: VMMaker-dtl.400.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker-dtl.400.mcz

commits-2
 
David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.400.mcz

==================== Summary ====================

Name: VMMaker-dtl.400
Author: dtl
Time: 3 May 2019, 6:11:26.389 pm
UUID: 0059fd36-12f0-441c-b743-56b947d9cae9
Ancestors: VMMaker-dtl.398

VMMaker 4.16.6 - Better error message when interpreter encounters an unsupported image format.

Instead of this:
This interpreter (vers. 0) cannot read image file (vers. 68021).
Press CR to quit...

Say this:
This interpreter supports image formats up to 6505, cannot read file format 68021

=============== Diff against VMMaker-dtl.398 ===============

Item was changed:
  ----- Method: ContextInterpreter>>checkImageVersionFrom:startingAt: (in category 'image save/restore') -----
  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 number."
  "This code is based on C code by Ian Piumarta."
 
  | firstVersion |
  <var: #f type: 'sqImageFile '>
  <var: #imageOffset type: 'squeakFileOffsetType '>
 
  "check the version number"
  self sqImageFile: f Seek: imageOffset.
  imageFormatInitialVersion := firstVersion := self getLongFromFile: f swap: false.
  (self readableFormat: imageFormatInitialVersion) ifTrue: [^ false].
 
  "try with bytes reversed"
  self sqImageFile: f Seek: imageOffset.
  imageFormatInitialVersion := self getLongFromFile: f swap: true.
  (self readableFormat: imageFormatInitialVersion) 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 utilities)"
  self sqImageFile: f Seek: 512.
  imageFormatInitialVersion := self getLongFromFile: f swap: false.
  (self readableFormat: imageFormatInitialVersion) ifTrue: [^ false].
 
  "try skipping the first 512 bytes with bytes reversed"
  self sqImageFile: f Seek: 512.
  imageFormatInitialVersion := self getLongFromFile: f swap: true.
  (self readableFormat: imageFormatInitialVersion) ifTrue: [^ true]].
 
  "hard failure; abort"
+ self printVersionWarning: firstVersion.
- 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.
  !

Item was removed:
- ----- Method: ContextInterpreter>>imageFormatBackwardCompatibilityVersion (in category 'image save/restore') -----
- imageFormatBackwardCompatibilityVersion
- "This VM is backwards-compatible with the immediately preceeding pre-closure version, and will allow loading images (or image segments) of that version."
-
- objectMemory bytesPerWord == 4
- ifTrue: [^6502]
- ifFalse: [^68000]!

Item was added:
+ ----- Method: Interpreter>>imageFormatSupportableVersion (in category 'image save/restore') -----
+ imageFormatSupportableVersion
+ "Answer the most recent image format version that can be supported by this
+ interpreter.. The image may be saved as a different format. For example, format
+ 6505 has different float byte ordering and can be loaded by the interpreter
+ for 32 bit images, but that same image will be stored in the 6504 format. Thus
+ a 6505 format image may be loaded and run, then saved in format 6504."
+
+ objectMemory bytesPerWord == 4
+ ifTrue: [^6505]
+ ifFalse: [^68003]!

Item was added:
+ ----- Method: Interpreter>>printVersionWarning: (in category 'image save/restore') -----
+ printVersionWarning: formatNumber
+ self print: 'This interpreter supports image formats up to '.
+ self printNum: self imageFormatSupportableVersion.
+ self print: ', cannot read file format '.
+ self printNum: formatNumber.
+ self cr.
+ self ioExit.
+ !

Item was changed:
  ----- Method: StackInterpreter>>checkImageVersionFrom:startingAt: (in category 'image save/restore') -----
  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 number."
  "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 utilities)"
  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 printVersionWarning: firstVersion.
- 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 ioExitWithErrorCode: 1.
  ^false!

Item was changed:
  ----- Method: VMMaker class>>versionString (in category 'version testing') -----
  versionString
 
  "VMMaker versionString"
 
+ ^'4.16.6'!
- ^'4.16.5'!

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-dtl.400.mcz

Ben Coman
 
On Sat, 4 May 2019 at 06:11, <[hidden email]> wrote:
> Instead of this:
> This interpreter (vers. 0) cannot read image file (vers. 68021).
> Press CR to quit...

It seems useful to also say "a 32-bit VM is trying to read a 64-bit image"?

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-dtl.400.mcz

David T. Lewis
 
On Sun, May 05, 2019 at 01:45:13AM +0800, Ben Coman wrote:
>  
> On Sat, 4 May 2019 at 06:11, <[hidden email]> wrote:
> > Instead of this:
> > This interpreter (vers. 0) cannot read image file (vers. 68021).
> > Press CR to quit...
>
> It seems useful to also say "a 32-bit VM is trying to read a 64-bit image"?
>

It's not a 32-bit VM. The most common case is a 64-bit VM running a 32-bit image.

For reference: http://squeakvm.org/squeak64/faq.html

Dave
 
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-dtl.400.mcz

fniephaus
 


On Sat, May 4, 2019 at 11:01 PM David T. Lewis <[hidden email]> wrote:
 
On Sun, May 05, 2019 at 01:45:13AM +0800, Ben Coman wrote:

> On Sat, 4 May 2019 at 06:11, <[hidden email]> wrote:
> > Instead of this:
> > This interpreter (vers. 0) cannot read image file (vers. 68021).
> > Press CR to quit...
>
> It seems useful to also say "a 32-bit VM is trying to read a 64-bit image"?
>

It's not a 32-bit VM. The most common case is a 64-bit VM running a 32-bit image.

You are correct, but I think Ben's point was to support novice users in understanding what's going on (without having to know what, for example, 68021 means).

Why not something like: "This VM only supports 64-bit Sista images, but a 32-bit v3 image was provided." That would help users to select the right VM for their image at [1].

Fabio


 

For reference: http://squeakvm.org/squeak64/faq.html

Dave

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-dtl.400.mcz

Ben Coman
 
On Sun, 5 May 2019 at 05:53, Fabio Niephaus <[hidden email]> wrote:

>
>
>
>
> On Sat, May 4, 2019 at 11:01 PM David T. Lewis <[hidden email]> wrote:
>>
>>
>> On Sun, May 05, 2019 at 01:45:13AM +0800, Ben Coman wrote:
>> >
>> > On Sat, 4 May 2019 at 06:11, <[hidden email]> wrote:
>> > > Instead of this:
>> > > This interpreter (vers. 0) cannot read image file (vers. 68021).
>> > > Press CR to quit...
>> >
>> > It seems useful to also say "a 32-bit VM is trying to read a 64-bit image"?
>> >
>>
>> It's not a 32-bit VM. The most common case is a 64-bit VM running a 32-bit image.

Supports my proposal.  Even though I know a bit about the topic I got it wrong.
Novices will struggle, and maybe stop trying.

cheers -ben


>
>
> You are correct, but I think Ben's point was to support novice users in understanding what's going on (without having to know what, for example, 68021 means).
>
> Why not something like: "This VM only supports 64-bit Sista images, but a 32-bit v3 image was provided." That would help users to select the right VM for their image at [1].
>
> Fabio
>
> [1] https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/201901172323
>
>
>>
>>
>> For reference: http://squeakvm.org/squeak64/faq.html
>>
>> Dave
>>
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-dtl.400.mcz

David T. Lewis
 
On Sun, May 05, 2019 at 08:50:24AM +0800, Ben Coman wrote:

>  
> On Sun, 5 May 2019 at 05:53, Fabio Niephaus <[hidden email]> wrote:
> >
> > On Sat, May 4, 2019 at 11:01 PM David T. Lewis <[hidden email]> wrote:
> >>
> >> On Sun, May 05, 2019 at 01:45:13AM +0800, Ben Coman wrote:
> >> >
> >> > On Sat, 4 May 2019 at 06:11, <[hidden email]> wrote:
> >> > > Instead of this:
> >> > > This interpreter (vers. 0) cannot read image file (vers. 68021).
> >> > > Press CR to quit...
> >> >
> >> > It seems useful to also say "a 32-bit VM is trying to read a 64-bit image"?
> >> >
> >>
> >> It's not a 32-bit VM. The most common case is a 64-bit VM running a 32-bit image.
> >>
> >> For reference: http://squeakvm.org/squeak64/faq.html
> >>
>
> Supports my proposal.  Even though I know a bit about the topic I got it wrong.
> Novices will struggle, and maybe stop trying.


This is /not/ a case of "a 32-bit VM is trying to read a 64-bit image".


>
> cheers -ben
>
> >
> > You are correct, but I think Ben's point was to support novice users in
> > understanding what's going on (without having to know what, for example,
> > 68021 means).
> >
> > Why not something like: "This VM only supports 64-bit Sista images, but a 32-bit v3 image was provided." That would help users to select the right VM for their image at [1].
> >
> > Fabio
> >
> > [1] https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/201901172323
> >

The updated message is for the classic interpreter VM.

Dave