VM Maker: VMMaker.oscog-eem.2265.mcz

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

VM Maker: VMMaker.oscog-eem.2265.mcz

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-eem.2265
Author: eem
Time: 22 August 2017, 6:39:04.920256 pm
UUID: 76b62109-629a-4c39-9641-67b53321df9a
Ancestors: VMMaker.oscog-eem.2264

Oops!  Writing the function does nothing unless it is called.  So once again, if ioScreenSize answers a zero screen extent (as is the case for headless images) then on snapshot write the sawvedWindowSize rather thna the zero extent.  This should fix the experience people have with Pharo of saving headless images that then come up with a zero sized window when started headful.

=============== Diff against VMMaker.oscog-eem.2264 ===============

Item was changed:
  ----- Method: StackInterpreter>>writeImageFileIO (in category 'image save/restore') -----
  "Write the image header and heap contents to imageFile for snapshot. c.f. writeImageFileIOSimulation.
  The game below is to maintain 64-bit alignment for all putLong:toFile: occurrences."
  <inline: #never>
  | imageName headerStart headerSize f imageBytes bytesWritten sCWIfn okToWrite |
  <var: #f type: #sqImageFile>
  <var: #headerStart type: #squeakFileOffsetType>
  <var: #sCWIfn type: #'void *'>
  <var: #imageName declareC: 'extern char imageName[]'>
  self cCode: [] inSmalltalk: [imageName := 'sooth compiler'. ^self writeImageFileIOSimulation].
  "If the security plugin can be loaded, use it to check for write permission.
  If not, assume it's ok"
  sCWIfn := self ioLoadFunction: 'secCanWriteImage' From: 'SecurityPlugin'.
  sCWIfn ~= 0 ifTrue:
  [okToWrite := self cCode: '((sqInt (*)(void))sCWIfn)()'.
  okToWrite ifFalse:[^self primitiveFail]].
  "local constants"
  headerStart := 0.  
  headerSize := objectMemory wordSize = 4 ifTrue: [64] ifFalse: [128].  "header size in bytes; do not change!!"
  f := self sqImageFile: imageName Open: 'wb'.
  f = nil ifTrue: "could not open the image file for writing"
  [^self primitiveFail].
  imageBytes := objectMemory imageSizeToWrite.
  headerStart := self sqImage: f File: imageName StartLocation: headerSize + imageBytes.
  self cCode: '/* Note: on Unix systems one could put an exec command here, padded to 512 bytes */'.
  "position file to start of header"
  self sqImageFile: f Seek: headerStart.
  self putWord32: self imageFormatVersion toFile: f.
  self putWord32: headerSize toFile: f.
  self putLong: imageBytes toFile: f.
  self putLong: objectMemory baseAddressOfImage toFile: f.
  self putLong: objectMemory specialObjectsOop toFile: f.
  self putLong: objectMemory newObjectHash toFile: f.
+ self putLong: self getSnapshotScreenSize toFile: f.
- self putLong: self ioScreenSize toFile: f.
  self putLong: self getImageHeaderFlags toFile: f.
  self putWord32: extraVMMemory toFile: f.
  self putShort: desiredNumStackPages toFile: f.
  self putShort: self unknownShortOrCodeSizeInKs toFile: f.
  self putWord32: desiredEdenBytes toFile: f.
  self putShort: (maxExtSemTabSizeSet ifTrue: [self ioGetMaxExtSemTableSize] ifFalse: [0]) toFile: f.
  self putShort: the2ndUnknownShort toFile: f.
  objectMemory hasSpurMemoryManagerAPI
  [self putLong: objectMemory firstSegmentBytes toFile: f.
  self putLong: objectMemory bytesLeftInOldSpace toFile: f.
  2 timesRepeat: [self putLong: 0 toFile: f] "Pad the rest of the header."]
  [4 timesRepeat: [self putLong: 0 toFile: f]].  "Pad the rest of the header."
  objectMemory wordSize = 8 ifTrue:
  [3 timesRepeat: [self putLong: 0 toFile: f]]. "Pad the rest of the header."
  self assert: headerStart + headerSize = (self sqImageFilePosition: f).
  "position file after the header"
  self sqImageFile: f Seek: headerStart + headerSize.
  self successful ifFalse: "file write or seek failure"
  [self sqImageFileClose: f.
  "write the image data"
  objectMemory hasSpurMemoryManagerAPI
  [bytesWritten := objectMemory writeImageSegmentsToFile: f]
  [bytesWritten := self sq: (self pointerForOop: objectMemory baseAddressOfImage)
  Image: (self sizeof: #char)
  File: imageBytes
  Write: f].
  self success: bytesWritten = imageBytes.
  self sqImageFileClose: f!