Tom Braun uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog.seperateMarking-WoC.3337.mcz
==================== Summary ====================
Name: VMMaker.oscog.seperateMarking-WoC.3337 Author: WoC Time: 12 July 2023, 10:38:22.264219 pm UUID: d6e2b073-868e-47be-84ce-0d73b2dc7d94 Ancestors: VMMaker.oscog.seperateMarking-WoC.3336
- remove some of the debugger statements used for debugging
- added retractWavefront as empty implementation into the STWGC for interface compliance
- added retractWavefront to the StackInterpreter string replace too
- fixed issue with retractWavefront trampoline
=============== Diff against VMMaker.oscog.seperateMarking-WoC.3336 ===============
Item was changed: ----- Method: CogObjectRepresentationForSpur>>genRetractWavefrontTrampoline (in category 'initialization') ----- genRetractWavefrontTrampoline
<inline: true> "SIM_ prefix comes from static polymorphism. unfortunately it is necessary :(" ^cogit + genTrampolineFor: #SIGC_retractWavefrontFrom:startingAt: - genTrampolineFor: #retractWavefrontFrom:startingAt: called: 'ceRetractWavefrontTrampoline' + numArgs: 2 - numArgs: 1 arg: ReceiverResultReg arg: Arg0Reg arg: nil arg: nil regsToSave: CallerSavedRegisterMask pushLinkReg: true resultReg: NoReg appendOpcodes: false!
Item was changed: ----- Method: InterpreterPrimitives>>primitiveSpurStringReplace (in category 'indexing primitives') ----- primitiveSpurStringReplace "<array> primReplaceFrom: start to: stop with: replacement startingAt: repStart <primitive: 105>" <inline: true> + <staticallyResolveReceiver: 'objectMemory gc' to: #SpurIncrementalGarbageCollector> | array start stop repl replStart arrayFmt arrayLength arrayInstSize replFmt replLength replInstSize srcDelta | array := self stackValue: 4. start := self stackValue: 3. stop := self stackValue: 2. repl := self stackValue: 1. replStart := self stackValue: 0.
((objectMemory isNonIntegerObject: start) or: [(objectMemory isNonIntegerObject: stop) or: [(objectMemory isNonIntegerObject: replStart) or: [objectMemory isImmediate: repl]]]) ifTrue: "can happen in LgInt copy" [^self primitiveFailFor: PrimErrBadArgument].
start := objectMemory integerValueOf: start. stop := objectMemory integerValueOf: stop. replStart := objectMemory integerValueOf: replStart.
(stop >= start and: [objectMemory isObjImmutable: array]) ifTrue: [^self primitiveFailFor: PrimErrNoModification].
arrayFmt := objectMemory formatOf: array. replFmt := objectMemory formatOf: repl.
"N.B. In the below start - 1 to: stop - 1 do:, Slang is intelligent enough to use < instead of <= so avoiding the stop - 1." arrayFmt <= objectMemory lastPointerFormat ifTrue: ["Array formats must be the same; but for copying, weak arrays are equivalent to arrays." arrayFmt = objectMemory weakArrayFormat ifTrue: [arrayFmt := objectMemory arrayFormat]. replFmt = objectMemory weakArrayFormat ifTrue: [replFmt := objectMemory arrayFormat]. arrayFmt ~= replFmt ifTrue: [^self primitiveFailFor: PrimErrInappropriate].
arrayLength := objectMemory numSlotsOf: array. arrayInstSize := objectMemory fixedFieldsOf: array format: arrayFmt length: arrayLength. replLength := objectMemory numSlotsOf: repl. replInstSize := objectMemory fixedFieldsOf: repl format: replFmt length: replLength. (start >= 1 and: [start - 1 <= stop and: [stop + arrayInstSize <= arrayLength and: [replStart >= 1 and: [stop - start + replStart + replInstSize <= replLength]]]]) ifFalse: [^self primitiveFailFor: PrimErrBadIndex].
start := start + arrayInstSize. stop := stop + arrayInstSize. srcDelta := (replStart + replInstSize) - start. (objectMemory isOldObject: array) ifTrue: [| mustRemember oop | mustRemember := false. start - 1 to: stop - 1 do: [:i | oop := objectMemory fetchPointer: srcDelta + i ofObject: repl. (objectMemory isYoung: oop) ifTrue: [mustRemember := true]. objectMemory storePointerUnchecked: i ofObject: array withValue: oop]. + mustRemember + ifTrue: [objectMemory possibleRootStoreInto: array] + ifFalse: [ + objectMemory gc isIncremental + ifTrue: [ + "We push the work to the gc. Otherwise we would have to check for every replacement if it is marked. " + (objectMemory marker isCurrentlyMarking and: [objectMemory isMarked: array]) + ifTrue: [objectMemory gc retractWavefrontFrom: array startingAt: start]]]] - mustRemember ifTrue: - [objectMemory possibleRootStoreInto: array]] ifFalse: [start - 1 to: stop - 1 do: [:i | objectMemory storePointerUnchecked: i ofObject: array withValue: (objectMemory fetchPointer: srcDelta + i ofObject: repl)]]. "We might consider comparing stop - start to some value here and using forceInterruptCheck" ^self pop: argumentCount "leave rcvr on stack"].
"Non-pointer array formats must match" arrayLength := objectMemory lengthOf: array format: arrayFmt. replLength := objectMemory lengthOf: repl format: replFmt. arrayFmt := objectMemory classFormatFromInstFormat: arrayFmt. replFmt := objectMemory classFormatFromInstFormat: replFmt. (arrayFmt = replFmt and: [arrayFmt >= objectMemory sixtyFourBitIndexableFormat and: [arrayFmt < objectMemory firstCompiledMethodFormat]]) ifFalse: [^self primitiveFailFor: PrimErrInappropriate]. (start >= 1 and: [start - 1 <= stop and: [stop <= arrayLength and: [replStart >= 1 and: [stop - start + replStart <= replLength]]]]) ifFalse: [^self primitiveFailFor: PrimErrBadIndex]. srcDelta := replStart - start. arrayFmt >= objectMemory firstShortFormat ifTrue: "8 & 16-bit word type objects" [arrayFmt >= objectMemory firstByteFormat ifTrue: "byte-type objects" [start - 1 to: stop - 1 do: [:i | objectMemory storeByte: i ofObject: array withValue: (objectMemory fetchByte: srcDelta + i ofObject: repl)]] ifFalse: "short type objects" [start - 1 to: stop - 1 do: [:i | objectMemory storeShort16: i ofObject: array withValue: (objectMemory fetchShort16: srcDelta + i ofObject: repl)]]] ifFalse: "32 & 64-bit word type objects" [arrayFmt >= objectMemory firstLongFormat ifTrue: "word-type objects" [start - 1 to: stop - 1 do: [:i | objectMemory storeLong32: i ofObject: array withValue: (objectMemory fetchLong32: srcDelta + i ofObject: repl)]] ifFalse: "long type objects" [start - 1 to: stop - 1 do: [:i | objectMemory storeLong64: i ofObject: array withValue: (objectMemory fetchLong64: srcDelta + i ofObject: repl)]]]. "We might consider comparing stop - start to some value here and using forceInterruptCheck" ^self pop: argumentCount "leave rcvr on stack"!
Item was added: + ----- Method: SpurGarbageCollector>>retractWavefrontFrom:startingAt: (in category 'barrier') ----- + retractWavefrontFrom: objOop startingAt: index + + ^ self shouldBeImplemented!
Item was changed: ----- Method: SpurIncrementalMarker>>markAndShouldScan: (in category 'marking - incremental') ----- markAndShouldScan: objOop "marks the object (grey or black as neccessary) and returns if the object should be scanned Objects that get handled later on get marked as black, as they are practically a leaf in the object tree (we scan them later on, so we cannot lose objects and do not need to adhere to the tricolor invariant)"
| format | <api> <inline: true> + self assert: self isCurrentlyMarking. - self isCurrentlyMarking not ifTrue: [manager debugger]. ((manager isImmediate: objOop) or: [manager isYoungObject: objOop]) ifTrue: [^ false]. self assert: (manager isForwarded: objOop) not.
"if it is marked we already did everything we needed to do and if is grey we already saw it and do not have to do anything here" (manager isWhite: objOop) ifFalse: [^false]. format := manager formatOf: objOop. (manager isPureBitsFormat: format) ifTrue: "avoid pushing non-pointer objects on the markStack." ["Avoid tracing classes of non-objects on the heap, e.g. IRC caches, Sista counters." (manager classIndexOf: objOop) > manager lastClassIndexPun ifTrue: [self markAndTraceClassOf: objOop]. "the object does not need to enter the marking stack as there are no pointer to visit -> it is already finished and we can make it black" self blackenObject: objOop. ^false]. (manager isWeakFormat: format) ifTrue: "push weaklings on the weakling stack to scan later" [manager push: objOop onObjStack: manager weaklingStack. "do not follow weak references. They get scanned at the end of marking -> it should be ok to not follow the tricolor invariant" self blackenObject: objOop. ^false]. ((manager isEphemeronFormat: format) and: [manager activeAndDeferredScan: objOop]) ifTrue: [self blackenObject: objOop. ^false]. "we know it is an object that can contain we have to follow" self pushOnMarkingStackAndMakeGrey: objOop. ^ true!
Item was changed: ----- Method: SpurIncrementalSweepAndCompact>>assertSegmentToFillIsInSegmentsArray (in category 'as yet unclassified') ----- assertSegmentToFillIsInSegmentsArray
| segInfo | compactor segmentToFill ifNil: [^ self]. segInfo := manager segInfoAt: manager numSegments - 1.
+ self assert: (manager segmentManager segments <= compactor segmentToFill and: [compactor segmentToFill <= segInfo])! - self assert: (manager segmentManager segments <= compactor segmentToFill and: [compactor segmentToFill <= segInfo]). - - (manager segmentManager segments <= compactor segmentToFill and: [compactor segmentToFill <= segInfo]) - ifFalse: [manager debugger]!
Item was changed: ----- Method: SpurIncrementalSweeper>>cleanUpLilliputianChunks (in category 'as yet unclassified') ----- cleanUpLilliputianChunks
"- remove all lilliputian chunks in the range of this sweep - patch the lilliputian free list with the saved values on the MarkStack - append all newly created (or already existing but previously here removed) lilliputian chunks" self flag: #Todo. "it would be nicer if we appened lilliputian chunk lists instead of prepending. Not sure if it has any preformance impact"
(manager isEmptyObjStack: manager markStack) not ifTrue: [ | node prev | node := manager freeLists at: 2. prev := 0. [node ~= 0 or: [(manager isEmptyObjStack: manager markStack) not]] whileTrue: [ "we already found the end of the list, although we did not connect all links from the list in the swept area" node = 0 ifTrue: [node := (manager popObjStack: manager markStack). manager noCheckPush: 0 onObjStack: manager markStack. "attach the element to the previous tail of the list" manager setNextFreeChunkOf: prev withValue: node isLilliputianSize: true]. (node >= sweepingStart and: [node < currentSweepingEntity]) ifTrue: [ "the node is in the swept area" self assert: (manager sizeOfObjStack: manager markStack) > 0. node := (manager popObjStack: manager markStack).
"We popped the end of the list. As there are more links use them first" (node = 0 and: [(manager sizeOfObjStack: manager markStack) > 0]) ifTrue: [ node := (manager popObjStack: manager markStack). manager noCheckPush: 0 onObjStack: manager markStack]. manager totalFreeOldSpace: manager totalFreeOldSpace - manager lilliputianChunkSize. prev = 0 ifTrue: [manager freeLists at: 2 put: node] ifFalse: [manager setNextFreeChunkOf: prev withValue: node isLilliputianSize: true]] ifFalse: [ prev := node. node := (manager fetchPointer: manager freeChunkNextIndex ofFreeChunk: node)]]].
self assert: (manager isEmptyObjStack: manager markStack). - (manager sizeOfObjStack: manager markStack) ~= 0 ifTrue: [manager debugger]. - lilliputianListEnd ~= 0 ifTrue: [ manager setNextFreeChunkOf: lilliputianListEnd withValue: (manager freeLists at: 2) isLilliputianSize: true. manager freeLists at: 2 put: lilliputianList. manager totalFreeOldSpace: manager totalFreeOldSpace + (lilliputianListSize * manager lilliputianChunkSize)]. self assert: manager totalFreeOldSpace = manager totalFreeListBytes. "update free lists mask just to be sure as we probably manipulated it here" (manager freeLists at: 2) = 0 ifTrue: [manager freeListsMask: (manager freeListsMask bitClear: 2)] ifFalse: [manager freeListsMask: (manager freeListsMask bitOr: 2r100)]. self assert: manager bitsSetInFreeSpaceMaskForAllFreeLists !
Item was added: + ----- Method: SpurMemoryManager>>SIGC_retractWavefrontFrom:startingAt: (in category 'cog jit support') ----- + SIGC_retractWavefrontFrom: objOop startingAt: index + + <doNotGenerate> + gc retractWavefrontFrom: objOop startingAt: index!
Item was changed: ----- Method: SpurMemoryManager>>allNecessaryRememberedBitsSet (in category 'debug support') ----- allNecessaryRememberedBitsSet
self allOldSpaceObjectsDo: [:obj | | shouldBeRem | shouldBeRem := self shouldBeRemembered: obj. (shouldBeRem not or: [shouldBeRem = (self isRemembered: obj)]) + ifFalse: [bogon := obj. ^ false]]. - ifFalse: [bogon := obj. self debugger. ^ false]]. ^ true !
Item was changed: ----- Method: SpurMemoryManager>>allReferencesMarkedFor: (in category 'debug support') ----- allReferencesMarkedFor: objOop
((self isPointers: objOop) and: [(self isContext: objOop) not]) ifTrue: [| slotCount | slotCount := self numSlotsOf: objOop. 0 to: slotCount - 1 do: [:index | | slot | slot := self fetchPointer: index ofObject: objOop. ((self isNonImmediate: slot) and: [(self isOldObject: slot) and: [(self isForwarded: slot) not]]) ifTrue: [(self isMarkedOrYoung: slot) not + ifTrue: [^ false]]]]. - ifTrue: [self debugger. - ^ false]]]]. ^ true!
Item was changed: ----- Method: SpurMemoryManager>>allRememberedBitsCorrect (in category 'debug support') ----- allRememberedBitsCorrect
self allOldSpaceObjectsDo: [:obj | (self shouldBeRemembered: obj) = (self isRemembered: obj) + ifFalse: [bogon := obj. ^ false]]. - ifFalse: [bogon := obj. self debugger. ^ false]]. ^ true !
Item was removed: - ----- Method: SpurMemoryManager>>retractWavefrontFrom:startingAt: (in category 'cog jit support') ----- - retractWavefrontFrom: objOop startingAt: index - - <doNotGenerate> - gc retractWavefrontFrom: objOop startingAt: index!
Item was added: + ----- Method: SpurStopTheWorldGarbageCollector>>retractWavefrontFrom:startingAt: (in category 'barrier') ----- + retractWavefrontFrom: objOop startingAt: index + + !
vm-dev@lists.squeakfoundation.org