[Vm-dev] VM Maker: Cog-eem.119.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Nov 16 01:10:19 UTC 2013
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.119.mcz
==================== Summary ====================
Name: Cog-eem.119
Author: eem
Time: 15 November 2013, 5:10:02.638 pm
UUID: e98515d8-03ad-451a-b081-2f1f3632127d
Ancestors: Cog-eem.118
Check-point commit prior to changing endOfMemory to be just past
the last bridge. This for fixing the bug which is the last freeChunk
ending past the last bridge, not at the last bridge.
Set the explicit bootstrapping ins var instead of (ab)using
numSegments = 0.
Agrees with VMMaker.oscog-eem.511.
=============== Diff against Cog-eem.118 ===============
Item was changed:
----- Method: SpurBootstrap>>rehashImage (in category 'bootstrap image') -----
rehashImage
"Rehash all collections in newHeap.
Find out which classes implement rehash, entering a 1 against their classIndex in rehashFlags.
Enumerate all objects, rehashing those whose class has a bit set in rehashFlags."
| n sim rehashFlags |
sim := StackInterpreterSimulator onObjectMemory: newHeap.
newHeap coInterpreter: sim.
+ sim bootstrapping: true.
sim initializeInterpreter: 0.
sim instVarNamed: 'methodDictLinearSearchLimit' put: SmallInteger maxVal.
newHeap
setHashBitsOf: newHeap nilObject to: 1;
setHashBitsOf: newHeap falseObject to: 2;
setHashBitsOf: newHeap trueObject to: 3.
rehashFlags := ByteArray new: newHeap numClassTablePages * newHeap classTablePageSize.
n := 0.
newHeap classTableObjectsDo:
[:class| | classIndex |
sim messageSelector: (map at: rehashSym).
"Lookup rehash but don't be fooled by ProtoObject>>rehash, which is just ^self."
((sim lookupMethodNoMNUEtcInClass: class) = 0
and: [(sim isQuickPrimitiveIndex: (sim primitiveIndexOf: (sim instVarNamed: 'newMethod'))) not]) ifTrue:
[n := n + 1.
classIndex := newHeap rawHashBitsOf: class.
rehashFlags
at: classIndex >> 3 + 1
put: ((rehashFlags at: classIndex >> 3 + 1)
bitOr: (1 << (classIndex bitAnd: 7)))]].
Transcript cr; print: n; nextPutAll: ' classes understand rehash. rehashing instances...'; flush.
n := 0.
self withExecutableInterpreter: sim
do: [sim setBreakSelector: 'error:'.
"don't rehash twice (actually without limit), so don't rehash any new objects created."
newHeap allExistingOldSpaceObjectsDo:
[:o| | classIndex |
classIndex := newHeap classIndexOf: o.
((rehashFlags at: classIndex >> 3 + 1) anyMask: 1 << (classIndex bitAnd: 7)) ifTrue:
[(n := n + 1) \\ 8 = 0 ifTrue:
[Transcript nextPut: $.; flush].
"2845 = n ifTrue: [self halt]."
"Rehash an object if its size is > 0.
Symbol implements rehash, but let's not waste time rehashing it; in Squeak
up to 2013 symbols are kept in a set which will get reashed anyway..
Don't rehash empty collections; they may be large for a reason and rehashing will shrink them."
((sim addressCouldBeClassObj: o)
or: [(self interpreter: sim
object: o
perform: (map at: sizeSym)
withArguments: #()) = (newHeap integerObjectOf: 0)]) ifFalse:
[self interpreter: sim
object: o
perform: (map at: rehashSym)
withArguments: #()]]]]!
Item was changed:
----- Method: SpurBootstrap>>writeSnapshotOfTransformedImage (in category 'testing') -----
writeSnapshotOfTransformedImage
"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."
| last 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| last := e].
self assert: (heap isFreeObject: last).
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"
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: last)}.
heap setEndOfMemory: barriers last.
heap allOldSpaceEntitiesDo: [:e| last := e].
self assert: (heap addressAfter: last) = 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: 'spur.image'.
sim writeImageFileIO!
More information about the Vm-dev
mailing list