[Vm-dev] VM Maker: Cog-eem.125.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 5 23:04:47 UTC 2013


Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.125.mcz

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

Name: Cog-eem.125
Author: eem
Time: 5 December 2013, 3:04:34.318 pm
UUID: 2621550b-a28f-498a-9731-2d7b34191391
Ancestors: Cog-eem.124

Fix the Spur bootstrap given it is broken on an updated trunk image.
Any oop must be recomputed after GC.  Snapshot must deal with
the possibility that no large free chunks remain.  The activeProcess
must have its suspendedContext updated after each execution.

=============== Diff against Cog-eem.124 ===============

Item was changed:
  ----- Method: SpurBootstrap>>bootstrapImage (in category 'bootstrap image') -----
  bootstrapImage
  	oldHeap fullGC.
  	oldHeapSize := oldHeap freeStart.
+ 	self initMaps.
+ 	self findRequiredGlobals.
  	Transcript cr; nextPutAll: 'transforming image...'; flush.
  	self cloneNilTrueAndFalse.
  	self allocateFreeLists.
  	self buildClassMap.
  	self allocateClassTable.
  	self cloneObjects.
  	self fillInObjects.
  	self fillInClassTable.
  	newHeapSize := newHeap freeStart.
  	newHeap initializePostBootstrap!

Item was added:
+ ----- Method: SpurBootstrap>>initMaps (in category 'initialize-release') -----
+ initMaps
+ 	map := Dictionary new: oldHeap memory size // 4.
+ 	reverseMap := Dictionary new: oldHeap memory size // 4.
+ 	classToIndex := Dictionary new: 1024.
+ 	literalMap := IdentityDictionary new.
+ 	methodClasses := Set new.
+ 	installedPrototypes := Set new.
+ 	sizeSym := rehashSym := classMetaclass := nil!

Item was changed:
  ----- Method: SpurBootstrap>>on: (in category 'initialize-release') -----
  on: imageName
  	StackInterpreter initializeWithOptions: Dictionary new.
  	oldInterpreter := StackInterpreterSimulator new.
  	oldInterpreter openOn: imageName extraMemory: 0.
  	oldHeap := oldInterpreter objectMemory.
  	newHeap := Spur32BitMMLESimulator new.
  	newHeap
  		allocateMemoryOfSize: (oldHeap youngStart * 3 / 2 roundUpTo: 1024 * 1024)
  		newSpaceSize: 1024 * 1024
  		stackSize: 1024 * 1024
  		codeSize: 0.
  	newHeap setCheckForLeaks: 15 - 6. "don't check become; or newSpace; soooo many rehashes in bootstrap"
+ 	self initMaps!
- 	map := Dictionary new: oldHeap memory size // 4.
- 	reverseMap := Dictionary new: oldHeap memory size // 4.
- 	classToIndex := Dictionary new: 1024.
- 	literalMap := IdentityDictionary new.
- 	methodClasses := Set new.
- 	installedPrototypes := Set new!

Item was changed:
  ----- Method: SpurBootstrap>>transform (in category 'bootstrap image') -----
  transform
  	| change |
  	self rememberRehashSymbol.
  	self findRequiredGlobals.
  	self installModifiedMethods.
  	self bootstrapImage.
  	self validate.
+ 	self rememberRehashSymbol.
  	self rehashImage.
  	self followForwardingPointers.
  	self scavengeImage.
  	self freeForwarders.
  	self compactImage.
  	change := newHeapSize - oldHeapSize / oldHeapSize.
  	Transcript
  		nextPutAll: 'done.'; cr;
  		nextPutAll: 'old heap size: '; print: oldHeapSize; cr;
  		nextPutAll: 'initial new heap size: '; print: newHeapSize; cr;
  		nextPutAll: 'change: '; print: (change * 100.0 roundTo: 0.01); nextPut: $%; cr;
  		flush.
  	newHeapSize := newHeap endOfMemory
  					- newHeap scavenger eden limit
  					- newHeap totalFreeListBytes.
  	change := newHeapSize - oldHeapSize / oldHeapSize.
  	Transcript
  		nextPutAll: 'final new heap size: '; print: newHeapSize; cr;
  		nextPutAll: 'change: '; print: (change * 100.0 roundTo: 0.01); nextPut: $%; cr;
  		flush.!

