VM Maker: Cog-eem.335.mcz

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

VM Maker: Cog-eem.335.mcz

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

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

Name: Cog-eem.335
Author: eem
Time: 10 January 2017, 1:05:39.016065 pm
UUID: b001d418-6353-4851-8ea9-cb6184e13b54
Ancestors: Cog-nice.334

Extend Spur32BitPreen to allow resetting header values to their defaults, and to not raise an error if there is no changes file (for the Pharo bootstrap).

=============== Diff against Cog-nice.334 ===============

Item was changed:
  SimulatorHarness subclass: #Spur32BitPreen
+ instanceVariableNames: 'oldHeap newHeap map reverseMap oldInterpreter newInterpreter imageHeaderFlags savedWindowSize writeDefaultHeader'
- instanceVariableNames: 'oldHeap newHeap map reverseMap oldInterpreter newInterpreter imageHeaderFlags savedWindowSize'
  classVariableNames: ''
  poolDictionaries: 'VMObjectIndices'
  category: 'Cog-Bootstrapping'!
  !Spur32BitPreen commentStamp: 'eem 8/15/2016 19:49' prior: 0!
  A Spur32BitPreen is a simple image rewriter for 32-bit Spru images that eliminates free space and hence shrinks the preened image.  Use via
  Spur32BitPreen new preenImage: 'spur'
  which will produce spur-preen.image and spur-preen.changes from spur.image and spur.changes.
  Instance Variables
  imageHeaderFlags: <Integer>
  map: <Dictionary>
  newHeap: <Spur32BitMMLESimulator>
  newInterpreter: <StackInterpreterSimulatorLSB>
  oldHeap: <Spur32BitMMLESimulator>
  oldInterpreter: <StackInterpreterSimulatorLSB>
  reverseMap: <Dictionary>
  savedWindowSize: <Integer>
  - flags word in image header
  - map from oops in old image to oops in new image
  - the preened heap
  - the interpreter wrapping the preened heap
  - the heap to be preened
  - the interpreter wrapping the heap to be preened
  - map from oops in new image to oops in old image
  - screen size word in mage header

Item was changed:
  ----- Method: Spur32BitPreen>>on: (in category 'public access') -----
  on: imageName
  (oldInterpreter := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager))
  openOn: imageName extraMemory: 0.
  oldHeap := oldInterpreter objectMemory.
  imageHeaderFlags := oldInterpreter getImageHeaderFlags.
+ savedWindowSize ifNil: [savedWindowSize := oldInterpreter savedWindowSize].
- savedWindowSize := oldInterpreter savedWindowSize.
  newInterpreter := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager).
  newHeap := newInterpreter objectMemory.
  allocateMemoryOfSize: oldHeap oldSpaceSize
  newSpaceSize: 8 * 1024 * 1024
  stackSize: 16 * 1024
  codeSize: 0.
  newHeap bootstrapping: true.
  self initMaps!

Item was changed:
  ----- Method: Spur32BitPreen>>preenImageUsingFileDirectory: (in category 'public access') -----
  preenImageUsingFileDirectory: imageName
  | dirName baseName dir |
  dirName := FileDirectory dirPathFor: imageName.
  baseName := (imageName endsWith: '.image')
  ifTrue: [FileDirectory baseNameFor: imageName]
  ifFalse: [FileDirectory localNameFor: imageName].
  dir := dirName isEmpty ifTrue: [FileDirectory default] ifFalse: [FileDirectory default on: dirName].
  self on: (dir fullNameFor: baseName, '.image').
  [self preenImage]
  on: Halt
  do: [:ex|
  "suppress halts from the usual suspects (development time halts)"
  (#(fullGC compactImage) includes: ex signalerContext sender selector)
  ifTrue: [ex resume]
  ifFalse: [ex pass]].
  self writeSnapshot: (dir fullNameFor: baseName, '-preen.image')
  headerFlags: imageHeaderFlags
  screenSize: savedWindowSize.
+ (dir fileExists: baseName, '.changes')
+ ifTrue:
+ [dir deleteFileNamed: baseName, '-preen.changes';
+ copyFileNamed: baseName, '.changes' toFileNamed: baseName, '-preen.changes']
+ ifFalse:
+ [Transcript cr; show: 'could not find ', baseName, '.changes']!
- dir deleteFileNamed: baseName, '-preen.changes';
- copyFileNamed: baseName, '.changes' toFileNamed: baseName, '-preen.changes'!

Item was added:
+ ----- Method: Spur32BitPreen>>savedWindowSize: (in category 'public access') -----
+ savedWindowSize: aPointOrInteger
+ savedWindowSize := aPointOrInteger isInteger
+ ifTrue: [aPointOrInteger]
+ ifFalse: [(aPointOrInteger x min: 65535) << 16 + (aPointOrInteger y min: 65535)]!

Item was added:
+ ----- Method: Spur32BitPreen>>writeDefaultHeader: (in category 'public access') -----
+ writeDefaultHeader: aBoolean
+ writeDefaultHeader := aBoolean!

Item was changed:
  ----- Method: Spur32BitPreen>>writeSnapshot:headerFlags:screenSize: (in category 'snapshot') -----
  writeSnapshot: imageFileName headerFlags: headerFlags screenSize: screenSizeInteger
+ writeDefaultHeader == true ifTrue:
+ [newInterpreter
+ desiredEdenBytes: 0;
+ desiredNumStackPages: 0;
+ setDesiredCogCodeSize: 0;
+ setMaxExtSemSizeTo: 0].
  setImageHeaderFlagsFrom: headerFlags;
  setDisplayForm: nil;
  setSavedWindowSize: savedWindowSize;
  imageName: imageFileName;
  Transcript cr; show: 'Done!!'!