[Vm-dev] VM Maker: Cog-eem.127.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Dec 18 01:45:36 UTC 2013
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.127.mcz
==================== Summary ====================
Name: Cog-eem.127
Author: eem
Time: 17 December 2013, 5:45:20.273 pm
UUID: 54410332-eb77-4003-ac94-35764c1708c7
Ancestors: Cog-eem.126
Spur bootstrap:
Give immediate classes an illegal instSPec (7, that of forwarded
objects) so that e.g. both SmallInteger new: 0 & SmallInteger new fail.
Change to accomodate the new voidVMState... methods.
Avoid assert fails during bootstrap by setting bootstrapping flag
sooner.
Matches VMMaker.oscog-eem.564.
=============== Diff against Cog-eem.126 ===============
Item was changed:
----- Method: SpurBootstrap>>newClassFormatFor: (in category 'bootstrap image') -----
newClassFormatFor: oldClassObj
"OLD: <2 bits=instSize//64><5 bits=cClass><4 bits=instSpec><6 bits=instSize\\64><1 bit=0>
NEW: <5 bits inst spec><16 bits inst size>"
| oldFormat instSize newInstSpec |
+ ((oldInterpreter classNameOf: oldClassObj Is: 'SmallInteger')
+ or: [oldInterpreter classNameOf: oldClassObj Is: 'Character']) ifTrue:
+ [^newHeap integerObjectOf: newHeap instSpecForImmediateClasses << 16].
oldFormat := oldHeap formatOfClass: oldClassObj. "N.B. SmallInteger with tag bit cleared"
oldFormat := oldFormat >> 1.
instSize := ((oldFormat bitShift: -10) bitAnd: 16rC0) + ((oldFormat bitShift: -1) bitAnd: 16r3F) - 1.
newInstSpec := #(0 1 2 3 4 nil 10 9 16 16 16 16 24 24 24 24) at: ((oldFormat bitShift: -7) bitAnd: 16rF) + 1.
^newHeap integerObjectOf: newInstSpec << 16 + instSize!
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"
+ newHeap bootstrapping: true.
self initMaps!
Item was changed:
----- Method: SpurBootstrap>>scavengeImage (in category 'bootstrap image') -----
scavengeImage
"Scavenge the image to get it into a simpler state."
+ newHeap coInterpreter voidVMStateForSnapshotFlushingExternalPrimitivesIf: false.
- newHeap coInterpreter voidVMStateForSnapshot.
newHeap flushNewSpace!
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 voidVMStateForSnapshotFlushingExternalPrimitivesIf: false.
- finalContext := sim voidVMStateForSnapshot.
self assert: initialContext = finalContext.
self assert: sim localIP = savedpc.
sim objectMemory
storePointer: SuspendedContextIndex
ofObject: sim activeProcess
withValue: finalContext!
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)}].
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 bereaveAllMarriedContextsForSnapshotFlushingExternalPrimitivesIf: true.
- sim bereaveAndNormalizeContextsAndFlushExternalPrimitives.
sim imageName: imageFileName.
sim writeImageFileIO!
More information about the Vm-dev
mailing list