Item was changed:
  ----- Method: SpurBootstrap>>withExecutableInterpreter:do: (in category 'bootstrap methods') -----
  withExecutableInterpreter: sim do: aBlock
  	"With the oldInterpreter ready to execute code, evaluate aBlock,
  	 then return the interpreter (and the heap) to the ``just snapshotted'' state."
  	| savedpc initialContext finalContext |
  	sim
  		initStackPages;
  		loadInitialContext;
  		internalizeIPandSP.
  	initialContext := sim frameContext: sim localFP.
  	savedpc := sim localIP.
  	"sim printHeadFrame."
  	aBlock value.
  	"sim printHeadFrame."
  	sim
  		internalPush: sim localIP;
  		externalizeIPandSP.
  	"now undo the execution state"
  	finalContext := sim voidVMStateForSnapshot.
  	self assert: initialContext = finalContext.
+ 	self assert: sim localIP = savedpc.
+ 	sim objectMemory
+ 		storePointer: SuspendedContextIndex
+ 		ofObject: sim activeProcess
+ 		withValue: finalContext!
- 	self assert: sim localIP = savedpc!

Item was changed:
  ----- Method: SpurBootstrap>>writeSnapshotOfTransformedImageAs: (in category 'testing') -----
  writeSnapshotOfTransformedImageAs: imageFileName
  	"The bootstrapped image typically contains a few big free chunks and one huge free chunk.
  	 Test snapshot writing and loading by turning the largest non-huge chunks into segment bridges
  	 and saving."
  	| penultimate ultimate heap sizes counts barriers sim |
  	heap := TransformedImage veryDeepCopy.
  	sim := StackInterpreterSimulator onObjectMemory: heap.
  	sim bootstrapping: true.
  	heap coInterpreter: sim.
  	sim initializeInterpreter: 0;
  		setImageHeaderFlagsFrom: ImageHeaderFlags;
  		setDisplayForm: (Form extent: ImageScreenSize >> 16 @ (ImageScreenSize bitAnd: 16rFFFF)).
  	heap allOldSpaceEntitiesDo: [:e| penultimate := ultimate. ultimate := e].
  	self assert: (heap isFreeObject: penultimate).
  	self assert: (heap isSegmentBridge: ultimate).
  	sizes := Bag new.
  	heap allObjectsInFreeTree: (heap freeLists at: 0) do:
  		[:f|
  		sizes add: (heap bytesInObject: f)].
  	counts := sizes sortedCounts.
  	self assert: counts last key = 1. "1 huge chunk"
+ 	counts size > 1
+ 		ifTrue:
+ 			[self assert: ((counts at: counts size - 1) key > 2
+ 						and: [(counts at: counts size - 1) value > 1024]).
+ 			barriers := (1 to: (counts at: counts size - 1) key) collect:
+ 							[:ign| heap allocateOldSpaceChunkOfExactlyBytes: (counts at: counts size - 1) value].
+ 			barriers := barriers, {heap allocateOldSpaceChunkOfExactlyBytes: (heap bytesInObject: penultimate)}]
+ 		ifFalse:
+ 			[barriers := {heap allocateOldSpaceChunkOfExactlyBytes: (heap bytesInObject: penultimate)}].
- 	self assert: ((counts at: counts size - 1) key > 2
- 				and: [(counts at: counts size - 1) value > 1024]).
- 	barriers := (1 to: (counts at: counts size - 1) key) collect:
- 					[:ign| heap allocateOldSpaceChunkOfExactlyBytes: (counts at: counts size - 1) value].
- 	barriers := barriers, {heap allocateOldSpaceChunkOfExactlyBytes: (heap bytesInObject: penultimate)}.
  	heap setEndOfMemory: barriers last.
  	heap allOldSpaceEntitiesDo: [:e| penultimate := ultimate. ultimate := e].
  	self assert: (heap addressAfter: ultimate) = barriers last.
  	heap checkFreeSpace.
  	heap runLeakCheckerForFullGC: true.
  	heap segmentManager initializeFromFreeChunks: (barriers sort collect: [:b| heap objectStartingAt: b]).
  	heap checkFreeSpace.
  	heap runLeakCheckerForFullGC: true.
  	sim bereaveAndNormalizeContextsAndFlushExternalPrimitives.
  	sim imageName: imageFileName.
  	sim writeImageFileIO!



More information about the Vm-dev mailing list