[Vm-dev] VM Maker: Cog-eem.95.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Sep 20 21:38:37 UTC 2013
Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.95.mcz
==================== Summary ====================
Name: Cog-eem.95
Author: eem
Time: 20 September 2013, 2:38:26.947 pm
UUID: b1121b44-9ae1-4477-b7b2-1b09935e73c5
Ancestors: Cog-eem.94
SpurBootstrap:
Implement freeForwarders & a stub compactImage. Turns out not to
be needed because the scavenger is effecive enough that no
forwarders get tenured during rehash.
Comment the halt in replacementForCharacterMethod: (thanks Frank!).
Allocate a bigger heap. Run the leak checker on launch (probably
doubling up, but what the hell).
=============== Diff against Cog-eem.94 ===============
Item was added:
+ ----- Method: SpurBootstrap>>compactImage (in category 'bootstrap image') -----
+ compactImage
+ | firstFree lastUsed |
+ newHeap allHeapEntitiesDo:
+ [:o|
+ (newHeap isFreeObject: o)
+ ifTrue: [firstFree ifNil: [firstFree := o]]
+ ifFalse: [lastUsed := o]].
+ lastUsed < firstFree ifTrue: "nothing to do"
+ [^self].
+ self halt!
Item was added:
+ ----- Method: SpurBootstrap>>freeForwarders (in category 'bootstrap image') -----
+ freeForwarders
+ "Check that all forwarders have been followed. Then free them."
+ | numForwarders numFreed |
+ numForwarders := numFreed := 0.
+ newHeap allObjectsDo:
+ [:o|
+ (newHeap isForwarded: o)
+ ifTrue: [numForwarders := numForwarders + 1]
+ ifFalse:
+ [0 to: (newHeap numPointerSlotsOf: o) - 1 do:
+ [:i|
+ self assert: (newHeap isOopForwarded: (newHeap fetchPointer: i ofObject: o)) not]]].
+ Transcript nextPutAll: 'freeing '; print: numForwarders; nextPutAll: ' forwarders'; cr; flush.
+ newHeap allObjectsDo:
+ [:o|
+ (newHeap isForwarded: o) ifTrue:
+ [numFreed := numFreed + 1.
+ newHeap freeObject: o]].
+ self assert: numFreed = numForwarders!
Item was changed:
----- Method: SpurBootstrap>>launch:headerFlags: (in category 'testing') -----
launch: heap headerFlags: headerFlags
| sim |
sim := StackInterpreterSimulator onObjectMemory: heap.
heap coInterpreter: sim.
sim
initializeInterpreter: 0;
setImageHeaderFlagsFrom: headerFlags;
imageName: ImageName;
flushExternalPrimitives;
openAsMorph;
transcript: Transcript. "deep copy copies this"
"sim
instVarNamed: 'printSends' put: true;
instVarNamed: 'printReturns' put: true;
instVarNamed: 'methodDictLinearSearchLimit' put: SmallInteger maxVal." "for now"
+ heap
+ setCheckForLeaks: 15;
+ runLeakCheckerForFullGC: true.
+
- heap setCheckForLeaks: 15.
sim halt; run!
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)
- allocateMemoryOfSize: (oldHeap youngStart * 5 / 4 roundUpTo: 8)
newSpaceSize: 1024 * 1024
codeSize: 1024 * 1024.
+ newHeap setCheckForLeaks: 15 - 4. "don't check become; soooo many rehashes in bootstrap"
- newHeap setCheckForLeaks: 15 - 4. "don't check become"
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>>replacementForCharacterMethod: (in category 'bootstrap methods') -----
replacementForCharacterMethod: characterMethodOop
"Answer a replacement method for the argument if it refers
to Character's old inst var value. Otherwise answer nil."
| proxy asIntegerProxy clone assembly newInsts newMethod |
"(oldHeap stringOf: (oldHeap longAt: characterMethodOop + (oldHeap lastPointerOf: characterMethodOop) - 4)) = 'isOctetCharacter' ifTrue:
[self halt]."
proxy := VMCompiledMethodProxy new
for: characterMethodOop
coInterpreter: oldInterpreter
objectMemory: oldHeap.
clone := self cloneMethodProxy: proxy.
+ "Quick methods accessing value should have been replaced. The halt will fire if there
+ is a missing prototype for such a method on the class side of SpurBootstrap. The
+ relevant Character prototypes there so far are Character>>asInteger, Character>>
+ asciiValue, Character>>hash & Character>>identityHash. Conceivably the bootstrap
+ could be applied to an image that has others; hence the halt."
- "Quick methods accessing value should have been replaced."
clone isReturnField ifTrue: [self halt].
clone hasInstVarRef ifFalse:
[^nil].
clone setSourcePointer: 0.
asIntegerProxy := VMObjectProxy new
for: (literalMap at: #asInteger)
coInterpreter: oldInterpreter
objectMemory: oldHeap.
assembly := BytecodeDisassembler new disassemble: clone.
assembly literals: (assembly literals allButLast: 2), {asIntegerProxy}, (assembly literals last: 2).
"Do this by looking for index of pushReceiverVariable: and replacing it by pushSelf, send asInteger"
newInsts := (assembly instructions piecesCutWhere:
[:msgOrLabelAssoc :nextInst|
msgOrLabelAssoc isVariableBinding not
and: [msgOrLabelAssoc selector == #pushReceiverVariable:]]) fold:
[:a :b|
a allButLast,
{ Message selector: #pushReceiver.
Message
selector: #send:super:numArgs:
arguments: {asIntegerProxy. false. 0}},
b].
assembly instructions: newInsts.
newMethod := assembly assemble.
^self
installableMethodFor: newMethod
selector: clone selector
className: #Character
isMeta: false!
Item was changed:
----- Method: SpurBootstrap>>transform (in category 'bootstrap image') -----
transform
self rememberRehashSymbol.
self findRequiredGlobals.
self installModifiedMethods.
self bootstrapImage.
self validate.
self rehashImage.
self followForwardingPointers.
self scavengeImage.
+ self freeForwarders.
+ self compactImage.
Transcript nextPutAll: 'done.'; flush.!
More information about the Vm-dev
mailing list